summaryrefslogtreecommitdiffstats
path: root/loader/dshow/DS_Filter.c
diff options
context:
space:
mode:
authorvoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-02 18:52:10 +0000
committervoroshil <voroshil@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-03-02 18:52:10 +0000
commite9e53f8cd0704adcab13ae9fee616b4f8f54dfdf (patch)
treef0f01081985a6b297b15ab318ca31fb087885033 /loader/dshow/DS_Filter.c
parent5c927f23672550e2d3f15aaced60c7bec51da1f9 (diff)
downloadmpv-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_Filter.c')
-rw-r--r--loader/dshow/DS_Filter.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/loader/dshow/DS_Filter.c b/loader/dshow/DS_Filter.c
index 8d11c170cc..e55862074b 100644
--- a/loader/dshow/DS_Filter.c
+++ b/loader/dshow/DS_Filter.c
@@ -95,9 +95,34 @@ void DS_Filter_Destroy(DS_Filter* This)
#endif
}
+static HRESULT STDCALL DS_Filter_CopySample(void* pUserData,IMediaSample* pSample){
+ char* pointer;
+ int len;
+ SampleProcUserData* pData=(SampleProcUserData*)pUserData;
+ Debug printf("CopySample called(%p,%p)\n",pSample,pUserData);
+ if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer))
+ return 1;
+ len = pSample->vt->GetActualDataLength(pSample);
+ if (len == 0)
+ len = pSample->vt->GetSize(pSample);//for iv50
+
+ pData->frame_pointer = pointer;
+ pData->frame_size = 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);
+*/
+ return 0;
+}
+
DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
AM_MEDIA_TYPE* in_fmt,
- AM_MEDIA_TYPE* out_fmt)
+ AM_MEDIA_TYPE* out_fmt,SampleProcUserData* pUserData)
{
int init = 0;
// char eb[250];
@@ -262,7 +287,7 @@ DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id,
//Notify remote pin about choosed allocator
This->m_pImp->vt->NotifyAllocator(This->m_pImp, This->m_pAll, 0);
- This->m_pOurOutput = COutputPinCreate(This->m_pDestType);
+ This->m_pOurOutput = COutputPinCreate(This->m_pDestType,DS_Filter_CopySample,pUserData);
result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin,
(IPin*) This->m_pOurOutput,