SDL 1.2版本显示YUYV422数据
2015-01-26 13:46
337 查看
/* * SdlShow.h * * Created on: 2014-6-1 * Author: root */ #ifndef SDLSHOW_H_ #define SDLSHOW_H_ #include <SDL/SDL.h> #include <SDL/SDL_thread.h> class SdlShow { public: SdlShow(); ~SdlShow(); bool SdlInitlib(const int &iWidth ,const int &iHeigth); bool SdlWindowsShow(unsigned char * pyuv422); private: SDL_Overlay *Overlay; SDL_Surface *Surface; SDL_Rect Rect; SDL_Event Event; int m_iWidth; int m_iHeight; }; #endif /* SDLSHOW_H_ */
/* * SdlShow.cpp * * Created on: 2014-6-1 * Author: root */ #include"SdlShow.h" SdlShow::SdlShow() { Overlay = NULL; Surface = NULL; memset(&Rect,0,sizeof(SDL_Rect)); memset(&Event,0,sizeof(SDL_Event)); m_iWidth = 0; m_iHeight = 0; } SdlShow::~SdlShow() { } bool SdlShow::SdlInitlib(const int &iWidth ,const int &iHeigth) { m_iWidth = iWidth; m_iHeight = iHeigth; if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER)) { fprintf(stderr, "Could not initialize SDL - %s\n", SDL_GetError()); exit(1); } Surface = SDL_SetVideoMode(iWidth, iHeigth, 0, 0); if(!Surface) { perror(" create vide omode error ! \n"); return -1; } Overlay = SDL_CreateYUVOverlay(iWidth,iHeigth,SDL_YUY2_OVERLAY,Surface); Rect.x = 0; Rect.y = 0; Rect.w = iWidth; Rect.h = iHeigth; return true; } bool SdlShow::SdlWindowsShow(unsigned char * pyuv422) { SDL_LockYUVOverlay(Overlay); memcpy(Overlay->pixels[0],pyuv422,2*m_iWidth*m_iHeight); SDL_UnlockYUVOverlay(Overlay); SDL_DisplayYUVOverlay(Overlay, &Rect); return true; }
mian.cpp
YUYV422bufer
SdlShow oSdlShow;
oSdlShow.SdlInitlib(Width,Height);
oSdlShow.SdlWindowsShow(YUYV422bufer);
linux 下应用SDL1.2和V4L2 获取双目摄像头数据并一起显示eclipse工程源代码地址
http://download.csdn.net/detail/sfe1012/8397383
相关文章推荐
- echarts3.0版本radar图tooltip实现显示单轴数据
- 屏蔽掉Ogre1.7版本以后的 LOGO和FPS数据显示
- SDL 显示解码后的yuv12数据
- LevelDB初探之简单使用 2014-07-28 17:16:18 分类: 大数据 一、简介 LevelDB是google开源的一个key-value存储引擎库,从版本1.2开始就
- 获取手机通讯录-----1.2(取出通讯录数据,用ListView)显示
- 关于centos6.5虚拟机SDL不能显示YUV数据的问题
- 使用SDL1.2版本的 同学注意了,SDL2.0版本的变动
- Atitit react 详细使用总结 绑定列表显示 attilax总结 1. 前言 1 1.1. 资料数量在百度内的数量对比 1 1.2. 版本16 v15.6.1 1 1.3. 引入js 2
- 串口调试助手上输入数据,然后再数码管显示(C语言版本)
- 【ffmpeg学习】利用SDL2.0显示ffmpeg解码出来的数据
- ArcCatalog显示ArcSDE所有数据的注册版本信息
- 屏蔽掉Ogre1.7版本以后的 LOGO和FPS数据显示
- SDL2.0在mfc窗口中显示yuv 数据
- YUV数据用SDL显示不正常
- php 编成显示数据 简单版本
- DBCC大全集之(适用版本MS SQLServer 2008 R2)----DBCC SHOWCONTIG显示指定的表或视图的数据和索引的碎片信息
- spring mvc 4.x 版本在返回给ajax调用的json数据时候,出现中文显示???的处理方法
- FFmpeg_3.2.4+SDL_2.0.5学习(1)音视频解码帧及显示/播放数据
- WIN7 7100+TOAD最新版本9.7.2.5切换到SCRIPT显示注释的时候是乱码。表数据中文显示正常!求解决方案。
- jQuery EasyUI 1.5版本的Datagrid终于新增了表格加载的数据没有记录的时候,可显示“无记录”的提示语