音视频相关开发常用的一些功能整理:
图像格式转换:Media Utility,支持接口如下:
DLLEXPORT_API void JW_CreateBmpHeader(BYTE *pBmp,int width,int height);
DLLEXPORT_API HANDLE JW_DDBToDIB(CBitmap& bitmap, DWORD dwCompression, CPalette* pPal );
DLLEXPORT_API BOOL JW_SnapshotPrtSc(CWnd *pWnd, CString szFileName);
DLLEXPORT_API BOOL JW_WriteDIB( LPTSTR szFile, HANDLE hDIB);
DLLEXPORT_API void JW_YUV420_TO_RGB24_mmx(BYTE *puc_y, int stride_y, BYTE *puc_u, BYTE *puc_v, int stride_uv, BYTE *puc_out, int width_y, int height_y, unsigned int _stride_out);
DLLEXPORT_API void JW_YUV420_TO_RGB32_mmx(BYTE *puc_y, int stride_y, BYTE *puc_u, BYTE *puc_v, int stride_uv, BYTE *puc_out, int width_y, int height_y, unsigned int _stride_out) ;
DLLEXPORT_API void JW_YUV420_TO_RGB565(BYTE *puc_y, int stride_y, BYTE *puc_u, BYTE *puc_v, int stride_uv, BYTE *puc_out, int width_y, int height_y, unsigned int _stride_out) ;
DLLEXPORT_API void JW_YUV420_TO_RGB555(BYTE *puc_y, int stride_y, BYTE *puc_u, BYTE *puc_v, int stride_uv, BYTE *puc_out, int width_y, int height_y, unsigned int _stride_out) ;
DLLEXPORT_API void JW_YUV420_TO_YV12_mmx(unsigned char *py,unsigned char *pu,unsigned char *pv,unsigned char *dst,unsigned long pitch,int width,int height);
DLLEXPORT_API void JW_YUV420_TO_UYVY16_mmx(unsigned char *py,unsigned char *pu,unsigned char *pv,unsigned char *dst,unsigned long pitch,int w,int h);
DLLEXPORT_API void JW_YUV420_TO_YUYV16_mmx(unsigned char *py, unsigned char *pu,unsigned char *pv,unsigned char *dst,unsigned long pitch, int w,int h); // [esp+28+16]
DLLEXPORT_API void JW_RGB24_TO_RGB32(BYTE *pRgb24, int nImageWidth, int nImageHeight, int nImageSize, BYTE *pRgb32);
//Requires mod 8 row size.
DLLEXPORT_API void JW_YV12_TO_RGB24_mmx(BYTE *dst, int dst_stride, const BYTE *y_src,const BYTE *u_src,const BYTE *v_src, int y_stride, int uv_stride,int width, int height);
DLLEXPORT_API void JW_YV12_TO_RGB32_mmx(BYTE *dst, int dst_stride, const BYTE *y_src, const BYTE *u_src,const BYTE *v_src, int y_stride, int uv_stride,int width, int height);
DLLEXPORT_API void JW_YV12_TO_YUY2_mmx(const BYTE* srcY, const BYTE* srcU, const BYTE* srcV, int src_rowsize, int src_pitch, int src_pitch_uv, BYTE* dst, int dst_pitch,int height);
图像显示播放,CRsDDraw,使用DirectDraw,接口如下:
int doDraw1(BYTE *pBuffer, int height, int width, BOOL Rotation, int videoDataFormat);
int doDraw(HDC hDC,RECT Rect,BYTE* pBuffer,int height,int width,BOOL Rotation,int videoDataType);
BOOL initUniDraw(HWND hWnd,HDC hDC,int height,int width,int vidoeDataType=0);
音频播放:CRsDSound,使用DirectSound
int SetVolume(LONG volume);
int GetVolume(LONG *volume);
BOOL Open();
void Close();
void Pause();
void Resume();
void Stop();
void AddAudioStream(BYTE* pBuffer,DWORD nSize);
void SetAudioFormat(WAVEFORMATEX *pAudioFormat);
分两个版本,Debug版和Release版。
源码大小: 34654|
源码地址:
点击浏览该文件|
源码说明: //*Note :
// You can use and modify this code freely. But if you find or fixed
//this code, please send your code to me. This helps me to improve my code
//and more people will be benefited from your code! Thanks!
//
//*Contace me:
// Personal Blog : http://www.rosoo.net
// Email : jackyhwei@qq.com
// MSN Account : ixmy@hotmail.com