当前位置:   article > 正文

嵌入式linux相机 转换模块

嵌入式linux相机 转换模块

convert_manager.c

  1. #include <config.h>
  2. #include <convert_manager.h>
  3. #include <string.h>
  4. static PT_VideoConvert g_ptVideoConvertHead = NULL;
  5. /**********************************************************************
  6. * 函数名称: RegisterVideoConvert
  7. * 功能描述: 注册"字体模块", 所谓字体模块就是取出字符位图的方法
  8. * 输入参数: ptVideoConvert - 一个结构体,内含"取出字符位图"的操作函数
  9. * 输出参数: 无
  10. * 返 回 值: 0 - 成功, 其他值 - 失败
  11. * 修改日期 版本号 修改人 修改内容
  12. * -----------------------------------------------
  13. * 2013/02/08 V1.0 韦东山 创建
  14. ***********************************************************************/
  15. //构造结构体,并形成链表
  16. int RegisterVideoConvert(PT_VideoConvert ptVideoConvert)
  17. {
  18. PT_VideoConvert ptTmp;
  19. if (!g_ptVideoConvertHead)
  20. {
  21. g_ptVideoConvertHead = ptVideoConvert;
  22. ptVideoConvert->ptNext = NULL;
  23. }
  24. else
  25. {
  26. ptTmp = g_ptVideoConvertHead;
  27. while (ptTmp->ptNext)
  28. {
  29. ptTmp = ptTmp->ptNext;
  30. }
  31. ptTmp->ptNext = ptVideoConvert;
  32. ptVideoConvert->ptNext = NULL;
  33. }
  34. return 0;
  35. }
  36. /**********************************************************************
  37. * 函数名称: ShowVideoConvert
  38. * 功能描述: 显示本程序能支持的"字体模块"
  39. * 输入参数: 无
  40. * 输出参数: 无
  41. * 返 回 值: 无
  42. * 修改日期 版本号 修改人 修改内容
  43. * -----------------------------------------------
  44. * 2013/02/08 V1.0 韦东山 创建
  45. ***********************************************************************/
  46. //显示一个结构体的name成员
  47. void ShowVideoConvert(void)
  48. {
  49. int i = 0;
  50. PT_VideoConvert ptTmp = g_ptVideoConvertHead;
  51. while (ptTmp)
  52. {
  53. printf("%02d %s\n", i++, ptTmp->name);
  54. ptTmp = ptTmp->ptNext;
  55. }
  56. }
  57. /**********************************************************************
  58. * 函数名称: GetVideoConvert
  59. * 功能描述: 根据名字取出指定的"字体模块"
  60. * 输入参数: pcName - 名字
  61. * 输出参数: 无
  62. * 返 回 值: NULL - 失败,没有指定的模块,
  63. * 非NULL - 字体模块的PT_VideoConvert结构体指针
  64. * 修改日期 版本号 修改人 修改内容
  65. * -----------------------------------------------
  66. * 2013/02/08 V1.0 韦东山 创建
  67. ***********************************************************************/
  68. //根据结构的name来得到结构体
  69. PT_VideoConvert GetVideoConvert(char *pcName)
  70. {
  71. PT_VideoConvert ptTmp = g_ptVideoConvertHead;
  72. while (ptTmp)
  73. {
  74. if (strcmp(ptTmp->name, pcName) == 0)
  75. {
  76. return ptTmp;
  77. }
  78. ptTmp = ptTmp->ptNext;
  79. }
  80. return NULL;
  81. }
  82. /**********************************************************************
  83. * 函数名称: FontsInit
  84. * 功能描述: 调用各个字体模块的初始化函数
  85. * 输入参数: 无
  86. * 输出参数: 无
  87. * 返 回 值: 0 - 成功, 其他值 - 失败
  88. * 修改日期 版本号 修改人 修改内容
  89. * -----------------------------------------------
  90. * 2013/02/08 V1.0 韦东山 创建
  91. ***********************************************************************/
  92. //各个转化模块初始化
  93. int VideoConvertInit(void)
  94. {
  95. int iError;
  96. iError = Yuv2RgbInit();
  97. iError |= Mjpeg2RgbInit();
  98. iError |= Rgb2RgbInit();
  99. return iError;
  100. }

convert_manager.h

  1. #ifndef _CONVERT_MANAGER_H
  2. #define _CONVERT_MANAGER_H
  3. #include <config.h>
  4. #include <video_manager.h>
  5. typedef struct VideoConvert {
  6. int (*isSupport)(int iPixelFormatIn, int iPixelFormatOut); // 看输入像素格式 是否支持 转化成 输出像素格式
  7. int (*Convert)(PT_VideoBuf ptVideoBufIn, PT_VideoBuf ptVideoBufOut); //输入像素buf 转换成 输出像素buf
  8. int (*ConvertExit)(PT_VideoBuf ptVideoBufOut);//输出像素buf在 convert函数中申请内存,用完要释放掉
  9. }T_VideoConvert, *PT_VideoConvert;
  10. #endif /* _CONVERT_MANAGER_H */

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小桥流水78/article/detail/847362?site
推荐阅读
相关标签
  

闽ICP备14008679号