diff options
author | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-02 18:52:10 +0000 |
---|---|---|
committer | voroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-03-02 18:52:10 +0000 |
commit | e9e53f8cd0704adcab13ae9fee616b4f8f54dfdf (patch) | |
tree | f0f01081985a6b297b15ab318ca31fb087885033 /loader/dshow/DS_AudioDecoder.c | |
parent | 5c927f23672550e2d3f15aaced60c7bec51da1f9 (diff) | |
download | mpv-e9e53f8cd0704adcab13ae9fee616b4f8f54dfdf.tar.bz2 mpv-e9e53f8cd0704adcab13ae9fee616b4f8f54dfdf.tar.xz |
Rework of copying samples from directshow codecs.
Using callback function provided by filter to store and process samples from
codec instead of explicit typecast to DS_Filter.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22416 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader/dshow/DS_AudioDecoder.c')
-rw-r--r-- | loader/dshow/DS_AudioDecoder.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/loader/dshow/DS_AudioDecoder.c b/loader/dshow/DS_AudioDecoder.c index c2ab624b46..23cd65bdfc 100644 --- a/loader/dshow/DS_AudioDecoder.c +++ b/loader/dshow/DS_AudioDecoder.c @@ -35,6 +35,9 @@ struct _DS_AudioDecoder typedef long STDCALL (*GETCLASS) (GUID*, GUID*, void**); +static SampleProcUserData sampleProcData; + + DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf) //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf) { @@ -98,7 +101,7 @@ DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* /*try*/ { ALLOCATOR_PROPERTIES props, props1; - this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); + this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData); if( !this->m_pDS_Filter ) { free(this); return NULL; @@ -148,15 +151,9 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned in_size -= in_size%this->in_fmt.nBlockAlign; while (in_size>0) { - unsigned int frame_size = 0; - char* frame_pointer; IMediaSample* sample=0; char* ptr; int result; - -// this->m_pOurOutput->SetFramePointer(out_data+written); - this->m_pDS_Filter->m_pOurOutput->SetFramePointer(this->m_pDS_Filter->m_pOurOutput,&frame_pointer); - this->m_pDS_Filter->m_pOurOutput->SetFrameSizePointer(this->m_pDS_Filter->m_pOurOutput,(long*)&frame_size); this->m_pDS_Filter->m_pAll->vt->GetBuffer(this->m_pDS_Filter->m_pAll, &sample, 0, 0, 0); if (!sample) { @@ -171,15 +168,15 @@ int DS_AudioDecoder_Convert(DS_AudioDecoder *this, const void* in_data, unsigned result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample); if (result) Debug printf("DS_AudioDecoder::Convert() Error: putting data into input pin %x\n", result); - if ((written + frame_size) > out_size) + if ((written + sampleProcData.frame_size) > out_size) { sample->vt->Release((IUnknown*)sample); break; } - memcpy((uint8_t*)out_data + written, frame_pointer, frame_size); + memcpy((uint8_t*)out_data + written, sampleProcData.frame_pointer, sampleProcData.frame_size); sample->vt->Release((IUnknown*)sample); read+=this->in_fmt.nBlockAlign; - written+=frame_size; + written+=sampleProcData.frame_size; break; } if (size_read) |