SDL 1.2版本显示YUYV422数据
来源:互联网 发布:新华书店淘宝旗舰店 编辑:程序博客网 时间:2024/06/01 20:11
/* * 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
0 0
- SDL 1.2版本显示YUYV422数据
- SDL学习笔记7--用SDL显示图像数据
- YUV数据用SDL显示不正常
- SDL显示
- linux下将YUYV422数据转换为IplImage(黑白)
- 移植SDL最新版本
- SDL显示中文字体
- SDL图像显示
- SDL文字显示
- SDL显示文字
- SDL图像显示
- 嵌入式 SDL显示文字
- sdl文字显示
- SDL文字显示
- libvirt支持sdl显示
- SDL显示文字
- SDL显示一张图片
- SDL显示的使用
- max232接法详解
- @JsonIgnoreProperties(value={"hibernateLazyInitializer"}) 属性
- JAVA之旅——重温Java关键词2
- STM32F411RE Nucleo笔记-按键控制PWM占空比
- HDU1213 How Many Tables 【标准并查集】
- SDL 1.2版本显示YUYV422数据
- 【树形DP】Centroid
- [JNI]如何在ANDROID JNI 的C++中打Log
- 关于linux kernel里的high memory
- Controlling How NSThread and NSRunLoop Exit
- IOS中的WebView
- Sicily 1036. Crypto Columns
- 读取JSON字符串,转为XML文件(二)
- Phoenix常见问题解答