annotate loader/dshow/outputpin.c @ 5067:54fe37e1f1a7

some cleanup, fixes for video header parsing. finally we get the coded size instead of display size\!
author arpi
date Thu, 14 Mar 2002 02:26:49 +0000
parents e3bbf44dbab2
children 174e2a58b4cd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
2 #include "wine/winerror.h"
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
3 #include "wine/windef.h"
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
4 #include "outputpin.h"
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
5 #include <stdio.h>
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
6 #include <string.h>
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
7
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
8 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9 An object beyond interface IEnumMediaTypes.
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 Returned by COutputPin through call IPin::EnumMediaTypes().
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
11 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
12
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
13 static int unimplemented(const char* s, void* p)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
14 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
15 Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
16 return E_NOTIMPL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
17 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
18
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
19 typedef struct CEnumMediaTypes
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
20 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
21 IEnumMediaTypes_vt* vt;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
22 DECLARE_IUNKNOWN();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
23 AM_MEDIA_TYPE type;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
24 GUID interfaces[2];
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
25 } CEnumMediaTypes;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
26
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
28 static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
29 /* [in] */ ULONG cMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
30 /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
31 /* [out] */ ULONG *pcFetched)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
33 AM_MEDIA_TYPE* type = &((CEnumMediaTypes*)This)->type;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
34 Debug printf("CEnumMediaTypes::Next(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
35 if (!ppMediaTypes)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
36 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
37 if (!pcFetched && (cMediaTypes!=1))
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
38 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
39 if (cMediaTypes <= 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
40 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
41
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
42 if (pcFetched)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
43 *pcFetched=1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
44 ppMediaTypes[0] = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
45 // copy structures - C can handle this...
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
46 **ppMediaTypes = *type;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
47 if (ppMediaTypes[0]->pbFormat)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
48 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
49 ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
50 memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
51 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
52 if (cMediaTypes == 1)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
53 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
54 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
55 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
56
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
57 /* I expect that these methods are unused. */
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
58 static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
59 /* [in] */ ULONG cMediaTypes)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
60 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
61 Debug unimplemented("CEnumMediaTypes::Skip", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
62 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
63 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
64
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
65 static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
66 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
67 Debug printf("CEnumMediaTypes::Reset(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
68 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
70
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
71 static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
72 /* [out] */ IEnumMediaTypes **ppEnum)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
73 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
74 Debug printf("CEnumMediaTypes::Clone(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
75 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
76 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
77
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
78 void CEnumMediaTypes_Destroy(CEnumMediaTypes* This)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
79 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
80 free(This->vt);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
81 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
82 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
83
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
84 // IPin->IUnknown methods
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
85 IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
86
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
87 CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
88 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
89 CEnumMediaTypes *This = (CEnumMediaTypes*) malloc(sizeof(CEnumMediaTypes)) ;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
90
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
91 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
92 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
93
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
94 This->vt = (IEnumMediaTypes_vt*) malloc(sizeof(IEnumMediaTypes_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
95 if (!This->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
96 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
97 free(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
98 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
99 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
100
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
101 This->refcount = 1;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
102 This->type = *amt;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
103
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
104 This->vt->QueryInterface = CEnumMediaTypes_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
105 This->vt->AddRef = CEnumMediaTypes_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
106 This->vt->Release = CEnumMediaTypes_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
107 This->vt->Next = CEnumMediaTypes_Next;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
108 This->vt->Skip = CEnumMediaTypes_Skip;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
109 This->vt->Reset = CEnumMediaTypes_Reset;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
110 This->vt->Clone = CEnumMediaTypes_Clone;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
111
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
112 This->interfaces[0] = IID_IUnknown;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
113 This->interfaces[1] = IID_IEnumMediaTypes;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
114
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
115 return This;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
116 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
117
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
118
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
119 /*************
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
120 * COutputPin
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
121 *************/
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
122
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
123
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
124 static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
125 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
126 COutputPin* p = (COutputPin*) This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
127
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
128 Debug printf("COutputPin_QueryInterface(%p) called\n", This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
129 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
130 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
131
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
132 if (memcmp(iid, &IID_IUnknown, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
133 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
134 *ppv = p;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
135 p->vt->AddRef(This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
136 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
137 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
138 if (memcmp(iid, &IID_IMemInputPin, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
140 *ppv = p->mempin;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
141 p->mempin->vt->AddRef((IUnknown*)*ppv);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
142 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
143 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
144
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
145 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-"
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
146 "%02x%02x%02x%02x%02x%02x\n",
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
147 iid->f1, iid->f2, iid->f3,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
148 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
149 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
150 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
151 (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
152 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
153 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
154
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
155 // IPin methods
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
156 static HRESULT STDCALL COutputPin_Connect(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
157 /* [in] */ IPin *pReceivePin,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
158 /* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
159 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
160 Debug printf("COutputPin_Connect() called\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
161 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
162 *pmt=((COutputPin*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
163 if(pmt->cbFormat>0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
164 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
165 pmt->pbFormat=CoTaskMemAlloc(pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
166 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
167 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
168 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
169 //return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
170 return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 // if I put return 0; here, it crashes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
174 static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
175 /* [in] */ IPin *pConnector,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
176 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
177 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
178 Debug printf("COutputPin_ReceiveConnection(%p) called\n", This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
179 ((COutputPin*)This)->remote = pConnector;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
180 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
181 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
182
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
183 static HRESULT STDCALL COutputPin_Disconnect(IPin * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
184 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
185 Debug printf("COutputPin_Disconnect(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
186 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
187 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
188
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
189 static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
190 /* [out] */ IPin **pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
191 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
192 Debug printf("COutputPin_ConnectedTo(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
193 if (!pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
194 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
195 *pPin = ((COutputPin*)This)->remote;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
196 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
197 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
199 static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
200 /* [out] */ AM_MEDIA_TYPE *pmt)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
201 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
202 Debug printf("CInputPin::ConnectionMediaType() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
203 if (!pmt)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
204 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
205 *pmt = ((COutputPin*)This)->type;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
206 if (pmt->cbFormat>0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
207 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
208 pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
209 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
210 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
211 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
212 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
213
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
214 static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
215 /* [out] */ PIN_INFO *pInfo)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
216 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
217 Debug unimplemented("COutputPin_QueryPinInfo", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
218 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
219 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
220
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
221 static HRESULT STDCALL COutputPin_QueryDirection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
222 /* [out] */ PIN_DIRECTION *pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
223 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
224 Debug printf("COutputPin_QueryDirection(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
225 if (!pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
226 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
227 *pPinDir = PINDIR_INPUT;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
228 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
229 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
230
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
231 static HRESULT STDCALL COutputPin_QueryId(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
232 /* [out] */ LPWSTR *Id)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
233 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
234 Debug unimplemented("COutputPin_QueryId", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
235 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
236 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
237
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
238 static HRESULT STDCALL COutputPin_QueryAccept(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
239 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
240 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
241 Debug unimplemented("COutputPin_QueryAccept", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
242 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
243 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
244
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
245 static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
246 /* [out] */ IEnumMediaTypes **ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
247 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
248 Debug printf("COutputPin_EnumMediaTypes() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
249 if (!ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
250 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
251 *ppEnum = (IEnumMediaTypes*) CEnumMediaTypesCreate(&((COutputPin*)This)->type);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
252 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
253 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
254
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
255 static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
256 /* [out] */ IPin **apPin,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
257 /* [out][in] */ ULONG *nPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
258 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
259 Debug unimplemented("COutputPin_QueryInternalConnections", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
260 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
261 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
262
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
263 static HRESULT STDCALL COutputPin_EndOfStream(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
264 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
265 Debug unimplemented("COutputPin_EndOfStream", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
266 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
267 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
268
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
269 static HRESULT STDCALL COutputPin_BeginFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
270 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
271 Debug unimplemented("COutputPin_BeginFlush", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
272 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
273 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
274
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
275 static HRESULT STDCALL COutputPin_EndFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
276 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
277 Debug unimplemented("COutputPin_EndFlush", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
278 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
279 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
280
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
281 static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
282 /* [in] */ REFERENCE_TIME tStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
283 /* [in] */ REFERENCE_TIME tStop,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
284 /* [in] */ double dRate)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
285 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
286 Debug printf("COutputPin_NewSegment(%Ld,%Ld,%f) called\n",
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
287 tStart, tStop, dRate);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
288 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
289 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
290
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
291
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
292
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
293 // IMemInputPin->IUnknown methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
294
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
295 static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
296 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
297 COutputPin* p = (COutputPin*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
298
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
299 Debug printf("COutputPin_M_QueryInterface(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
300 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
301 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
302
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
303 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
304 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
305 *ppv = p;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
306 p->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
307 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
308 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
309 /*if(!memcmp(iid, &IID_IPin, 16))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
310 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
311 COutputPin* ptr=(COutputPin*)(This-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
312 *ppv=(void*)ptr;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
313 AddRef((IUnknown*)ptr);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
314 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
315 }*/
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
316 if(!memcmp(iid, &IID_IMemInputPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
317 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
318 *ppv = p->mempin;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
319 p->mempin->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
320 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
321 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
322 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
323 "%02x%02x%02x%02x%02x%02x\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
324 iid->f1, iid->f2, iid->f3,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
325 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
326 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
327 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
328 (unsigned char)iid->f4[6], (unsigned char)iid->f4[7]);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
329 return E_NOINTERFACE;
168
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 // IMemInputPin methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
333
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
334 static HRESULT STDCALL COutputPin_GetAllocator(IMemInputPin* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
335 /* [out] */ IMemAllocator** ppAllocator)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
336 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
337 Debug printf("COutputPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
338 *ppAllocator = (IMemAllocator*) MemAllocatorCreate();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
339 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
340 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
341
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
342 static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
343 /* [in] */ IMemAllocator* pAllocator,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
344 /* [in] */ int bReadOnly)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
345 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
346 Debug printf("COutputPin_NotifyAllocator(%p, %p) called\n", This, pAllocator);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
347 ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
348 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
349 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
350
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
351 static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
352 /* [out] */ ALLOCATOR_PROPERTIES* pProps)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
353 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
354 Debug unimplemented("COutputPin_GetAllocatorRequirements", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
355 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
356 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
357
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
358 static HRESULT STDCALL COutputPin_Receive(IMemInputPin* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
359 /* [in] */ IMediaSample* pSample)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
360 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
361 COutputMemPin* mp = (COutputMemPin*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
362 char* pointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
363 int len;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
364
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
365 Debug printf("COutputPin_Receive(%p) called\n", This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
366 if (!pSample)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
367 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
368 if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
369 return -1;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
370 len = pSample->vt->GetActualDataLength(pSample);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
371 if (len == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
372 len = pSample->vt->GetSize(pSample);//for iv50
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
373 //if(me.frame_pointer)memcpy(me.frame_pointer, pointer, len);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
374
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
375 if (mp->frame_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
376 *(mp->frame_pointer) = pointer;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
377 if (mp->frame_size_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
378 *(mp->frame_size_pointer) = len;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
379 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
380 FILE* file=fopen("./uncompr.bmp", "wb");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
381 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
382 *(int*)(&head[2])=len+0x36;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
383 fwrite(head, 14, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
384 fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
385 fwrite(pointer, len, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
386 fclose(file);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
387 */
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
388 // pSample->vt->Release((IUnknown*)pSample);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
389
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
390 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
391 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
392
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
393 static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
394 /* [size_is][in] */ IMediaSample **pSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
395 /* [in] */ long nSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
396 /* [out] */ long *nSamplesProcessed)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
397 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
398 Debug unimplemented("COutputPin_ReceiveMultiple", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
399 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
400 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
401
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
402 static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
403 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
404 Debug unimplemented("COutputPin_ReceiveCanBlock", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
405 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
406 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
407
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
408 static void COutputPin_SetFramePointer(COutputPin* This, char** z)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
409 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
410 This->mempin->frame_pointer = z;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
411 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
412
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
413 static void COutputPin_SetPointer2(COutputPin* This, char* p)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
414 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
415 if (This->mempin->pAllocator)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
416 // fixme
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
417 This->mempin->pAllocator->SetPointer(This->mempin->pAllocator, p);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
418 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
419
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
420 static void COutputPin_SetFrameSizePointer(COutputPin* This, long* z)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
421 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
422 This->mempin->frame_size_pointer = z;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
423 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
424
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
425 static void COutputPin_SetNewFormat(COutputPin* This, const AM_MEDIA_TYPE* amt)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
426 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
427 This->type = *amt;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
428 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
429
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
430 static void COutputPin_Destroy(COutputPin* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
431 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
432 if (This->mempin->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
433 free(This->mempin->vt);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
434 if (This->mempin)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
435 free(This->mempin);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
436 if (This->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
437 free(This->vt);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
438 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
439 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
440
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
441 static HRESULT STDCALL COutputPin_AddRef(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
442 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
443 Debug printf("COutputPin_AddRef(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
444 ((COutputPin*)This)->refcount++;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
445 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
446 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
447
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
448 static HRESULT STDCALL COutputPin_Release(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
449 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
450 Debug printf("COutputPin_Release(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
451 if (--((COutputPin*)This)->refcount <= 0)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
452 COutputPin_Destroy((COutputPin*)This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
453
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
454 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
455 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
456
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
457 static HRESULT STDCALL COutputPin_M_AddRef(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
458 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
459 COutputMemPin* p = (COutputMemPin*) This;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
460 Debug printf("COutputPin_MAddRef(%p) called (%p, %d)\n", p, p->parent, p->parent->refcount);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
461 p->parent->refcount++;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
462 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
463 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
464
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
465 static HRESULT STDCALL COutputPin_M_Release(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
466 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
467 COutputMemPin* p = (COutputMemPin*) This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
468 Debug printf("COutputPin_MRelease(%p) called (%p, %d)\n",
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
469 p, p->parent, p->parent->refcount);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
470 if (--p->parent->refcount <= 0)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
471 COutputPin_Destroy(p->parent);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
472 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
473 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
474
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
475 COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
476 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
477 COutputPin* This = (COutputPin*) malloc(sizeof(COutputPin));
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
478 IMemInputPin_vt* ivt;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
479
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
480 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
481 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
482
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
483 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
484 This->mempin = (COutputMemPin*) malloc(sizeof(COutputMemPin));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
485 ivt = (IMemInputPin_vt*) malloc(sizeof(IMemInputPin_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
486
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
487 if (!This->vt || !This->mempin || !ivt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
488 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
489 COutputPin_Destroy(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
490 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
491 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
492
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
493 This->mempin->vt = ivt;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
494
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
495 This->refcount = 1;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
496 This->remote = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
497 This->type = *amt;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
498
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
499 This->vt->QueryInterface = COutputPin_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
500 This->vt->AddRef = COutputPin_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
501 This->vt->Release = COutputPin_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
502 This->vt->Connect = COutputPin_Connect;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
503 This->vt->ReceiveConnection = COutputPin_ReceiveConnection;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
504 This->vt->Disconnect = COutputPin_Disconnect;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
505 This->vt->ConnectedTo = COutputPin_ConnectedTo;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
506 This->vt->ConnectionMediaType = COutputPin_ConnectionMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
507 This->vt->QueryPinInfo = COutputPin_QueryPinInfo;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
508 This->vt->QueryDirection = COutputPin_QueryDirection;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
509 This->vt->QueryId = COutputPin_QueryId;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
510 This->vt->QueryAccept = COutputPin_QueryAccept;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
511 This->vt->EnumMediaTypes = COutputPin_EnumMediaTypes;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
512 This->vt->QueryInternalConnections = COutputPin_QueryInternalConnections;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
513 This->vt->EndOfStream = COutputPin_EndOfStream;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
514 This->vt->BeginFlush = COutputPin_BeginFlush;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
515 This->vt->EndFlush = COutputPin_EndFlush;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
516 This->vt->NewSegment = COutputPin_NewSegment;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
517
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
518 This->mempin->vt->QueryInterface = COutputPin_M_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
519 This->mempin->vt->AddRef = COutputPin_M_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
520 This->mempin->vt->Release = COutputPin_M_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
521 This->mempin->vt->GetAllocator = COutputPin_GetAllocator;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
522 This->mempin->vt->NotifyAllocator = COutputPin_NotifyAllocator;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
523 This->mempin->vt->GetAllocatorRequirements = COutputPin_GetAllocatorRequirements;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
524 This->mempin->vt->Receive = COutputPin_Receive;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
525 This->mempin->vt->ReceiveMultiple = COutputPin_ReceiveMultiple;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
526 This->mempin->vt->ReceiveCanBlock = COutputPin_ReceiveCanBlock;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
527
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
528 This->mempin->frame_size_pointer = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
529 This->mempin->frame_pointer = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
530 This->mempin->pAllocator = 0;
3130
623cdb771e97 avifile sync. seems to some bugs fixed...
arpi
parents: 3056
diff changeset
531 This->mempin->refcount = 1;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
532 This->mempin->parent = This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
533
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
534 This->SetPointer2 = COutputPin_SetPointer2;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
535 This->SetFramePointer = COutputPin_SetFramePointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
536 This->SetFrameSizePointer = COutputPin_SetFrameSizePointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
537 This->SetNewFormat = COutputPin_SetNewFormat;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
538
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
539 return This;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
540 }