解码单个视频及保存yuv数据到文件中
2015-06-19 09:10
309 查看
// 解码单路视频,并保存解码后的yuv数据到文件中去
// cudaDecode.lib是静态库文件,本程序实例展示如何调用此库文件相应接口实现解码功能
// cudaDecode.lib是静态库文件,本程序实例展示如何调用此库文件相应接口实现解码功能
#include "iostream" #include <tchar.h> #include "windows.h" #include "../header/cudaDecodeInterface.h" //#pragma comment(lib,"cudaDecode.lib") // 链接到cudaDecode.lib using namespace std; HANDLE hand_cuda = NULL; bool cuda_decodeEnd = false; FILE *fp = fopen("../decodePic/VideoSingle/videoSingle.yuv","wb"); int number = 0; int CudaDecodeNotify(unsigned char* pDecodeData,int nDataSize,DWORD timestamp,int nEof) { // fwrite(pDecodeData,1,nDataSize,fp); if(nEof) { OutputDebugString("thread 1 读包结束!!!\n"); printf("-->thread 1 读包结束!!!\n"); // fclose(fp); cuda_decodeEnd = true; } return 0; } void OnCuda() { bool nstate = Cuda_SupportDecode(); hand_cuda = Cuda_CreateDecoder(); DWORD nTime = 0; if(Cuda_OpenFile(hand_cuda, "../data/720P/video0.m2v", CudaDecodeNotify)==1) { nTime = GetTickCount(); printf("-->打开文件成功\n"); } else printf("-->打开文件失败\n"); while (!cuda_decodeEnd) { Sleep(1); } nTime = GetTickCount() - nTime; printf("-->解码完成 nTime = %d ms\n",nTime); int nRet = Cuda_DestroyDecoder(hand_cuda); printf("-->Cuda_DestroyDecoder = %d\n",nRet); } int _tmain(int argc, _TCHAR* argv[]) { printf("cuda Decoder....\n"); OnCuda(); fflush(stdin); getchar(); return 0; }
相关文章推荐
- 使用MPMoviePlayerController播放视频
- layerDrawingOptions改变透明度
- QtPropertyBrowser的安装与配置
- 回到经验数学的时代
- 生成树协议
- 【请教】VLC 0.9.4中的VLCPlugin1控件为什么不显示视频?
- 活动目录是做什么用的
- Linux的计划任务(crontab)
- 使用信号量控制线程执行顺序,进而控制不同视频流的解码顺序
- 知识管理从建立知识库做起
- Autolayout-VFL语言
- MonkyTalk学习-4-JS脚本修改运行
- Android连接网络打印机进行打印
- python中的urllib库和urllib2
- UIWebView的一些用法总结
- JAVA的CountDownLatch
- 返回一个二维数组最大联通子数组的和
- 大小中型数据库和Oracle的常用命令
- UIWebView的使用总结
- iOS 基础复习