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/outputpin.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/outputpin.c')
-rw-r--r-- | loader/dshow/outputpin.c | 84 |
1 files changed, 15 insertions, 69 deletions
diff --git a/loader/dshow/outputpin.c b/loader/dshow/outputpin.c index 6caf658d51..0e43fe7ba2 100644 --- a/loader/dshow/outputpin.c +++ b/loader/dshow/outputpin.c @@ -709,36 +709,14 @@ static HRESULT STDCALL COutputMemPin_GetAllocatorRequirements(IMemInputPin* This static HRESULT STDCALL COutputMemPin_Receive(IMemInputPin* This, /* [in] */ IMediaSample* pSample) { - COutputMemPin* mp = (COutputMemPin*)This; - char* pointer; - int len; - Debug printf("COutputMemPin_Receive(%p) called\n", This); if (!pSample) return E_INVALIDARG; - if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer)) - return -1; - len = pSample->vt->GetActualDataLength(pSample); - if (len == 0) - len = pSample->vt->GetSize(pSample);//for iv50 - //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len); - - if (mp->frame_pointer) - *(mp->frame_pointer) = pointer; - if (mp->frame_size_pointer) - *(mp->frame_size_pointer) = len; -/* - FILE* file=fopen("./uncompr.bmp", "wb"); - char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00}; - *(int*)(&head[2])=len+0x36; - fwrite(head, 14, 1, file); - fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file); - fwrite(pointer, len, 1, file); - fclose(file); -*/ -// pSample->vt->Release((IUnknown*)pSample); - return 0; + if(((COutputMemPin*)This)->parent->SampleProc) + return ((COutputMemPin*)This)->parent->SampleProc(((COutputMemPin*)This)->parent->pUserData,pSample); + //reject sample + return S_FALSE; } /** @@ -772,7 +750,13 @@ static HRESULT STDCALL COutputMemPin_ReceiveMultiple(IMemInputPin * This, /* [in] */ long nSamples, /* [out] */ long *nSamplesProcessed) { - return output_unimplemented("COutputMemPin_ReceiveMultiple", This); + HRESULT hr; + Debug printf("COutputMemPin_ReceiveMultiple(%p) %d\n", This,nSamples); + for(*nSamplesProcessed=0; *nSamplesProcessed < nSamples; *nSamplesProcessed++) { + hr = This->vt->Receive(This,pSamples[*nSamplesProcessed]); + if (hr != S_OK) break; + } + return hr; } /** @@ -790,44 +774,6 @@ static HRESULT STDCALL COutputMemPin_ReceiveCanBlock(IMemInputPin * This) } /** - * \brief COutputPin::SetFramePointer (sets internal frame pointer to an external buffer) - * - * \param[in] This pointer to COutputPin class - * \param[in] z new pointer - * - */ -static void COutputPin_SetFramePointer(COutputPin* This, char** z) -{ - This->mempin->frame_pointer = z; -} - -/** - * \brief COutputPin::SetFramePointer2 (sets allocator's pointer to an external buffer) - * - * \param[in] This pointer to COutputPin class - * \param[in] z new pointer - * - */ -static void COutputPin_SetPointer2(COutputPin* This, char* p) -{ - if (This->mempin->pAllocator) - // fixme - This->mempin->pAllocator->SetPointer(This->mempin->pAllocator, p); -} - -/** - * \brief COutputPin::SetFrameSizePointer (sets pointer to variable that receives frame size) - * - * \param[in] This pointer to COutputPin class - * \param[in] z new pointer - * - */ -static void COutputPin_SetFrameSizePointer(COutputPin* This, long* z) -{ - This->mempin->frame_size_pointer = z; -} - -/** * \brief COutputPin::SetNewFormat(sets new media format for the pin) * * \param[in] This pointer to COutputPin class @@ -946,7 +892,7 @@ static HRESULT STDCALL COutputMemPin_Release(IUnknown* This) * \return NULL if error occured * */ -COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt) +COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt,SAMPLEPROC SampleProc,void* pUserData) { COutputPin* This = (COutputPin*) malloc(sizeof(COutputPin)); IMemInputPin_vt* ivt; @@ -964,6 +910,9 @@ COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt) return NULL; } + This->SampleProc=SampleProc; + This->pUserData=pUserData; + This->mempin->vt = ivt; This->refcount = 1; @@ -1005,9 +954,6 @@ COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt) This->mempin->refcount = 1; This->mempin->parent = This; - This->SetPointer2 = COutputPin_SetPointer2; - This->SetFramePointer = COutputPin_SetFramePointer; - This->SetFrameSizePointer = COutputPin_SetFrameSizePointer; This->SetNewFormat = COutputPin_SetNewFormat; return This; |