Mercurial > mplayer.hg
comparison loader/dshow/DS_Filter.c @ 22398:49f01f8fbd60
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.
author | voroshil |
---|---|
date | Fri, 02 Mar 2007 18:52:10 +0000 |
parents | 254733f57707 |
children | 3758413ca0c6 |
comparison
equal
deleted
inserted
replaced
22397:b2e4557a3160 | 22398:49f01f8fbd60 |
---|---|
93 #else | 93 #else |
94 CoUninitialize(); | 94 CoUninitialize(); |
95 #endif | 95 #endif |
96 } | 96 } |
97 | 97 |
98 static HRESULT STDCALL DS_Filter_CopySample(void* pUserData,IMediaSample* pSample){ | |
99 char* pointer; | |
100 int len; | |
101 SampleProcUserData* pData=(SampleProcUserData*)pUserData; | |
102 Debug printf("CopySample called(%p,%p)\n",pSample,pUserData); | |
103 if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer)) | |
104 return 1; | |
105 len = pSample->vt->GetActualDataLength(pSample); | |
106 if (len == 0) | |
107 len = pSample->vt->GetSize(pSample);//for iv50 | |
108 | |
109 pData->frame_pointer = pointer; | |
110 pData->frame_size = len; | |
111 /* | |
112 FILE* file=fopen("./uncompr.bmp", "wb"); | |
113 char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00}; | |
114 *(int*)(&head[2])=len+0x36; | |
115 fwrite(head, 14, 1, file); | |
116 fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file); | |
117 fwrite(pointer, len, 1, file); | |
118 fclose(file); | |
119 */ | |
120 return 0; | |
121 } | |
122 | |
98 DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, | 123 DS_Filter* DS_FilterCreate(const char* dllname, const GUID* id, |
99 AM_MEDIA_TYPE* in_fmt, | 124 AM_MEDIA_TYPE* in_fmt, |
100 AM_MEDIA_TYPE* out_fmt) | 125 AM_MEDIA_TYPE* out_fmt,SampleProcUserData* pUserData) |
101 { | 126 { |
102 int init = 0; | 127 int init = 0; |
103 // char eb[250]; | 128 // char eb[250]; |
104 const char* em = NULL; | 129 const char* em = NULL; |
105 MemAllocator* tempAll; | 130 MemAllocator* tempAll; |
260 This->m_pAll->vt->SetProperties(This->m_pAll, &props, &props1); | 285 This->m_pAll->vt->SetProperties(This->m_pAll, &props, &props1); |
261 | 286 |
262 //Notify remote pin about choosed allocator | 287 //Notify remote pin about choosed allocator |
263 This->m_pImp->vt->NotifyAllocator(This->m_pImp, This->m_pAll, 0); | 288 This->m_pImp->vt->NotifyAllocator(This->m_pImp, This->m_pAll, 0); |
264 | 289 |
265 This->m_pOurOutput = COutputPinCreate(This->m_pDestType); | 290 This->m_pOurOutput = COutputPinCreate(This->m_pDestType,DS_Filter_CopySample,pUserData); |
266 | 291 |
267 result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin, | 292 result = This->m_pOutputPin->vt->ReceiveConnection(This->m_pOutputPin, |
268 (IPin*) This->m_pOurOutput, | 293 (IPin*) This->m_pOurOutput, |
269 This->m_pDestType); | 294 This->m_pDestType); |
270 if (result) | 295 if (result) |