annotate loader/dshow/outputpin.c @ 11536:017a7e90fcf1

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