嵌入式linux相机 摄像头模块

 video_manager.c

/**********************************************************************
 * 函数名称: RegisterVideoOpr
 * 功能描述: 注册"字体模块", 所谓字体模块就是取出字符位图的方法
 * 输入参数: ptVideoOpr - 一个结构体,内含"取出字符位图"的操作函数
 * 输出参数: 无
 * 返 回 值: 0 - 成功, 其他值 - 失败
 * 修改日期        版本号     修改人	      修改内容
 * -----------------------------------------------
 * 2013/02/08	     V1.0	  韦东山	      创建
 ***********************************************************************/

int RegisterVideoOpr(PT_VideoOpr ptVideoOpr)
{
	PT_VideoOpr ptTmp;

	if (!g_ptVideoOprHead)
	{
		g_ptVideoOprHead   = ptVideoOpr;
		ptVideoOpr->ptNext = NULL;
	}
	else
	{
		ptTmp = g_ptVideoOprHead;
		while (ptTmp->ptNext)
		{
			ptTmp = ptTmp->ptNext;
		}
		ptTmp->ptNext     = ptVideoOpr;
		ptVideoOpr->ptNext = NULL;
	}

	return 0;
}


/**********************************************************************
 * 函数名称: ShowVideoOpr
 * 功能描述: 显示本程序能支持的"字体模块"
 * 输入参数: 无
 * 输出参数: 无
 * 返 回 值: 无
 * 修改日期        版本号     修改人	      修改内容
 * -----------------------------------------------
 * 2013/02/08	     V1.0	  韦东山	      创建
 ***********************************************************************/

void ShowVideoOpr(void)
{
	int i = 0;
	PT_VideoOpr ptTmp = g_ptVideoOprHead;

	while (ptTmp)
	{
		printf("%02d %s\n", i++, ptTmp->name);
		ptTmp = ptTmp->ptNext;
	}
}

/**********************************************************************
 * 函数名称: GetVideoOpr
 * 功能描述: 根据名字取出指定的"字体模块"
 * 输入参数: pcName - 名字
 * 输出参数: 无
 * 返 回 值: NULL   - 失败,没有指定的模块, 
 *            非NULL - 字体模块的PT_VideoOpr结构体指针
 * 修改日期        版本号     修改人	      修改内容
 * -----------------------------------------------
 * 2013/02/08	     V1.0	  韦东山	      创建
 ***********************************************************************/

PT_VideoOpr GetVideoOpr(char *pcName)
{
	PT_VideoOpr ptTmp = g_ptVideoOprHead;
	
	while (ptTmp)
	{
		if (strcmp(ptTmp->name, pcName) == 0)
		{
			return ptTmp;
		}
		ptTmp = ptTmp->ptNext;
	}
	return NULL;
}


/**********************************************************************
 * 函数名称: FontsInit
 * 功能描述: 调用各个字体模块的初始化函数
 * 输入参数: 无
 * 输出参数: 无
 * 返 回 值: 0 - 成功, 其他值 - 失败
 * 修改日期        版本号     修改人	      修改内容
 * -----------------------------------------------
 * 2013/02/08	     V1.0	  韦东山	      创建
 ***********************************************************************/

int VideoInit(void)
{
	int iError;

    iError = V4l2Init();

	return iError;
}

video_manager.h

#ifndef _VIDEO_MANAGER_H
#define _VIDEO_MANAGER_H

#include <config.h>
#include <pic_operation.h>

#define NB_BUFFER 4

struct VideoDevice;
struct VideoOpr;
typedef struct VideoDevice T_VideoDevice, *PT_VideoDevice;
typedef struct VideoOpr T_VideoOpr, *PT_VideoOpr;

typedef struct VideoDevice {
    int iFd;
    int iPixelFormat;
    int iWidth;
    int iHeight;

    int iVideoBufCnt;
    int iVideoBufMaxLen;
    int iVideoBufCurIndex;
    unsigned char *pucVideBuf[NB_BUFFER];

    /* ���� */
    PT_VideoOpr ptOPr;
}T_VideoDevice, *PT_VideoDevice;

typedef struct VideoBuf {
    T_PixelDatas tPixelDatas;
    int iPixelFormat;
}T_VideoBuf, *PT_VideoBuf;

typedef struct VideoOpr {
    char *name;
    int (*InitDevice)(char *strDevName, PT_VideoDevice ptVideoDevice);
    int (*ExitDevice)(PT_VideoDevice ptVideoDevice);
    int (*GetFrame)(PT_VideoDevice ptVideoDevice, PT_VideoBuf ptVideoBuf);
    int (*PutFrame)(PT_VideoDevice ptVideoDevice, PT_VideoBuf ptVideoBuf);
    int (*StartDevice)(PT_VideoDevice ptVideoDevice);
    int (*StopDevice)(PT_VideoDevice ptVideoDevice);
}T_VideoOpr, *PT_VideoOpr;


int V4l2Init(void);

#endif /* _VIDEO_MANAGER_H */

v4l2.c(链接)

v4l2.c

相关推荐

  1. 嵌入linux相机 摄像头模块

    2024-07-17 07:42:02       31 阅读
  2. 嵌入linux相机 转换模块

    2024-07-17 07:42:02       21 阅读
  3. 嵌入相关介绍

    2024-07-17 07:42:02       31 阅读
  4. 嵌入摄像头,获取视频要通过进程通讯?

    2024-07-17 07:42:02       38 阅读
  5. 嵌入——C++】模板

    2024-07-17 07:42:02       57 阅读
  6. 嵌入模块代码(一)

    2024-07-17 07:42:02       31 阅读
  7. 嵌入Linux:如何进行嵌入Linux开发?

    2024-07-17 07:42:02       50 阅读
  8. 嵌入Linux:空洞文件

    2024-07-17 07:42:02       34 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-07-17 07:42:02       66 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-07-17 07:42:02       70 阅读
  3. 在Django里面运行非项目文件

    2024-07-17 07:42:02       57 阅读
  4. Python语言-面向对象

    2024-07-17 07:42:02       68 阅读

热门阅读

  1. 服务器网络配置

    2024-07-17 07:42:02       25 阅读
  2. [NOIP2006 提高组] 能量项链(含代码)

    2024-07-17 07:42:02       24 阅读
  3. VBA学习(20):一批简单的Excel VBA编程问题解答

    2024-07-17 07:42:02       27 阅读
  4. ubuntu下发布应用,ldd脚本代替linuxdeployqt

    2024-07-17 07:42:02       20 阅读
  5. 我们来科普以下vue中v-show 和v-if区别

    2024-07-17 07:42:02       24 阅读
  6. Day 10.08函数作业答案·二

    2024-07-17 07:42:02       23 阅读
  7. 面试题 30. 包含 min 函数的栈

    2024-07-17 07:42:02       25 阅读
  8. OpenResty使用Lua笔记

    2024-07-17 07:42:02       25 阅读
  9. Springboot定义阿里云oss工具类

    2024-07-17 07:42:02       24 阅读
  10. 入门 git

    2024-07-17 07:42:02       21 阅读
  11. IPython 的 %history -p 命令:探索命令行历史的秘籍

    2024-07-17 07:42:02       29 阅读