I am trying to use DirectShow https://learn.microsoft.com/en-us/windows/win32/directshow/directshow
in order to get uncompressed byte array from .mp3
stream. I have an implementation that can playback .mp3
byte stream
bool coAudioPlayer::LoadImp(SoundDataType dataType, std::string const & filename, unsigned char const * pData, int64_t dataLen, bool bOnlyIfFilenameChanged)
{
...
m_pMemReader = new CMemReader(m_pMemStream, m_pMediaType, &hr);
m_pMemReader->AddRef();
hr = CoCreateInstance(CLSID_FilterGraph,
NULL,
CLSCTX_INPROC_SERVER,
IID_IGraphBuilder,
(void **)&this->m_pigb);
hr = m_pigb->AddFilter(m_pMemReader, NULL);
if (FAILED(hr))
{
return false;
}
m_pigb->QueryInterface(IID_IMediaControl, (void **)&m_pimc);
m_pigb->QueryInterface(IID_IMediaEventEx, (void **)&m_pimex);
m_pigb->QueryInterface(IID_IBasicAudio, (void**)&m_piba);
m_pigb->QueryInterface(IID_IMediaSeeking, (void**)&m_pims);
/* Render our output pin */
hr = m_pigb->Render(m_pMemReader->GetPin(0));
if (!SUCCEEDED(hr))
{
return false;
}
HRESULT hr = m_pimc->Run();
return m_bReady;
}
But I need to extend this functional and add approach to get uncompressed byte array (sound frames). As far as I understand under the hood DirectShow
decodes it, but I don't see any way to retrieve this decoded array.
Is there a way to do it?