annotate loader/dshow/outputpin.c @ 824:ee595ffdbee6

filaname tells it all
author eyck
date Thu, 17 May 2001 16:14:37 +0000
parents 9355b2ae634e
children 269780d31b51
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
1
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
2 #include <cstdio>
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
3 #include <string>
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
4
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
5 #include "outputpin.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
6 #include "allocator.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
7 #include "iunk.h"
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
8
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9 #define E_NOTIMPL 0x80004001
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
11 An object beyond interface IEnumMediaTypes.
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
12 Returned by COutputPin through call IPin::EnumMediaTypes().
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
13 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
14
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
15 class CEnumMediaTypes: public IEnumMediaTypes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
16 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
17 AM_MEDIA_TYPE type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18 static GUID interfaces[];
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
19 DECLARE_IUNKNOWN(CEnumMediaTypes)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
20 public:
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
21 CEnumMediaTypes(const AM_MEDIA_TYPE&);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
22 ~CEnumMediaTypes(){delete vt;}
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
23 static HRESULT STDCALL Next (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
24 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
25 /* [in] */ ULONG cMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
26 /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 /* [out] */ ULONG *pcFetched);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
29 static HRESULT STDCALL Skip (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
30 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
31 /* [in] */ ULONG cMediaTypes);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
33 static HRESULT STDCALL Reset (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
34 IEnumMediaTypes * This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
35
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
36 static HRESULT STDCALL Clone (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
37 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
38 /* [out] */ IEnumMediaTypes **ppEnum);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
39
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
40 };
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
41 GUID CEnumMediaTypes::interfaces[]=
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
42 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
43 IID_IUnknown,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
44 IID_IEnumMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
45 };
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
46 IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
47 CEnumMediaTypes::CEnumMediaTypes(const AM_MEDIA_TYPE& type)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
48 :refcount(1)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
49 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
50 this->type=type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
51 vt=new IEnumMediaTypes_vt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
52 vt->QueryInterface = QueryInterface;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
53 vt->AddRef = AddRef;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
54 vt->Release = Release;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
55 vt->Next = Next;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
56 vt->Skip = Skip;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
57 vt->Reset = Reset;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
58 vt->Clone = Clone;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
59 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
60
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
61 HRESULT STDCALL CEnumMediaTypes::Next (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
62 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
63 /* [in] */ ULONG cMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
64 /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
65 /* [out] */ ULONG *pcFetched)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
66 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
67 AM_MEDIA_TYPE& type=((CEnumMediaTypes*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
68 Debug printf("CEnumMediaTypes::Next() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 if(!ppMediaTypes)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
70 if(!pcFetched && (cMediaTypes!=1))return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
71 if(cMediaTypes<=0)return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
72
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
73 if(pcFetched)*pcFetched=1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
74 ppMediaTypes[0]=(AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
75 memcpy(*ppMediaTypes, &type, sizeof(AM_MEDIA_TYPE));
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
76 if(ppMediaTypes[0]->pbFormat)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
77 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
78 ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
79 memcpy(ppMediaTypes[0]->pbFormat, type.pbFormat, ppMediaTypes[0]->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
80 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
81 if(cMediaTypes==1)return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
82 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
83 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
84 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
85 I expect that these methods are unused.
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
86 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
87 HRESULT STDCALL CEnumMediaTypes::Skip (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
88 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
89 /* [in] */ ULONG cMediaTypes)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
90 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
91 Debug printf("CEnumMediaTypes::Skip() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
92 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
93 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
94
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
95 HRESULT STDCALL CEnumMediaTypes::Reset (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
96 IEnumMediaTypes * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
97 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
98 Debug printf("CEnumMediaTypes::Reset() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
99 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
100 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
101
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
102 HRESULT STDCALL CEnumMediaTypes::Clone (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
103 IEnumMediaTypes * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
104 /* [out] */ IEnumMediaTypes **ppEnum)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
105 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
106 Debug printf("CEnumMediaTypes::Clone() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
107 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
108 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
109
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
110 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
111 Implementation of output pin object.
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
112 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
113
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
114 // Constructor
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
115
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
116 COutputPin::COutputPin(const AM_MEDIA_TYPE& vh) :refcount(1), type(vh), remote(0), frame_pointer(0), frame_size_pointer(0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
117 {
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
118 IPin::vt = new IPin_vt;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
119 IPin::vt->QueryInterface = QueryInterface;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
120 IPin::vt->AddRef = AddRef;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
121 IPin::vt->Release = Release;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
122 IPin::vt->Connect = Connect;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
123 IPin::vt->ReceiveConnection = ReceiveConnection;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
124 IPin::vt->Disconnect=Disconnect;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
125 IPin::vt->ConnectedTo = ConnectedTo;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
126 IPin::vt->ConnectionMediaType = ConnectionMediaType;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
127 IPin::vt->QueryPinInfo = QueryPinInfo;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
128 IPin::vt->QueryDirection = QueryDirection;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
129 IPin::vt->QueryId = QueryId;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
130 IPin::vt->QueryAccept = QueryAccept;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
131 IPin::vt->EnumMediaTypes = EnumMediaTypes;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
132 IPin::vt->QueryInternalConnections = QueryInternalConnections;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
133 IPin::vt->EndOfStream = EndOfStream;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
134 IPin::vt->BeginFlush = BeginFlush;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
135 IPin::vt->EndFlush = EndFlush;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
136 IPin::vt->NewSegment = NewSegment;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
137
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
138 IMemInputPin::vt=new IMemInputPin_vt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139 IMemInputPin::vt->QueryInterface = M_QueryInterface;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
140 IMemInputPin::vt->AddRef = M_AddRef;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
141 IMemInputPin::vt->Release = M_Release;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
142 IMemInputPin::vt->GetAllocator = GetAllocator;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
143 IMemInputPin::vt->NotifyAllocator = NotifyAllocator;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
144 IMemInputPin::vt->GetAllocatorRequirements = GetAllocatorRequirements;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
145 IMemInputPin::vt->Receive = Receive;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
146 IMemInputPin::vt->ReceiveMultiple = ReceiveMultiple;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
147 IMemInputPin::vt->ReceiveCanBlock = ReceiveCanBlock;
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
148
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
149 pAllocator = 0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
150 frame_pointer = 0;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
151 }
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
152
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
153 COutputPin::~COutputPin()
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
154 {
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
155 delete IPin::vt;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
156 delete IMemInputPin::vt;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
157 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
158
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
159 // IPin->IUnknown methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
160
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
161 HRESULT STDCALL COutputPin::QueryInterface(IUnknown* This, GUID* iid, void** ppv)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
162 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
163 Debug printf("COutputPin::QueryInterface() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
164 if(!ppv)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
165 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
166 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
167 *ppv=(void*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
168 This->vt->AddRef(This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
169 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
170 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 if(!memcmp(iid, &IID_IMemInputPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173 *ppv=(void*)(This+1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
174 This->vt->AddRef(This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
175 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
176 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
177
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
178 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
179 "%02x%02x%02x%02x%02x%02x\n",
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
180 iid->f1, iid->f2, iid->f3,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
181 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
182 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
183 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
184 (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
185 return 0x80004002;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
186 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
187
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
188 HRESULT STDCALL COutputPin::AddRef(IUnknown* This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
189 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
190 Debug printf("COutputPin::AddRef() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
191 ((COutputPin*)This)->refcount++;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
192 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
193 }
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
194
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
195 HRESULT STDCALL COutputPin::Release(IUnknown* This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
196 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
197 Debug printf("COutputPin::Release() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198 if(--((COutputPin*)This)->refcount==0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
199 delete (COutputPin*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
200 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
201 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
202
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
203 // IPin methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
204
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
205 HRESULT STDCALL COutputPin::Connect (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
206 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
207 /* [in] */ IPin *pReceivePin,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
208 /* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
209 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
210 Debug printf("COutputPin::Connect() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
211 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
212 *pmt=((COutputPin*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
213 if(pmt->cbFormat>0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
214 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
215 pmt->pbFormat=CoTaskMemAlloc(pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
216 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
217 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
218 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
219 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
220 // if I put return 0; here, it crashes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
221 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
222
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
223 HRESULT STDCALL COutputPin::ReceiveConnection (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
224 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
225 /* [in] */ IPin *pConnector,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
226 /* [in] */ const AM_MEDIA_TYPE *pmt)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
227 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
228 Debug printf("COutputPin::ReceiveConnection() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
229 ((COutputPin*)This)->remote=pConnector;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
230 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
231 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
232
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
233 HRESULT STDCALL COutputPin::Disconnect (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
234 IPin * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
235 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
236 Debug printf("COutputPin::Disconnect() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
237 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
238 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
239
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
240
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
241 HRESULT STDCALL COutputPin::ConnectedTo (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
242 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
243 /* [out] */ IPin **pPin)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
244 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
245 Debug printf("COutputPin::ConnectedTo() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
246 if(!pPin)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
247 *pPin=((COutputPin*)This)->remote;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
248 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
249 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
250
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
251
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
252
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
253 HRESULT STDCALL COutputPin::ConnectionMediaType (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
254 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
255 /* [out] */ AM_MEDIA_TYPE *pmt)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
256 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
257 Debug printf("CInputPin::ConnectionMediaType() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
258 if(!pmt)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
259 *pmt=((COutputPin*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
260 if(pmt->cbFormat>0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
261 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
262 pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
263 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
264 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
265 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
266 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
267
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
268 HRESULT STDCALL COutputPin::QueryPinInfo (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
269 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
270 /* [out] */ PIN_INFO *pInfo)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
271 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
272 Debug printf("COutputPin::QueryPinInfo() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
273 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
274 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
275
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
276
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
277 HRESULT STDCALL COutputPin::QueryDirection (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
278 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
279 /* [out] */ PIN_DIRECTION *pPinDir)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
280 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
281 Debug printf("COutputPin::QueryDirection() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
282 if(!pPinDir)return -1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
283 *pPinDir=PINDIR_INPUT;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
284 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
285 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
286
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
287
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
288 HRESULT STDCALL COutputPin::QueryId (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
289 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
290 /* [out] */ LPWSTR *Id)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
291 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
292 Debug printf("COutputPin::QueryId() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
293 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
294 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
295
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
296 HRESULT STDCALL COutputPin::QueryAccept (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
297 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
298 /* [in] */ const AM_MEDIA_TYPE *pmt)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
299 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
300 Debug printf("COutputPin::QueryAccept() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
301 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
302 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
303
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
304
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
305 HRESULT STDCALL COutputPin::EnumMediaTypes (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
306 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
307 /* [out] */ IEnumMediaTypes **ppEnum)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
308 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
309 Debug printf("COutputPin::EnumMediaTypes() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
310 if(!ppEnum)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
311 *ppEnum=new CEnumMediaTypes(((COutputPin*)This)->type);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
312 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
313 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
314
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
315
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
316 HRESULT STDCALL COutputPin::QueryInternalConnections (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
317 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
318 /* [out] */ IPin **apPin,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
319 /* [out][in] */ ULONG *nPin)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
320 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
321 Debug printf("COutputPin::QueryInternalConnections() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
322 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
323 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
324
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
325 HRESULT STDCALL COutputPin::EndOfStream (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
326 IPin * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
327 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
328 Debug printf("COutputPin::EndOfStream() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
329 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
330 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
331
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
332
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
333 HRESULT STDCALL COutputPin::BeginFlush (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
334 IPin * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
335 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
336 Debug printf("COutputPin::BeginFlush() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
337 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
338 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
339
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
340
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
341 HRESULT STDCALL COutputPin::EndFlush (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
342 IPin * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
343 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
344 Debug printf("COutputPin::EndFlush() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
345 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
346 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
347
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
348 HRESULT STDCALL COutputPin::NewSegment (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
349 IPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
350 /* [in] */ REFERENCE_TIME tStart,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
351 /* [in] */ REFERENCE_TIME tStop,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
352 /* [in] */ double dRate)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
353 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
354 Debug printf("COutputPin::NewSegment(%ld,%ld,%f) called\n",tStart,tStop,dRate);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
355 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
356 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
357
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
358
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
359
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
360
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
361
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
362
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
363
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
364
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
365
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
366
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
367
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
368
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
369
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
370
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
371
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
372
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
373
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
374
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
375 // IMemInputPin->IUnknown methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
376
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
377 HRESULT STDCALL COutputPin::M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
378 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
379 Debug printf("COutputPin::QueryInterface() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
380 if(!ppv)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
381 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
382 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
383 COutputPin* ptr=(COutputPin*)(This-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
384 *ppv=(void*)ptr;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
385 AddRef((IUnknown*)ptr);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
386 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
387 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
388 /* if(!memcmp(iid, &IID_IPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
389 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
390 COutputPin* ptr=(COutputPin*)(This-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
391 *ppv=(void*)ptr;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
392 AddRef((IUnknown*)ptr);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
393 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
394 }*/
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
395 if(!memcmp(iid, &IID_IMemInputPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
396 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
397 *ppv=(void*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
398 This->vt->AddRef(This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
399 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
400 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
401 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
402 "%02x%02x%02x%02x%02x%02x\n",
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
403 iid->f1, iid->f2, iid->f3,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
404 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
405 (unsigned char)iid->f4[2],(unsigned char)iid->f4[3],(unsigned char)iid->f4[4],
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
406 (unsigned char)iid->f4[5],(unsigned char)iid->f4[6],(unsigned char)iid->f4[7]);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
407 return 0x80004002;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
408 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
409 HRESULT STDCALL COutputPin::M_AddRef(IUnknown* This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
410 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
411 Debug printf("COutputPin::AddRef() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
412 ((COutputPin*)(This-1))->refcount++;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
413 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
414 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
415 HRESULT STDCALL COutputPin::M_Release(IUnknown* This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
416 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
417 Debug printf("COutputPin::Release() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
418 if(--((COutputPin*)(This-1))->refcount==0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
419 delete (COutputPin*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
420 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
421 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
422
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
423
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
424
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
425
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
426 // IMemInputPin methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
427
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
428 HRESULT STDCALL COutputPin::GetAllocator(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
429 IMemInputPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
430 /* [out] */ IMemAllocator **ppAllocator)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
431 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
432 Debug printf("COutputPin::GetAllocator(%x,%x) called\n",This->vt,ppAllocator);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
433 *ppAllocator=new MemAllocator;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
434 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
435 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
436
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
437 HRESULT STDCALL COutputPin::NotifyAllocator(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
438 IMemInputPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
439 /* [in] */ IMemAllocator *pAllocator,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
440 /* [in] */ int bReadOnly)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
441 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
442 Debug printf("COutputPin::NotifyAllocator() called\n");
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
443 COutputPin* pPin=(COutputPin*)This;
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
444 pPin->pAllocator=(MemAllocator*)pAllocator;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
445 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
446 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
447
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
448 HRESULT STDCALL COutputPin::GetAllocatorRequirements(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
449 IMemInputPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
450 /* [out] */ ALLOCATOR_PROPERTIES *pProps)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
451 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
452 Debug printf("COutputPin::GetAllocatorRequirements() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
453 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
454 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
455
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
456 HRESULT STDCALL COutputPin::Receive(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
457 IMemInputPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
458 /* [in] */ IMediaSample *pSample)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
459 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
460 Debug printf("COutputPin::Receive() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
461 COutputPin& me=*(COutputPin*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
462 if(!pSample)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
463 char* pointer;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
464 if(pSample->vt->GetPointer(pSample, (BYTE **)&pointer))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
465 return -1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
466 int len=pSample->vt->GetActualDataLength(pSample);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
467 if(len==0)len=pSample->vt->GetSize(pSample);//for iv50
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
468 //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len);
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
469 if(me.frame_pointer)
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
470 *me.frame_pointer=pointer;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
471 if(me.frame_size_pointer)*me.frame_size_pointer=len;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
472 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
473 FILE* file=fopen("./uncompr.bmp", "wb");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
474 char head[14]={0x42, 0x4D, 0x36, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x00};
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
475 *(int*)(&head[2])=len+0x36;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
476 fwrite(head, 14, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
477 fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
478 fwrite(pointer, len, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
479 fclose(file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
480 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
481 // pSample->vt->Release((IUnknown*)pSample);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
482 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
483 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
484
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
485 HRESULT STDCALL COutputPin::ReceiveMultiple(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
486 IMemInputPin * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
487 /* [size_is][in] */ IMediaSample **pSamples,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
488 /* [in] */ long nSamples,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
489 /* [out] */ long *nSamplesProcessed)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
490 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
491 Debug printf("COutputPin::ReceiveMultiple() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
492 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
493 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
494
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
495 HRESULT STDCALL COutputPin::ReceiveCanBlock(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
496 IMemInputPin * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
497 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
498 Debug printf("COutputPin::ReceiveCanBlock() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
499 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
500 }