Mercurial > mplayer.hg
comparison loader/dshow/DS_VideoDecoder.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 | 68125c62b6eb |
children | 450bb2a75cba |
comparison
equal
deleted
inserted
replaced
22397:b2e4557a3160 | 22398:49f01f8fbd60 |
---|---|
29 int m_iMinBuffers; | 29 int m_iMinBuffers; |
30 int m_iMaxAuto; | 30 int m_iMaxAuto; |
31 int m_bIsDivX; // for speed | 31 int m_bIsDivX; // for speed |
32 int m_bIsDivX4; // for speed | 32 int m_bIsDivX4; // for speed |
33 }; | 33 }; |
34 static SampleProcUserData sampleProcData; | |
34 | 35 |
35 #include "DS_VideoDecoder.h" | 36 #include "DS_VideoDecoder.h" |
36 | 37 |
37 #include "../wine/winerror.h" | 38 #include "../wine/winerror.h" |
38 #ifdef WIN32_LOADER | 39 #ifdef WIN32_LOADER |
173 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); | 174 //this->iv.m_obh.biHeight = labs(this->iv.m_obh.biHeight); |
174 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) | 175 this->iv.m_obh.biSizeImage = labs(this->iv.m_obh.biWidth * this->iv.m_obh.biHeight) |
175 * ((this->iv.m_obh.biBitCount + 7) / 8); | 176 * ((this->iv.m_obh.biBitCount + 7) / 8); |
176 | 177 |
177 | 178 |
178 this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType); | 179 this->m_pDS_Filter = DS_FilterCreate(dllname, guid, &this->m_sOurType, &this->m_sDestType,&sampleProcData); |
179 | 180 |
180 if (!this->m_pDS_Filter) | 181 if (!this->m_pDS_Filter) |
181 { | 182 { |
182 printf("Failed to create DirectShow filter\n"); | 183 printf("Failed to create DirectShow filter\n"); |
183 return 0; | 184 return 0; |
305 Debug printf("ERROR: null sample\n"); | 306 Debug printf("ERROR: null sample\n"); |
306 return -1; | 307 return -1; |
307 } | 308 } |
308 | 309 |
309 //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; | 310 //cout << "DECODE " << (void*) pImage << " d: " << (void*) pImage->Data() << endl; |
310 if (pImage) | |
311 { | |
312 this->m_pDS_Filter->m_pOurOutput->SetPointer2(this->m_pDS_Filter->m_pOurOutput,pImage); | |
313 } | |
314 | 311 |
315 | 312 |
316 sample->vt->SetActualDataLength(sample, size); | 313 sample->vt->SetActualDataLength(sample, size); |
317 sample->vt->GetPointer(sample, (BYTE **)&ptr); | 314 sample->vt->GetPointer(sample, (BYTE **)&ptr); |
318 memcpy(ptr, src, size); | 315 memcpy(ptr, src, size); |
338 result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample); | 335 result = this->m_pDS_Filter->m_pImp->vt->Receive(this->m_pDS_Filter->m_pImp, sample); |
339 if (result) | 336 if (result) |
340 { | 337 { |
341 Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result); | 338 Debug printf("DS_VideoDecoder::DecodeInternal() error putting data into input pin %x\n", result); |
342 } | 339 } |
343 | 340 if (pImage) |
341 { | |
342 memcpy(pImage, sampleProcData.frame_pointer, sampleProcData.frame_size); | |
343 } | |
344 sample->vt->Release((IUnknown*)sample); | 344 sample->vt->Release((IUnknown*)sample); |
345 | 345 |
346 #if 0 | 346 #if 0 |
347 if (this->m_bIsDivX) | 347 if (this->m_bIsDivX) |
348 { | 348 { |