|
8精币
|
BMP到AVI | | | |
AVI保存文件名 | 文本型 | | | | BMP文件名数组 | 文本型 | | | | WAV文件名 | 文本型 | | | | 帧速率 | 整数型 | | | | 进度显示子程序 | 子程序指针 | | | |
变量名 | 类 型 | 静态 | 数组 | 备 注 | strhdrVideo | AVISTREAMINFO | | | strhdrAudio | AVISTREAMINFO | | | nFrames | 整数型 | | | hr | | | | a | 整数型 | | | bmpFileHdr | 字节集 | | | bmpInfoHdr | 字节集 | | | waveFormat | 字节集 | | | BMP文件号 | | | | WAV文件号 | | | | tmp_buf | 字节集 | | | pfile | | | | psV | | | | psA | | | | streamtypeVIDEO | 整数型 | | | streamtypeAUDIO | 整数型 | | | tmp | 字节集 | | | w | | | | h | | | | s | | | |
tmp = 取空白字节集 (4 )tmp [1 ] = 取代码 (“v”, )tmp [2 ] = 取代码 (“i”, )tmp [3 ] = 取代码 (“d”, )tmp [4 ] = 取代码 (“s”, )streamtypeVIDEO = 取字节集数据 (tmp, #整数型, )AVIFileInit ()计次循环首 (取数组成员数 (BMP文件名数组 ), a )BMP文件号 = 打开文件 (BMP文件名数组 [a ], , )移到文件首 (BMP文件号 )bmpFileHdr = 读入字节集 (BMP文件号, 14 )bmpInfoHdr = 读入字节集 (BMP文件号, 40 )调试输出 (bmpInfoHdr )w = 取字节集数据 (bmpInfoHdr, #整数型, 5 )h = 取字节集数据 (bmpInfoHdr, #整数型, 9 )s = 取字节集数据 (bmpFileHdr, #整数型, 3 ) - 54 调试输出 (s )如果真 (nFrames = 0 )AVIFileOpen (pfile, AVI保存文件名, 4097, 0 )strhdrVideo.fccType = streamtypeVIDEO strhdrVideo.fccHandler = 0 strhdrVideo.dwScale = 1 strhdrVideo.dwRate = 帧速率 strhdrVideo.dwSuggestedBufferSize = s strhdrVideo.rcFrame.left = 0 strhdrVideo.rcFrame.top = 0 strhdrVideo.rcFrame.right = w strhdrVideo.rcFrame.bottom = h hr = AVIFileCreateStream (pfile, psV, strhdrVideo )tmp_buf = 读入字节集 (BMP文件号, s )hr = AVIStreamSetFormat (psV, nFrames, bmpInfoHdr, 40 )hr = AVIStreamWrite (psV, nFrames, 1, tmp_buf, s, 16, 0, 0 )nFrames = nFrames + 1 关闭文件 (BMP文件号 )如果真 (是否为空 (进度显示子程序 ) = 假)CallWindowProcA (进度显示子程序, 取数组成员数 (BMP文件名数组 ), a, 0, 0 )计次循环尾 ()如果真 (是否为空 (WAV文件名 ) = 假)tmp = 取空白字节集 (4 )tmp [1 ] = 取代码 (“a”, )tmp [2 ] = 取代码 (“u”, )tmp [3 ] = 取代码 (“d”, )tmp [4 ] = 取代码 (“s”, )streamtypeAUDIO = 取字节集数据 (tmp, #整数型, )WAV文件号 = 打开文件 (WAV文件名, , )移到文件首 (WAV文件号 )tmp = 读入字节集 (WAV文件号, 20 )s = 取字节集数据 (tmp, #整数型, 17 )waveFormat = 读入字节集 (WAV文件号, s )w = 取字节集数据 (waveFormat, #短整数型, 3 ) h = 取字节集数据 (waveFormat, #整数型, 5 ) s = 取字节集数据 (tmp, #整数型, 5 ) + 8 - 取字节集长度 (tmp ) - 取字节集长度 (waveFormat ) strhdrAudio.fccType = streamtypeAUDIO strhdrAudio.fccHandler = 0 strhdrAudio.dwFlags = 0 strhdrAudio.dwCaps = 0 strhdrAudio.wPriority = 0 strhdrAudio.wLanguage = 0 strhdrAudio.dwScale = w strhdrAudio.dwRate = h strhdrAudio.dwStart = 0 strhdrAudio.dwInitialFrames = 0 strhdrAudio.dwSuggestedBufferSize = s strhdrAudio.dwQuality = 0 strhdrAudio.dwSampleSize = 1 strhdrAudio.rcFrame.bottom = 0 strhdrAudio.rcFrame.left = 0 strhdrAudio.rcFrame.right = 0 strhdrAudio.rcFrame.top = 0 strhdrAudio.dwEditCount = 0 strhdrAudio.dwFormatChangeCount = 0 strhdrAudio.dwLength = 0 hr = AVIFileCreateStream (pfile, psA, strhdrAudio ) hr = AVIStreamSetFormat (psA, 0, waveFormat, 取字节集长度 (waveFormat )) tmp_buf = 读入字节集 (WAV文件号, s )hr = AVIStreamWrite (psA, 0, 1, tmp_buf, s, 16, 0, 0 )关闭文件 (WAV文件号 )AVIStreamRelease (psA )AVIStreamRelease (psV )如果真 (pfile ≠ 0 )AVIFileRelease (pfile )AVIFileExit ()
此方法是论坛里找的,其中的参数 ”BMP文件名数组“,是文本型数组,如果将这个参数直接换成图片字节集数组,应该怎么改这个方法
|
最佳答案
查看完整内容
感觉还是文件名数组合适一些 如果很多的话 字节集数组太大
你可以存到临时目录
|