我用自己的数据流通过AVIStreamWrite()生成一个AVI文件,但是现在我想另外在AVI里面放入文字。一个做法就是把文字转换成二进制位图插入到数据流中,但是这种做法太麻烦。另一种是
_fmemset(&strhdr, 0, sizeof(strhdr));
strhdr.fccType = streamtypeText;// text type
strhdr.fccHandler = 0;
strhdr.dwScale = 1;
strhdr.dwRate = 15; // 15 fps
strhdr.dwSuggestedBufferSize = alpbi->biSizeImage;
SetRect(&strhdr.rcFrame, 0, 0,
(int) biWidth,
(int) biHeight);
// And create the stream;
hr = AVIFileCreateStream(pfile,&psText,&strhdr);
DWORD dom;
dom=sizeof(dom);
AVIStreamSetFormat(psText, 0,dom,sizeof(dom)); strcpy(szMessage, "This is frame #%d");
int iLen = wsprintf(szText, szMessage, (int)(nFrames + 1));
AVIStreamWrite(psText,
nFrames ,
1,
szText,
iLen + 1,
AVIIF_KEYFRAME,
NULL,
NULL);
我用streamtypeText类型想往一帧里面写入字符。但是程序运行后AVI里面没有出现字符。我认为是AVIStreamSetFormat()没弄好。请问那位作过这个,请多多指教。
_fmemset(&strhdr, 0, sizeof(strhdr));
strhdr.fccType = streamtypeText;// text type
strhdr.fccHandler = 0;
strhdr.dwScale = 1;
strhdr.dwRate = 15; // 15 fps
strhdr.dwSuggestedBufferSize = alpbi->biSizeImage;
SetRect(&strhdr.rcFrame, 0, 0,
(int) biWidth,
(int) biHeight);
// And create the stream;
hr = AVIFileCreateStream(pfile,&psText,&strhdr);
DWORD dom;
dom=sizeof(dom);
AVIStreamSetFormat(psText, 0,dom,sizeof(dom)); strcpy(szMessage, "This is frame #%d");
int iLen = wsprintf(szText, szMessage, (int)(nFrames + 1));
AVIStreamWrite(psText,
nFrames ,
1,
szText,
iLen + 1,
AVIIF_KEYFRAME,
NULL,
NULL);
我用streamtypeText类型想往一帧里面写入字符。但是程序运行后AVI里面没有出现字符。我认为是AVIStreamSetFormat()没弄好。请问那位作过这个,请多多指教。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货