Mercurial > mplayer.hg
comparison loader/dshow/outputpin.c @ 713:9355b2ae634e
avifile-0.6-CVS merge
author | arpi_esp |
---|---|
date | Sun, 06 May 2001 21:43:45 +0000 |
parents | bdc4a8fc04d8 |
children | 269780d31b51 |
comparison
equal
deleted
inserted
replaced
712:ea093aa3ecae | 713:9355b2ae634e |
---|---|
1 | |
2 #include <cstdio> | |
3 #include <string> | |
4 | |
1 #include "outputpin.h" | 5 #include "outputpin.h" |
2 #include <string.h> | |
3 #include <stdio.h> | |
4 #include "allocator.h" | 6 #include "allocator.h" |
5 #include "iunk.h" | 7 #include "iunk.h" |
8 | |
6 #define E_NOTIMPL 0x80004001 | 9 #define E_NOTIMPL 0x80004001 |
7 /* | 10 /* |
8 An object beyond interface IEnumMediaTypes. | 11 An object beyond interface IEnumMediaTypes. |
9 Returned by COutputPin through call IPin::EnumMediaTypes(). | 12 Returned by COutputPin through call IPin::EnumMediaTypes(). |
10 */ | 13 */ |
110 | 113 |
111 // Constructor | 114 // Constructor |
112 | 115 |
113 COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0) | 116 COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0) |
114 { | 117 { |
115 IPin::vt=new IPin_vt; | 118 IPin::vt = new IPin_vt; |
116 IPin::vt->QueryInterface = QueryInterface; | 119 IPin::vt->QueryInterface = QueryInterface; |
117 IPin::vt->AddRef = AddRef; | 120 IPin::vt->AddRef = AddRef; |
118 IPin::vt->Release = Release; | 121 IPin::vt->Release = Release; |
119 IPin::vt->Connect = Connect; | 122 IPin::vt->Connect = Connect; |
120 IPin::vt->ReceiveConnection = ReceiveConnection; | 123 IPin::vt->ReceiveConnection = ReceiveConnection; |
140 IMemInputPin::vt->NotifyAllocator = NotifyAllocator; | 143 IMemInputPin::vt->NotifyAllocator = NotifyAllocator; |
141 IMemInputPin::vt->GetAllocatorRequirements = GetAllocatorRequirements; | 144 IMemInputPin::vt->GetAllocatorRequirements = GetAllocatorRequirements; |
142 IMemInputPin::vt->Receive = Receive; | 145 IMemInputPin::vt->Receive = Receive; |
143 IMemInputPin::vt->ReceiveMultiple = ReceiveMultiple; | 146 IMemInputPin::vt->ReceiveMultiple = ReceiveMultiple; |
144 IMemInputPin::vt->ReceiveCanBlock = ReceiveCanBlock; | 147 IMemInputPin::vt->ReceiveCanBlock = ReceiveCanBlock; |
148 | |
149 pAllocator = 0; | |
150 frame_pointer = 0; | |
151 } | |
152 | |
153 COutputPin::~COutputPin() | |
154 { | |
155 delete IPin::vt; | |
156 delete IMemInputPin::vt; | |
145 } | 157 } |
146 | 158 |
147 // IPin->IUnknown methods | 159 // IPin->IUnknown methods |
148 | 160 |
149 HRESULT STDCALL COutputPin::QueryInterface(IUnknown* This, GUID* iid, void** ppv) | 161 HRESULT STDCALL COutputPin::QueryInterface(IUnknown* This, GUID* iid, void** ppv) |
162 This->vt->AddRef(This); | 174 This->vt->AddRef(This); |
163 return 0; | 175 return 0; |
164 } | 176 } |
165 | 177 |
166 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \ | 178 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \ |
167 "%02x%02x%02x%02x%02x%02x\n", | 179 "%02x%02x%02x%02x%02x%02x\n", |
168 iid->f1, iid->f2, iid->f3, | 180 iid->f1, iid->f2, iid->f3, |
169 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0], | 181 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0], |
170 (unsigned char)iid->f4[2],(unsigned char)iid->f4[3],(unsigned char)iid->f4[4], | 182 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3], |
171 (unsigned char)iid->f4[5],(unsigned char)iid->f4[6],(unsigned char)iid->f4[7]); | 183 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5], |
184 (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]); | |
172 return 0x80004002; | 185 return 0x80004002; |
173 } | 186 } |
187 | |
174 HRESULT STDCALL COutputPin::AddRef(IUnknown* This) | 188 HRESULT STDCALL COutputPin::AddRef(IUnknown* This) |
175 { | 189 { |
176 Debug printf("COutputPin::AddRef() called\n"); | 190 Debug printf("COutputPin::AddRef() called\n"); |
177 ((COutputPin*)This)->refcount++; | 191 ((COutputPin*)This)->refcount++; |
178 return 0; | 192 return 0; |
179 } | 193 } |
194 | |
180 HRESULT STDCALL COutputPin::Release(IUnknown* This) | 195 HRESULT STDCALL COutputPin::Release(IUnknown* This) |
181 { | 196 { |
182 Debug printf("COutputPin::Release() called\n"); | 197 Debug printf("COutputPin::Release() called\n"); |
183 if(--((COutputPin*)This)->refcount==0) | 198 if(--((COutputPin*)This)->refcount==0) |
184 delete (COutputPin*)This; | 199 delete (COutputPin*)This; |
275 /* [out] */ LPWSTR *Id) | 290 /* [out] */ LPWSTR *Id) |
276 { | 291 { |
277 Debug printf("COutputPin::QueryId() called\n"); | 292 Debug printf("COutputPin::QueryId() called\n"); |
278 return E_NOTIMPL; | 293 return E_NOTIMPL; |
279 } | 294 } |
280 | |
281 | 295 |
282 HRESULT STDCALL COutputPin::QueryAccept ( | 296 HRESULT STDCALL COutputPin::QueryAccept ( |
283 IPin * This, | 297 IPin * This, |
284 /* [in] */ const AM_MEDIA_TYPE *pmt) | 298 /* [in] */ const AM_MEDIA_TYPE *pmt) |
285 { | 299 { |
424 IMemInputPin * This, | 438 IMemInputPin * This, |
425 /* [in] */ IMemAllocator *pAllocator, | 439 /* [in] */ IMemAllocator *pAllocator, |
426 /* [in] */ int bReadOnly) | 440 /* [in] */ int bReadOnly) |
427 { | 441 { |
428 Debug printf("COutputPin::NotifyAllocator() called\n"); | 442 Debug printf("COutputPin::NotifyAllocator() called\n"); |
443 COutputPin* pPin=(COutputPin*)This; | |
444 pPin->pAllocator=(MemAllocator*)pAllocator; | |
429 return 0; | 445 return 0; |
430 } | 446 } |
431 | 447 |
432 HRESULT STDCALL COutputPin::GetAllocatorRequirements( | 448 HRESULT STDCALL COutputPin::GetAllocatorRequirements( |
433 IMemInputPin * This, | 449 IMemInputPin * This, |
448 if(pSample->vt->GetPointer(pSample, (BYTE **)&pointer)) | 464 if(pSample->vt->GetPointer(pSample, (BYTE **)&pointer)) |
449 return -1; | 465 return -1; |
450 int len=pSample->vt->GetActualDataLength(pSample); | 466 int len=pSample->vt->GetActualDataLength(pSample); |
451 if(len==0)len=pSample->vt->GetSize(pSample);//for iv50 | 467 if(len==0)len=pSample->vt->GetSize(pSample);//for iv50 |
452 //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len); | 468 //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len); |
453 *me.frame_pointer=pointer; | 469 if(me.frame_pointer) |
470 *me.frame_pointer=pointer; | |
454 if(me.frame_size_pointer)*me.frame_size_pointer=len; | 471 if(me.frame_size_pointer)*me.frame_size_pointer=len; |
455 /* | 472 /* |
456 FILE* file=fopen("./uncompr.bmp", "wb"); | 473 FILE* file=fopen("./uncompr.bmp", "wb"); |
457 char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00}; | 474 char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00}; |
458 *(int*)(&head[2])=len+0x36; | 475 *(int*)(&head[2])=len+0x36; |