[問題]使用msdn上的acmStreamConvert壓縮檔案ꨠ…

看板Language作者 (aaa)時間20年前 (2005/08/09 23:13), 編輯推噓-1(010)
留言1則, 1人參與, 最新討論串1/1
※ [本文轉錄自 C_and_CPP 看板] 作者: guybejude (aaa) 看板: C_and_CPP 標題: [問題]使用msdn上的acmStreamConvert壓縮檔案的問題 時間: Tue Aug 9 19:00:28 2005 大家好, 小弟我欲寫一個程式可以進行音頻壓縮,也就是PCM->G.711 A-Law 我參照了以下的網址,而進行改寫。 http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarmulmed /html/msdn_codec.asp 及 http://david.weekly.org/code/mp3acm.html 我的程式目的是將default的PCM轉成defaul的G.711 A-Law格式。 程式可正常執行,但是在轉換檔案方面確有問題。即是,所轉出來的wav檔(A-Law format) 不被windows讀取。 // open file FILE *fpIn = fopen( INPUT_FILE, "rb" ); if( fpIn == NULL ){ assert( !"can't open WAVE file!" ); return E_FAIL; } //// let's dump this data off to disk FILE *fpOut = fopen( OUTPUT_FILE, "wb" ); if( fpOut == NULL ){ assert( !"can't output output PCM!" ); return E_FAIL; } ..... while(1) { // suck in some WAV data int count = fread( srcbuf, 1, BLOCK_SIZE, fpIn ); //從來源檔讀入BLOCK_SIZE大小之資料入srcbuf中 if( count != BLOCK_SIZE ) break; //if (count<=0) // convert the data // 在srcbuf中資料將進行轉換,且將已轉換好之資料存入rawbuf中 mmr = acmStreamConvert(hstr, &strhdr, 0); if (mmr) { printf("Failed to do PCM to driver format conversion\n"); exit(1); } // write the decoded PCM to disk count = fwrite( rawbuf, 1, strhdr.cbDstLengthUsed, fpOut ); assert( count == strhdr.cbDstLengthUsed ); } ...... 謝謝指導, :) -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.162.169 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 211.74.162.169

140.112.195.150 08/11, , 1F
真是天兵... 這不是電腦語言板啦!!! XD
140.112.195.150 08/11, 1F
文章代碼(AID): #12-CWWKf (Language)