Mercurial > mplayer.hg
comparison loader/dshow/allocator.c @ 713:9355b2ae634e
avifile-0.6-CVS merge
author | arpi_esp |
---|---|
date | Sun, 06 May 2001 21:43:45 +0000 |
parents | bdc4a8fc04d8 |
children | da26060c81ef |
comparison
equal
deleted
inserted
replaced
712:ea093aa3ecae | 713:9355b2ae634e |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include "allocator.h" | 2 #include "allocator.h" |
3 #include <com.h> | 3 #include <com.h> |
4 #define E_NOTIMPL 0x80004001 | 4 #define E_NOTIMPL 0x80004001 |
5 using namespace std; | |
6 | |
5 class AllocatorKeeper | 7 class AllocatorKeeper |
6 { | 8 { |
7 public: | 9 public: |
8 AllocatorKeeper() | 10 AllocatorKeeper() |
9 { | 11 { |
34 vt->ReleaseBuffer = ReleaseBuffer; | 36 vt->ReleaseBuffer = ReleaseBuffer; |
35 | 37 |
36 props.cBuffers=1; | 38 props.cBuffers=1; |
37 props.cbBuffer=65536;/* :/ */ | 39 props.cbBuffer=65536;/* :/ */ |
38 props.cbAlign=props.cbPrefix=0; | 40 props.cbAlign=props.cbPrefix=0; |
41 | |
42 new_pointer=0; | |
43 modified_sample=0; | |
39 } | 44 } |
40 | 45 |
41 long MemAllocator::CreateAllocator(GUID* clsid, GUID* iid, void** ppv) | 46 long MemAllocator::CreateAllocator(GUID* clsid, GUID* iid, void** ppv) |
42 { | 47 { |
43 if(!ppv)return -1; | 48 if(!ppv)return -1; |
129 } | 134 } |
130 list<CMediaSample*>::iterator it=me->free_list.begin(); | 135 list<CMediaSample*>::iterator it=me->free_list.begin(); |
131 me->used_list.push_back(*it); | 136 me->used_list.push_back(*it); |
132 *ppBuffer=*it; | 137 *ppBuffer=*it; |
133 (*ppBuffer)->vt->AddRef((IUnknown*)*ppBuffer); | 138 (*ppBuffer)->vt->AddRef((IUnknown*)*ppBuffer); |
139 if(me->new_pointer) | |
140 { | |
141 if(me->modified_sample) | |
142 me->modified_sample->ResetPointer(); | |
143 (*it)->SetPointer(me->new_pointer); | |
144 me->modified_sample=*it; | |
145 me->new_pointer=0; | |
146 } | |
134 me->free_list.remove(*it); | 147 me->free_list.remove(*it); |
135 return 0; | 148 return 0; |
136 } | 149 } |
137 | 150 |
138 HRESULT STDCALL MemAllocator::ReleaseBuffer ( | 151 HRESULT STDCALL MemAllocator::ReleaseBuffer ( |