全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1719
推到 Plurk!
推到 Facebook!

請問mp3檔的BitsPerSample這個欄位

尚未結案
jaw109
一般會員


發表:1
回覆:1
積分:0
註冊:2005-10-21

發送簡訊給我
#1 引用回覆 回覆 發表時間:2005-10-25 19:46:43 IP:210.243.xxx.xxx 未訂閱
是這樣子的,我有一個轉檔的需求(WMA->WAV以及MP3->WAV) 我透過WMFSDK(9.5)其中的IWMSyncReader來做轉換 我目前已經可以取得raw-data了    但是取得attribute的時候有個蠻大的問題 我透過IWMMediaProps來取得attributes 例如 nChannels, nSamplesPerSec以及wBitsPerSample這三個欄位    在取得WMA的資訊的時候是沒有問題 但是換成當我在轉換mp3的時候 wBitsPerSample這個欄位竟然是0 我查了一下Document, 他說 Bits per sample for the wFormatTag format type. If wFormatTag is WAVE_FORMAT_PCM, then wBitsPerSample should be equal to 8 or 16. Some compression schemes cannot define a value for wBitsPerSample, so this member can be zero. 我想...他提到所謂"Some compression schemes"就是我在轉換mp3時所遭遇的狀況吧 轉換mp3的時候wBitsPerSce這個欄位該怎麼填呢,這個問題蠻擾人的;之前我在測試raw-data功能的時候,我都把它當作16來測,是沒有問題啦。但我不能總是要求mp3檔案的wBitsPerSce總是16吧......各位在遇到這個問題的時候,是怎麼解決的呢? Thanks for help 發表人 - jaw109 於 2005/10/25 19:50:30
jaw109
一般會員


發表:1
回覆:1
積分:0
註冊:2005-10-21

發送簡訊給我
#2 引用回覆 回覆 發表時間:2005-11-02 13:48:05 IP:210.243.xxx.xxx 未訂閱
Hi, 我已經在google論壇找到答案了 以下是Alessandro Angeli 這位朋友的回覆     So you are using the WMSyncReader object to read an MP3 and have it decode the data to PCM and you want to know the exact output PCM format, right? This output PCM format does not depend in any way on the input MP3 format but it only depends on how you configured the reader (IWMSyncReader::SetOutputProps()). If you didn't configure the reader, then you get the default settings (and the default sample size is 16 bits per sample). You can discover the current output format using IWMSyncReader::GetOutputProps(). -- // Alessandro Angeli // MVP :: DigitalMedia // a dot angeli at psynet dot net 我提供我取得wma屬性的的演算法, 這邊只是一些pseudo code而已, 希望對大家有幫助
IWMSyncReader*       pSyncReader  = NULL;
IWMOutputMediaProps* pOutputProps = NULL;
WM_MEDIA_TYPE*       pType        = NULL;
WAVEFORMATEX*        pWFX         = NULL;
DWORD                dwTypeSize   = 0;    WMCreateSyncReader(NULL, WMT_RIGHT_PLAYBACK, &pSyncReader);
pSyncReader->Open(L"D:\\mp3\\雪中紅.wma");    pOutputProps->GetMediaType(NULL,  &dwTypeSize);
pType = (WM_MEDIA_TYPE*)(new BYTE[dwTypeSize]);
pOutputProps->GetMediaType(pType, &dwTypeSize);    if(pType->formattype == WMFORMAT_WaveFormatEx)
{
  pWFX = (WAVEFORMATEX*)pType->pbFormat;
  // TODO : 資料就放在pWFX這個struct裡面
}
系統時間:2024-05-10 10:13:39
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!