comparison loader/dshow/inputpin.c @ 1545:da26060c81ef

big avifile sync - from now we have common code
author arpi
date Thu, 16 Aug 2001 00:50:02 +0000
parents bdc4a8fc04d8
children ce45cce7f7a5
comparison
equal deleted inserted replaced
1544:558c1b03b8d0 1545:da26060c81ef
1 #include "inputpin.h" 1 #include "inputpin.h"
2 #include <wine/winerror.h>
3 #include <string.h>
2 #include <stdio.h> 4 #include <stdio.h>
3 #include <stdlib.h> 5 #include <stdlib.h>
4 #include <string.h> 6
5 #define E_NOTIMPL 0x80004001
6 GUID CInputPin::interfaces[]= 7 GUID CInputPin::interfaces[]=
7 { 8 {
8 IID_IUnknown, 9 IID_IUnknown,
9 }; 10 };
10 IMPLEMENT_IUNKNOWN(CInputPin) 11 IMPLEMENT_IUNKNOWN(CInputPin)
11 12
12 GUID CRemotePin::interfaces[]= 13 GUID CRemotePin::interfaces[]=
13 { 14 {
14 IID_IUnknown, 15 IID_IUnknown,
15 }; 16 };
16 IMPLEMENT_IUNKNOWN(CRemotePin) 17 IMPLEMENT_IUNKNOWN(CRemotePin)
17 18
18 GUID CRemotePin2::interfaces[]= 19 GUID CRemotePin2::interfaces[]=
19 { 20 {
20 IID_IUnknown, 21 IID_IUnknown,
21 }; 22 };
22 IMPLEMENT_IUNKNOWN(CRemotePin2) 23 IMPLEMENT_IUNKNOWN(CRemotePin2)
23 24
24 GUID CBaseFilter::interfaces[]= 25 GUID CBaseFilter::interfaces[]=
25 { 26 {
26 IID_IUnknown, 27 IID_IUnknown,
27 IID_IBaseFilter, 28 IID_IBaseFilter,
28 }; 29 };
29 IMPLEMENT_IUNKNOWN(CBaseFilter) 30 IMPLEMENT_IUNKNOWN(CBaseFilter)
30 31
31 GUID CBaseFilter2::interfaces[]= 32 GUID CBaseFilter2::interfaces[]=
32 { 33 {
33 IID_IUnknown, 34 IID_IUnknown,
34 IID_IBaseFilter, 35 IID_IBaseFilter,
35 {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}}, 36 {0x76c61a30, 0xebe1, 0x11cf, {0x89, 0xf9, 0x00, 0xa0, 0xc9, 0x03, 0x49, 0xcb}},
36 {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}}, 37 {0xaae7e4e2, 0x6388, 0x11d1, {0x8d, 0x93, 0x00, 0x60, 0x97, 0xc9, 0xa2, 0xb2}},
37 {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}}, 38 {0x02ef04dd, 0x7580, 0x11d1, {0xbe, 0xce, 0x00, 0xc0, 0x4f, 0xb6, 0xe9, 0x37}},
38 }; 39 };
39 IMPLEMENT_IUNKNOWN(CBaseFilter2) 40 IMPLEMENT_IUNKNOWN(CBaseFilter2)
40 41
41 class CEnumPins: public IEnumPins 42 class CEnumPins: public IEnumPins
42 { 43 {
46 static GUID interfaces[]; 47 static GUID interfaces[];
47 DECLARE_IUNKNOWN(CEnumPins) 48 DECLARE_IUNKNOWN(CEnumPins)
48 public: 49 public:
49 CEnumPins(IPin*, IPin* =0); 50 CEnumPins(IPin*, IPin* =0);
50 ~CEnumPins(){delete vt;} 51 ~CEnumPins(){delete vt;}
51 static long STDCALL Next ( 52 static long STDCALL Next (
52 IEnumPins * This, 53 IEnumPins * This,
53 /* [in] */ unsigned long cMediaTypes, 54 /* [in] */ unsigned long cMediaTypes,
54 /* [size_is][out] */ IPin **ppMediaTypes, 55 /* [size_is][out] */ IPin **ppMediaTypes,
55 /* [out] */ unsigned long *pcFetched); 56 /* [out] */ unsigned long *pcFetched);
56 57
57 static long STDCALL Skip ( 58 static long STDCALL Skip (
58 IEnumPins * This, 59 IEnumPins * This,
59 /* [in] */ unsigned long cMediaTypes); 60 /* [in] */ unsigned long cMediaTypes);
60 61
61 static long STDCALL Reset ( 62 static long STDCALL Reset (
62 IEnumPins * This); 63 IEnumPins * This);
63 64
64 static long STDCALL Clone ( 65 static long STDCALL Clone (
65 IEnumPins * This, 66 IEnumPins * This,
66 /* [out] */ IEnumPins **ppEnum); 67 /* [out] */ IEnumPins **ppEnum);
67 68
68 }; 69 };
69 GUID CEnumPins::interfaces[]= 70 GUID CEnumPins::interfaces[]=
77 { 78 {
78 vt=new IEnumPins_vt; 79 vt=new IEnumPins_vt;
79 vt->QueryInterface = QueryInterface; 80 vt->QueryInterface = QueryInterface;
80 vt->AddRef = AddRef; 81 vt->AddRef = AddRef;
81 vt->Release = Release; 82 vt->Release = Release;
82 vt->Next = Next; 83 vt->Next = Next;
83 vt->Skip = Skip; 84 vt->Skip = Skip;
84 vt->Reset = Reset; 85 vt->Reset = Reset;
85 vt->Clone = Clone; 86 vt->Clone = Clone;
86 } 87 }
87 88
88 long STDCALL CEnumPins::Next ( 89 long STDCALL CEnumPins::Next(IEnumPins * This,
89 IEnumPins * This, 90 /* [in] */ unsigned long cMediaTypes,
90 /* [in] */ unsigned long cMediaTypes, 91 /* [size_is][out] */ IPin **ppMediaTypes,
91 /* [size_is][out] */ IPin **ppMediaTypes, 92 /* [out] */ unsigned long *pcFetched)
92 /* [out] */ unsigned long *pcFetched) 93 {
93 {
94 IPin* pin1=((CEnumPins*)This)->pin1;
95 IPin* pin2=((CEnumPins*)This)->pin2;
96 Debug printf("CEnumPins::Next() called\n"); 94 Debug printf("CEnumPins::Next() called\n");
97 if(!ppMediaTypes)return 0x80004003; 95 if (!ppMediaTypes)
98 if(!pcFetched && (cMediaTypes!=1))return 0x80004003; 96 return E_INVALIDARG;
99 if(cMediaTypes<=0)return 0; 97 if (!pcFetched && (cMediaTypes!=1))
100 int& counter=((CEnumPins*)This)->counter; 98 return E_INVALIDARG;
101 if(((counter==2) && pin2) || ((counter==1) && !pin2)) 99 if (cMediaTypes<=0)
100 return 0;
101 int& lcounter=((CEnumPins*)This)->counter;
102
103 IPin* lpin1=((CEnumPins*)This)->pin1;
104 IPin* lpin2=((CEnumPins*)This)->pin2;
105 if (((lcounter == 2) && lpin2) || ((lcounter == 1) && !lpin2))
102 { 106 {
103 if(pcFetched)*pcFetched=0; 107 if (pcFetched)
108 *pcFetched=0;
104 return 1; 109 return 1;
105 } 110 }
106 111
107 if(pcFetched)*pcFetched=1; 112 if (pcFetched)
108 if(counter==0) 113 *pcFetched=1;
114 if (lcounter==0)
109 { 115 {
110 *ppMediaTypes=pin1; 116 *ppMediaTypes = lpin1;
111 pin1->vt->AddRef((IUnknown*)pin1); 117 lpin1->vt->AddRef((IUnknown*)lpin1);
112 } 118 }
113 else 119 else
114 { 120 {
115 *ppMediaTypes=pin2; 121 *ppMediaTypes = lpin2;
116 pin2->vt->AddRef((IUnknown*)pin2); 122 lpin2->vt->AddRef((IUnknown*)lpin2);
117 } 123 }
118 counter++; 124 lcounter++;
119 if(cMediaTypes==1)return 0; 125 if (cMediaTypes == 1)
126 return 0;
120 return 1; 127 return 1;
121 } 128 }
122 129
123 long STDCALL CEnumPins::Skip ( 130 long STDCALL CEnumPins::Skip(IEnumPins * This,
124 IEnumPins * This, 131 /* [in] */ unsigned long cMediaTypes)
125 /* [in] */ unsigned long cMediaTypes)
126 { 132 {
127 Debug printf("CEnumPins::Skip() called\n"); 133 Debug printf("CEnumPins::Skip() called\n");
128 return E_NOTIMPL; 134 return E_NOTIMPL;
129 } 135 }
130 136
131 long STDCALL CEnumPins::Reset ( 137 long STDCALL CEnumPins::Reset(IEnumPins * This)
132 IEnumPins * This)
133 { 138 {
134 Debug printf("CEnumPins::Reset() called\n"); 139 Debug printf("CEnumPins::Reset() called\n");
135 ((CEnumPins*)This)->counter=0; 140 ((CEnumPins*)This)->counter=0;
136 return 0; 141 return 0;
137 } 142 }
138 143
139 long STDCALL CEnumPins::Clone ( 144 long STDCALL CEnumPins::Clone(IEnumPins * This,
140 IEnumPins * This, 145 /* [out] */ IEnumPins **ppEnum)
141 /* [out] */ IEnumPins **ppEnum)
142 { 146 {
143 Debug printf("CEnumPins::Clone() called\n"); 147 Debug printf("CEnumPins::Clone() called\n");
144 return E_NOTIMPL; 148 return E_NOTIMPL;
145 } 149 }
146 150
147 CInputPin::CInputPin(CBaseFilter* p, const AM_MEDIA_TYPE& vh) 151 CInputPin::CInputPin(CBaseFilter* p, const AM_MEDIA_TYPE& vh)
148 : refcount(1), type(vh), parent(p) 152 : type(vh)
149 { 153 {
154 refcount = 1;
155 parent = p;
150 vt=new IPin_vt; 156 vt=new IPin_vt;
151 vt->QueryInterface = QueryInterface; 157 vt->QueryInterface = QueryInterface;
152 vt->AddRef = AddRef; 158 vt->AddRef = AddRef;
153 vt->Release = Release; 159 vt->Release = Release;
154 vt->Connect = Connect; 160 vt->Connect = Connect;
166 vt->BeginFlush = BeginFlush; 172 vt->BeginFlush = BeginFlush;
167 vt->EndFlush = EndFlush; 173 vt->EndFlush = EndFlush;
168 vt->NewSegment = NewSegment; 174 vt->NewSegment = NewSegment;
169 } 175 }
170 176
171 long STDCALL CInputPin::Connect ( 177 long STDCALL CInputPin::Connect (
172 IPin * This, 178 IPin * This,
173 /* [in] */ IPin *pReceivePin, 179 /* [in] */ IPin *pReceivePin,
174 /* [in] */ AM_MEDIA_TYPE *pmt) 180 /* [in] */ AM_MEDIA_TYPE *pmt)
175 { 181 {
176 Debug printf("CInputPin::Connect() called\n"); 182 Debug printf("CInputPin::Connect() called\n");
177 return E_NOTIMPL; 183 return E_NOTIMPL;
178 } 184 }
179 185
180 long STDCALL CInputPin::ReceiveConnection ( 186 long STDCALL CInputPin::ReceiveConnection(IPin * This,
181 IPin * This, 187 /* [in] */ IPin *pConnector,
182 /* [in] */ IPin *pConnector, 188 /* [in] */ const AM_MEDIA_TYPE *pmt)
183 /* [in] */ const AM_MEDIA_TYPE *pmt)
184 { 189 {
185 Debug printf("CInputPin::ReceiveConnection() called\n"); 190 Debug printf("CInputPin::ReceiveConnection() called\n");
186 return E_NOTIMPL; 191 return E_NOTIMPL;
187 } 192 }
188 193
189 long STDCALL CInputPin::Disconnect ( 194 long STDCALL CInputPin::Disconnect(IPin * This)
190 IPin * This)
191 { 195 {
192 Debug printf("CInputPin::Disconnect() called\n"); 196 Debug printf("CInputPin::Disconnect() called\n");
193 return E_NOTIMPL; 197 return E_NOTIMPL;
194 } 198 }
195 199
196 200 long STDCALL CInputPin::ConnectedTo(IPin * This, /* [out] */ IPin **pPin)
197 long STDCALL CInputPin::ConnectedTo (
198 IPin * This,
199 /* [out] */ IPin **pPin)
200 { 201 {
201 Debug printf("CInputPin::ConnectedTo() called\n"); 202 Debug printf("CInputPin::ConnectedTo() called\n");
202 return E_NOTIMPL; 203 return E_NOTIMPL;
203 } 204 }
204 205
205 206 long STDCALL CInputPin::ConnectionMediaType(IPin * This,
206 long STDCALL CInputPin::ConnectionMediaType ( 207 /* [out] */ AM_MEDIA_TYPE *pmt)
207 IPin * This,
208 /* [out] */ AM_MEDIA_TYPE *pmt)
209 { 208 {
210 Debug printf("CInputPin::ConnectionMediaType() called\n"); 209 Debug printf("CInputPin::ConnectionMediaType() called\n");
211 if(!pmt)return 0x80004003; 210 if(!pmt)return E_INVALIDARG;
212 *pmt=((CInputPin*)This)->type; 211 *pmt=((CInputPin*)This)->type;
213 if(pmt->cbFormat>0) 212 if(pmt->cbFormat>0)
214 { 213 {
215 pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat); 214 pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
216 memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat); 215 memcpy(pmt->pbFormat, ((CInputPin*)This)->type.pbFormat, pmt->cbFormat);
217 } 216 }
218 return 0; 217 return 0;
219 } 218 }
220 219
221 long STDCALL CInputPin::QueryPinInfo ( 220 long STDCALL CInputPin::QueryPinInfo(IPin * This, /* [out] */ PIN_INFO *pInfo)
222 IPin * This,
223 /* [out] */ PIN_INFO *pInfo)
224 { 221 {
225 Debug printf("CInputPin::QueryPinInfo() called\n"); 222 Debug printf("CInputPin::QueryPinInfo() called\n");
226 pInfo->dir=PINDIR_OUTPUT; 223 pInfo->dir=PINDIR_OUTPUT;
227 CBaseFilter* parent=((CInputPin*)This)->parent; 224 CBaseFilter* lparent=((CInputPin*)This)->parent;
228 pInfo->pFilter=parent; 225 pInfo->pFilter = lparent;
229 parent->vt->AddRef((IUnknown*)parent); 226 lparent->vt->AddRef((IUnknown*)lparent);
230 pInfo->achName[0]=0; 227 pInfo->achName[0]=0;
231 return 0; 228 return 0;
232 } 229 }
233 230
234 231 long STDCALL CInputPin::QueryDirection(IPin * This,
235 long STDCALL CInputPin::QueryDirection ( 232 /* [out] */ PIN_DIRECTION *pPinDir)
236 IPin * This,
237 /* [out] */ PIN_DIRECTION *pPinDir)
238 { 233 {
239 *pPinDir=PINDIR_OUTPUT; 234 *pPinDir=PINDIR_OUTPUT;
240 Debug printf("CInputPin::QueryDirection() called\n"); 235 Debug printf("CInputPin::QueryDirection() called\n");
241 return 0; 236 return 0;
242 } 237 }
243 238
244 239 long STDCALL CInputPin::QueryId(IPin * This, /* [out] */ unsigned short* *Id)
245 long STDCALL CInputPin::QueryId (
246 IPin * This,
247 /* [out] */ unsigned short* *Id)
248 { 240 {
249 Debug printf("CInputPin::QueryId() called\n"); 241 Debug printf("CInputPin::QueryId() called\n");
250 return E_NOTIMPL; 242 return E_NOTIMPL;
251 } 243 }
252 244
253 245 long STDCALL CInputPin::QueryAccept(IPin * This,
254 long STDCALL CInputPin::QueryAccept ( 246 /* [in] */ const AM_MEDIA_TYPE *pmt)
255 IPin * This,
256 /* [in] */ const AM_MEDIA_TYPE *pmt)
257 { 247 {
258 Debug printf("CInputPin::QueryAccept() called\n"); 248 Debug printf("CInputPin::QueryAccept() called\n");
259 return E_NOTIMPL; 249 return E_NOTIMPL;
260 } 250 }
261 251
262 252
263 long STDCALL CInputPin::EnumMediaTypes ( 253 long STDCALL CInputPin::EnumMediaTypes (
264 IPin * This, 254 IPin * This,
265 /* [out] */ IEnumMediaTypes **ppEnum) 255 /* [out] */ IEnumMediaTypes **ppEnum)
266 { 256 {
267 Debug printf("CInputPin::EnumMediaTypes() called\n"); 257 Debug printf("CInputPin::EnumMediaTypes() called\n");
268 return E_NOTIMPL; 258 return E_NOTIMPL;
269 } 259 }
270 260
271 261
272 long STDCALL CInputPin::QueryInternalConnections ( 262 long STDCALL CInputPin::QueryInternalConnections(IPin * This,
273 IPin * This, 263 /* [out] */ IPin **apPin,
274 /* [out] */ IPin **apPin, 264 /* [out][in] */ unsigned long *nPin)
275 /* [out][in] */ unsigned long *nPin)
276 { 265 {
277 Debug printf("CInputPin::QueryInternalConnections() called\n"); 266 Debug printf("CInputPin::QueryInternalConnections() called\n");
278 return E_NOTIMPL; 267 return E_NOTIMPL;
279 } 268 }
280 269
281 long STDCALL CInputPin::EndOfStream ( 270 long STDCALL CInputPin::EndOfStream (IPin * This)
282 IPin * This)
283 { 271 {
284 Debug printf("CInputPin::EndOfStream() called\n"); 272 Debug printf("CInputPin::EndOfStream() called\n");
285 return E_NOTIMPL; 273 return E_NOTIMPL;
286 } 274 }
287 275
288 276
289 long STDCALL CInputPin::BeginFlush ( 277 long STDCALL CInputPin::BeginFlush(IPin * This)
290 IPin * This)
291 { 278 {
292 Debug printf("CInputPin::BeginFlush() called\n"); 279 Debug printf("CInputPin::BeginFlush() called\n");
293 return E_NOTIMPL; 280 return E_NOTIMPL;
294 } 281 }
295 282
296 283
297 long STDCALL CInputPin::EndFlush ( 284 long STDCALL CInputPin::EndFlush(IPin * This)
298 IPin * This)
299 { 285 {
300 Debug printf("CInputPin::EndFlush() called\n"); 286 Debug printf("CInputPin::EndFlush() called\n");
301 return E_NOTIMPL; 287 return E_NOTIMPL;
302 } 288 }
303 289
304 long STDCALL CInputPin::NewSegment ( 290 long STDCALL CInputPin::NewSegment(IPin * This,
305 IPin * This, 291 /* [in] */ REFERENCE_TIME tStart,
306 /* [in] */ REFERENCE_TIME tStart, 292 /* [in] */ REFERENCE_TIME tStop,
307 /* [in] */ REFERENCE_TIME tStop, 293 /* [in] */ double dRate)
308 /* [in] */ double dRate)
309 { 294 {
310 Debug printf("CInputPin::NewSegment() called\n"); 295 Debug printf("CInputPin::NewSegment() called\n");
311 return E_NOTIMPL; 296 return E_NOTIMPL;
312 } 297 }
313 298
314
315
316
317
318
319 CBaseFilter::CBaseFilter(const AM_MEDIA_TYPE& type, CBaseFilter2* parent) 299 CBaseFilter::CBaseFilter(const AM_MEDIA_TYPE& type, CBaseFilter2* parent)
320 : refcount(1) 300 {
321 { 301 refcount = 1;
322 pin=new CInputPin(this, type); 302 pin=new CInputPin(this, type);
323 unused_pin=new CRemotePin(this, parent->GetPin()); 303 unused_pin=new CRemotePin(this, parent->GetPin());
324 vt=new IBaseFilter_vt; 304 vt=new IBaseFilter_vt;
325 vt->QueryInterface = QueryInterface; 305 vt->QueryInterface = QueryInterface;
326 vt->AddRef = AddRef; 306 vt->AddRef = AddRef;
327 vt->Release = Release; 307 vt->Release = Release;
328 vt->GetClassID = GetClassID; 308 vt->GetClassID = GetClassID;
329 vt->Stop = Stop; 309 vt->Stop = Stop;
330 vt->Pause = Pause; 310 vt->Pause = Pause;
331 vt->Run = Run; 311 vt->Run = Run;
332 vt->GetState = GetState; 312 vt->GetState = GetState;
333 vt->SetSyncSource = SetSyncSource; 313 vt->SetSyncSource = SetSyncSource;
334 vt->GetSyncSource = GetSyncSource; 314 vt->GetSyncSource = GetSyncSource;
335 vt->EnumPins = EnumPins; 315 vt->EnumPins = EnumPins;
336 vt->FindPin = FindPin; 316 vt->FindPin = FindPin;
337 vt->QueryFilterInfo = QueryFilterInfo; 317 vt->QueryFilterInfo = QueryFilterInfo;
338 vt->JoinFilterGraph = JoinFilterGraph; 318 vt->JoinFilterGraph = JoinFilterGraph;
339 vt->QueryVendorInfo = QueryVendorInfo; 319 vt->QueryVendorInfo = QueryVendorInfo;
340 } 320 }
341 321
342 long STDCALL CBaseFilter::GetClassID ( 322 long STDCALL CBaseFilter::GetClassID(IBaseFilter * This,
343 IBaseFilter * This, 323 /* [out] */ CLSID *pClassID)
344 /* [out] */ CLSID *pClassID)
345 { 324 {
346 Debug printf("CBaseFilter::GetClassID() called\n"); 325 Debug printf("CBaseFilter::GetClassID() called\n");
347 return E_NOTIMPL; 326 return E_NOTIMPL;
348 } 327 }
349 328
350 long STDCALL CBaseFilter::Stop ( 329 long STDCALL CBaseFilter::Stop(IBaseFilter * This)
351 IBaseFilter * This)
352 { 330 {
353 Debug printf("CBaseFilter::Stop() called\n"); 331 Debug printf("CBaseFilter::Stop() called\n");
354 return E_NOTIMPL; 332 return E_NOTIMPL;
355 } 333 }
356 334
357 335 long STDCALL CBaseFilter::Pause(IBaseFilter * This)
358 long STDCALL CBaseFilter::Pause (
359 IBaseFilter * This)
360 { 336 {
361 Debug printf("CBaseFilter::Pause() called\n"); 337 Debug printf("CBaseFilter::Pause() called\n");
362 return E_NOTIMPL; 338 return E_NOTIMPL;
363 } 339 }
364 340
365 long STDCALL CBaseFilter::Run ( 341 long STDCALL CBaseFilter::Run(IBaseFilter * This,
366 IBaseFilter * This, 342 REFERENCE_TIME tStart)
367 REFERENCE_TIME tStart)
368 { 343 {
369 Debug printf("CBaseFilter::Run() called\n"); 344 Debug printf("CBaseFilter::Run() called\n");
370 return E_NOTIMPL; 345 return E_NOTIMPL;
371 } 346 }
372 347
373 348 long STDCALL CBaseFilter::GetState(IBaseFilter * This,
374 long STDCALL CBaseFilter::GetState ( 349 /* [in] */ unsigned long dwMilliSecsTimeout,
375 IBaseFilter * This, 350 // /* [out] */ FILTER_STATE *State)
376 /* [in] */ unsigned long dwMilliSecsTimeout, 351 void* State)
377 // /* [out] */ FILTER_STATE *State)
378 void* State)
379 { 352 {
380 Debug printf("CBaseFilter::GetState() called\n"); 353 Debug printf("CBaseFilter::GetState() called\n");
381 return E_NOTIMPL; 354 return E_NOTIMPL;
382 } 355 }
383 356
384 357 long STDCALL CBaseFilter::SetSyncSource(IBaseFilter * This,
385 long STDCALL CBaseFilter::SetSyncSource ( 358 /* [in] */ IReferenceClock *pClock)
386 IBaseFilter * This,
387 /* [in] */ IReferenceClock *pClock)
388 { 359 {
389 Debug printf("CBaseFilter::SetSyncSource() called\n"); 360 Debug printf("CBaseFilter::SetSyncSource() called\n");
390 return E_NOTIMPL; 361 return E_NOTIMPL;
391 } 362 }
392 363
393 364 long STDCALL CBaseFilter::GetSyncSource (
394 long STDCALL CBaseFilter::GetSyncSource (
395 IBaseFilter * This, 365 IBaseFilter * This,
396 /* [out] */ IReferenceClock **pClock) 366 /* [out] */ IReferenceClock **pClock)
397 { 367 {
398 Debug printf("CBaseFilter::GetSyncSource() called\n"); 368 Debug printf("CBaseFilter::GetSyncSource() called\n");
399 return E_NOTIMPL; 369 return E_NOTIMPL;
400 } 370 }
401 371
402 372
403 long STDCALL CBaseFilter::EnumPins ( 373 long STDCALL CBaseFilter::EnumPins (
404 IBaseFilter * This, 374 IBaseFilter * This,
405 /* [out] */ IEnumPins **ppEnum) 375 /* [out] */ IEnumPins **ppEnum)
406 { 376 {
407 Debug printf("CBaseFilter::EnumPins() called\n"); 377 Debug printf("CBaseFilter::EnumPins() called\n");
408 *ppEnum=new CEnumPins(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin); 378 *ppEnum=new CEnumPins(((CBaseFilter*)This)->pin, ((CBaseFilter*)This)->unused_pin);
409 return 0; 379 return 0;
410 } 380 }
411 381
412 382
413 long STDCALL CBaseFilter::FindPin ( 383 long STDCALL CBaseFilter::FindPin (
414 IBaseFilter * This, 384 IBaseFilter * This,
415 /* [string][in] */ const unsigned short* Id, 385 /* [string][in] */ const unsigned short* Id,
416 /* [out] */ IPin **ppPin) 386 /* [out] */ IPin **ppPin)
417 { 387 {
418 Debug printf("CBaseFilter::FindPin() called\n"); 388 Debug printf("CBaseFilter::FindPin() called\n");
419 return E_NOTIMPL; 389 return E_NOTIMPL;
420 } 390 }
421 391
422 392
423 long STDCALL CBaseFilter::QueryFilterInfo ( 393 long STDCALL CBaseFilter::QueryFilterInfo (
424 IBaseFilter * This, 394 IBaseFilter * This,
425 // /* [out] */ FILTER_INFO *pInfo) 395 // /* [out] */ FILTER_INFO *pInfo)
426 void* pInfo) 396 void* pInfo)
427 { 397 {
428 Debug printf("CBaseFilter::QueryFilterInfo() called\n"); 398 Debug printf("CBaseFilter::QueryFilterInfo() called\n");
429 return E_NOTIMPL; 399 return E_NOTIMPL;
430 } 400 }
431 401
432 402
433 long STDCALL CBaseFilter::JoinFilterGraph ( 403 long STDCALL CBaseFilter::JoinFilterGraph (
434 IBaseFilter * This, 404 IBaseFilter * This,
435 /* [in] */ IFilterGraph *pGraph, 405 /* [in] */ IFilterGraph *pGraph,
436 /* [string][in] */ const unsigned short* pName) 406 /* [string][in] */ const unsigned short* pName)
437 { 407 {
438 Debug printf("CBaseFilter::JoinFilterGraph() called\n"); 408 Debug printf("CBaseFilter::JoinFilterGraph() called\n");
439 return E_NOTIMPL; 409 return E_NOTIMPL;
440 } 410 }
441 411
442 412
443 long STDCALL CBaseFilter::QueryVendorInfo ( 413 long STDCALL CBaseFilter::QueryVendorInfo (
444 IBaseFilter * This, 414 IBaseFilter * This,
445 /* [string][out] */ unsigned short* *pVendorInfo) 415 /* [string][out] */ unsigned short* *pVendorInfo)
446 { 416 {
447 Debug printf("CBaseFilter::QueryVendorInfo() called\n"); 417 Debug printf("CBaseFilter::QueryVendorInfo() called\n");
448 return E_NOTIMPL; 418 return E_NOTIMPL;
449 } 419 }
450 420
451 421
452 CBaseFilter2::CBaseFilter2() : refcount(1) 422 CBaseFilter2::CBaseFilter2() : refcount(1)
453 { 423 {
454 pin=new CRemotePin2(this); 424 pin=new CRemotePin2(this);
459 vt->Release = Release; 429 vt->Release = Release;
460 vt->GetClassID = GetClassID; 430 vt->GetClassID = GetClassID;
461 vt->Stop = Stop; 431 vt->Stop = Stop;
462 vt->Pause = Pause; 432 vt->Pause = Pause;
463 vt->Run = Run; 433 vt->Run = Run;
464 vt->GetState = GetState; 434 vt->GetState = GetState;
465 vt->SetSyncSource = SetSyncSource; 435 vt->SetSyncSource = SetSyncSource;
466 vt->GetSyncSource = GetSyncSource; 436 vt->GetSyncSource = GetSyncSource;
467 vt->EnumPins = EnumPins; 437 vt->EnumPins = EnumPins;
468 vt->FindPin = FindPin; 438 vt->FindPin = FindPin;
469 vt->QueryFilterInfo = QueryFilterInfo; 439 vt->QueryFilterInfo = QueryFilterInfo;
470 vt->JoinFilterGraph = JoinFilterGraph; 440 vt->JoinFilterGraph = JoinFilterGraph;
471 vt->QueryVendorInfo = QueryVendorInfo; 441 vt->QueryVendorInfo = QueryVendorInfo;
472 } 442 }
473 CRemotePin2::CRemotePin2(CBaseFilter2* p):parent(p), 443
444
445
446
447 long STDCALL CBaseFilter2::GetClassID (
448 IBaseFilter * This,
449 /* [out] */ CLSID *pClassID)
450 {
451 Debug printf("CBaseFilter2::GetClassID() called\n");
452 return E_NOTIMPL;
453 }
454
455 long STDCALL CBaseFilter2::Stop (
456 IBaseFilter * This)
457 {
458 Debug printf("CBaseFilter2::Stop() called\n");
459 return E_NOTIMPL;
460 }
461
462
463 long STDCALL CBaseFilter2::Pause (IBaseFilter * This)
464 {
465 Debug printf("CBaseFilter2::Pause() called\n");
466 return E_NOTIMPL;
467 }
468
469 long STDCALL CBaseFilter2::Run (IBaseFilter * This, REFERENCE_TIME tStart)
470 {
471 Debug printf("CBaseFilter2::Run() called\n");
472 return E_NOTIMPL;
473 }
474
475
476 long STDCALL CBaseFilter2::GetState (
477 IBaseFilter * This,
478 /* [in] */ unsigned long dwMilliSecsTimeout,
479 // /* [out] */ FILTER_STATE *State)
480 void* State)
481 {
482 Debug printf("CBaseFilter2::GetState() called\n");
483 return E_NOTIMPL;
484 }
485
486
487 long STDCALL CBaseFilter2::SetSyncSource (
488 IBaseFilter * This,
489 /* [in] */ IReferenceClock *pClock)
490 {
491 Debug printf("CBaseFilter2::SetSyncSource() called\n");
492 return E_NOTIMPL;
493 }
494
495
496 long STDCALL CBaseFilter2::GetSyncSource (
497 IBaseFilter * This,
498 /* [out] */ IReferenceClock **pClock)
499 {
500 Debug printf("CBaseFilter2::GetSyncSource() called\n");
501 return E_NOTIMPL;
502 }
503
504
505 long STDCALL CBaseFilter2::EnumPins (
506 IBaseFilter * This,
507 /* [out] */ IEnumPins **ppEnum)
508 {
509 Debug printf("CBaseFilter2::EnumPins() called\n");
510 *ppEnum=new CEnumPins(((CBaseFilter2*)This)->pin);
511 return 0;
512 }
513
514
515 long STDCALL CBaseFilter2::FindPin (
516 IBaseFilter * This,
517 /* [string][in] */ const unsigned short* Id,
518 /* [out] */ IPin **ppPin)
519 {
520 Debug printf("CBaseFilter2::FindPin() called\n");
521 return E_NOTIMPL;
522 }
523
524
525 long STDCALL CBaseFilter2::QueryFilterInfo (
526 IBaseFilter * This,
527 // /* [out] */ FILTER_INFO *pInfo)
528 void* pInfo)
529 {
530 Debug printf("CBaseFilter2::QueryFilterInfo() called\n");
531 return E_NOTIMPL;
532 }
533
534
535 long STDCALL CBaseFilter2::JoinFilterGraph(IBaseFilter * This,
536 /* [in] */ IFilterGraph *pGraph,
537 /* [string][in] */
538 const unsigned short* pName)
539 {
540 Debug printf("CBaseFilter2::JoinFilterGraph() called\n");
541 return E_NOTIMPL;
542 }
543
544 long STDCALL CBaseFilter2::QueryVendorInfo(IBaseFilter * This,
545 /* [string][out] */
546 unsigned short* *pVendorInfo)
547 {
548 Debug printf("CBaseFilter2::QueryVendorInfo() called\n");
549 return E_NOTIMPL;
550 }
551
552 static long STDCALL CRemotePin_ConnectedTo(IPin * This, /* [out] */ IPin **pPin)
553 {
554 Debug printf("CRemotePin::ConnectedTo called\n");
555 if (!pPin)
556 return E_INVALIDARG;
557 *pPin=((CRemotePin*)This)->remote_pin;
558 (*pPin)->vt->AddRef((IUnknown*)(*pPin));
559 return 0;
560 }
561
562 static long STDCALL CRemotePin_QueryDirection(IPin * This,
563 /* [out] */ PIN_DIRECTION *pPinDir)
564 {
565 Debug printf("CRemotePin::QueryDirection called\n");
566 if (!pPinDir)
567 return E_INVALIDARG;
568 *pPinDir=PINDIR_INPUT;
569 return 0;
570 }
571
572 static long STDCALL CRemotePin_ConnectionMediaType(IPin* This, /* [out] */ AM_MEDIA_TYPE* pmt)
573 {
574 Debug printf("CRemotePin::ConnectionMediaType() called\n");
575 return E_NOTIMPL;
576 }
577
578 static long STDCALL CRemotePin_QueryPinInfo(IPin* This, /* [out] */ PIN_INFO* pInfo)
579 {
580 Debug printf("CRemotePin::QueryPinInfo() called\n");
581 pInfo->dir=PINDIR_INPUT;
582 CBaseFilter* lparent = ((CRemotePin*)This)->parent;
583 pInfo->pFilter = lparent;
584 lparent->vt->AddRef((IUnknown*)lparent);
585 pInfo->achName[0]=0;
586 return 0;
587 }
588
589
590 static long STDCALL CRemotePin2_QueryPinInfo(IPin * This,
591 /* [out] */ PIN_INFO *pInfo)
592 {
593 Debug printf("CRemotePin2::QueryPinInfo called\n");
594 CBaseFilter2* lparent=((CRemotePin2*)This)->parent;
595 pInfo->pFilter=(IBaseFilter*)lparent;
596 lparent->vt->AddRef((IUnknown*)lparent);
597 pInfo->dir=PINDIR_OUTPUT;
598 pInfo->achName[0]=0;
599 return 0;
600 }
601
602 CRemotePin::CRemotePin(CBaseFilter* pt, IPin* rpin): parent(pt), remote_pin(rpin),
474 refcount(1) 603 refcount(1)
475 { 604 {
476 vt=new IPin_vt; 605 vt = new IPin_vt;
477 memset(vt, 0, sizeof (IPin_vt)); 606 memset(vt, 0, sizeof(IPin_vt));
478 vt->QueryInterface = QueryInterface; 607 vt->QueryInterface = QueryInterface;
479 vt->AddRef = AddRef; 608 vt->AddRef = AddRef;
480 vt->Release = Release; 609 vt->Release = Release;
481 vt->QueryPinInfo=QueryPinInfo; 610 vt->QueryDirection = CRemotePin_QueryDirection;
482 } 611 vt->ConnectedTo = CRemotePin_ConnectedTo;
483 CRemotePin::CRemotePin(CBaseFilter* pt, IPin* rpin): parent(pt), remote_pin(rpin), 612 vt->ConnectionMediaType = CRemotePin_ConnectionMediaType;
613 vt->QueryPinInfo = CRemotePin_QueryPinInfo;
614 }
615
616 CRemotePin2::CRemotePin2(CBaseFilter2* p):parent(p),
484 refcount(1) 617 refcount(1)
485 { 618 {
486 vt=new IPin_vt; 619 vt = new IPin_vt;
487 memset(vt, 0, sizeof (IPin_vt)); 620 memset(vt, 0, sizeof(IPin_vt));
488 vt->QueryInterface = QueryInterface; 621 vt->QueryInterface = QueryInterface;
489 vt->AddRef = AddRef; 622 vt->AddRef = AddRef;
490 vt->Release = Release; 623 vt->Release = Release;
491 vt->QueryDirection = QueryDirection; 624 vt->QueryPinInfo = CRemotePin2_QueryPinInfo;
492 vt->ConnectedTo = ConnectedTo; 625 }
493 vt->ConnectionMediaType = ConnectionMediaType;
494 vt->QueryPinInfo = QueryPinInfo;
495 }
496
497
498
499
500
501
502
503
504
505
506
507
508 long STDCALL CBaseFilter2::GetClassID (
509 IBaseFilter * This,
510 /* [out] */ CLSID *pClassID)
511 {
512 Debug printf("CBaseFilter2::GetClassID() called\n");
513 return E_NOTIMPL;
514 }
515
516 long STDCALL CBaseFilter2::Stop (
517 IBaseFilter * This)
518 {
519 Debug printf("CBaseFilter2::Stop() called\n");
520 return E_NOTIMPL;
521 }
522
523
524 long STDCALL CBaseFilter2::Pause (
525 IBaseFilter * This)
526 {
527 Debug printf("CBaseFilter2::Pause() called\n");
528 return E_NOTIMPL;
529 }
530
531 long STDCALL CBaseFilter2::Run (
532 IBaseFilter * This,
533 REFERENCE_TIME tStart)
534 {
535 Debug printf("CBaseFilter2::Run() called\n");
536 return E_NOTIMPL;
537 }
538
539
540 long STDCALL CBaseFilter2::GetState (
541 IBaseFilter * This,
542 /* [in] */ unsigned long dwMilliSecsTimeout,
543 // /* [out] */ FILTER_STATE *State)
544 void* State)
545 {
546 Debug printf("CBaseFilter2::GetState() called\n");
547 return E_NOTIMPL;
548 }
549
550
551 long STDCALL CBaseFilter2::SetSyncSource (
552 IBaseFilter * This,
553 /* [in] */ IReferenceClock *pClock)
554 {
555 Debug printf("CBaseFilter2::SetSyncSource() called\n");
556 return E_NOTIMPL;
557 }
558
559
560 long STDCALL CBaseFilter2::GetSyncSource (
561 IBaseFilter * This,
562 /* [out] */ IReferenceClock **pClock)
563 {
564 Debug printf("CBaseFilter2::GetSyncSource() called\n");
565 return E_NOTIMPL;
566 }
567
568
569 long STDCALL CBaseFilter2::EnumPins (
570 IBaseFilter * This,
571 /* [out] */ IEnumPins **ppEnum)
572 {
573 Debug printf("CBaseFilter2::EnumPins() called\n");
574 *ppEnum=new CEnumPins(((CBaseFilter2*)This)->pin);
575 return 0;
576 }
577
578
579 long STDCALL CBaseFilter2::FindPin (
580 IBaseFilter * This,
581 /* [string][in] */ const unsigned short* Id,
582 /* [out] */ IPin **ppPin)
583 {
584 Debug printf("CBaseFilter2::FindPin() called\n");
585 return E_NOTIMPL;
586 }
587
588
589 long STDCALL CBaseFilter2::QueryFilterInfo (
590 IBaseFilter * This,
591 // /* [out] */ FILTER_INFO *pInfo)
592 void* pInfo)
593 {
594 Debug printf("CBaseFilter2::QueryFilterInfo() called\n");
595 return E_NOTIMPL;
596 }
597
598
599 long STDCALL CBaseFilter2::JoinFilterGraph (
600 IBaseFilter * This,
601 /* [in] */ IFilterGraph *pGraph,
602 /* [string][in] */ const unsigned short* pName)
603 {
604 Debug printf("CBaseFilter2::JoinFilterGraph() called\n");
605 return E_NOTIMPL;
606 }
607
608
609 long STDCALL CBaseFilter2::QueryVendorInfo (
610 IBaseFilter * This,
611 /* [string][out] */ unsigned short* *pVendorInfo)
612 {
613 Debug printf("CBaseFilter2::QueryVendorInfo() called\n");
614 return E_NOTIMPL;
615 }
616
617 long STDCALL CRemotePin::ConnectionMediaType (
618 IPin * This,
619 /* [out] */ AM_MEDIA_TYPE *pmt)
620 {
621 Debug printf("CRemotePin::ConnectionMediaType() called\n");
622 return E_NOTIMPL;
623 }
624
625 long STDCALL CRemotePin::QueryPinInfo (
626 IPin * This,
627 /* [out] */ PIN_INFO *pInfo)
628 {
629 Debug printf("CRemotePin::QueryPinInfo() called\n");
630 pInfo->dir=PINDIR_INPUT;
631 CBaseFilter* parent=((CRemotePin*)This)->parent;
632 pInfo->pFilter=parent;
633 parent->vt->AddRef((IUnknown*)parent);
634 pInfo->achName[0]=0;
635 return 0;
636 }
637 long STDCALL CRemotePin2::QueryPinInfo (
638 IPin * This,
639 /* [out] */ PIN_INFO *pInfo)
640 {
641 Debug printf("CRemotePin2::QueryPinInfo called\n");
642 CBaseFilter2* parent=((CRemotePin2*)This)->parent;
643 pInfo->pFilter=(IBaseFilter*)parent;
644 parent->vt->AddRef((IUnknown*)parent);
645 pInfo->dir=PINDIR_OUTPUT;
646 pInfo->achName[0]=0;
647 return 0;
648 }
649 long STDCALL CRemotePin::ConnectedTo (
650 IPin * This,
651 /* [out] */ IPin **pPin)
652 {
653 Debug printf("CRemotePin::ConnectedTo called\n");
654 if(!pPin)return 0x80004003;
655 *pPin=((CRemotePin*)This)->remote_pin;
656 (*pPin)->vt->AddRef((IUnknown*)(*pPin));
657 return 0;
658 }
659 long STDCALL CRemotePin::QueryDirection (
660 IPin * This,
661 /* [out] */ PIN_DIRECTION *pPinDir)
662 {
663 Debug printf("CRemotePin::QueryDirection called\n");
664 if(!pPinDir)return 0x80004003;
665 *pPinDir=PINDIR_INPUT;
666 return 0;
667 }