annotate loader/dshow/outputpin.c @ 1975:93028c9ee819

ready
author gabucino
date Wed, 26 Sep 2001 23:48:12 +0000
parents da26060c81ef
children ce45cce7f7a5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
1 #include "outputpin.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
2 #include "allocator.h"
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
3 #include "iunk.h"
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
4 #include <wine/winerror.h>
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
5 #include <cstdio>
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
6 #include <cstring>
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
1063
269780d31b51 added missing 'using namespace std;' for gcc 3.0
arpi_esp
parents: 713
diff changeset
13 using namespace std;
269780d31b51 added missing 'using namespace std;' for gcc 3.0
arpi_esp
parents: 713
diff changeset
14
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
15 class CEnumMediaTypes: public IEnumMediaTypes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
16 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
17 public:
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18 AM_MEDIA_TYPE type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
19 static GUID interfaces[];
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
20 DECLARE_IUNKNOWN(CEnumMediaTypes)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
21 CEnumMediaTypes(const AM_MEDIA_TYPE&);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
22 ~CEnumMediaTypes() {delete vt;}
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
23 };
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
24
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
25 GUID CEnumMediaTypes::interfaces[]=
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
26 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 IID_IUnknown,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28 IID_IEnumMediaTypes,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
29 };
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
30
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
31 // IPin->IUnknown methods
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32 IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
33
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
34
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
35 static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
36 /* [in] */ ULONG cMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
37 /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
38 /* [out] */ ULONG *pcFetched)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
39 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
40 AM_MEDIA_TYPE& type=((CEnumMediaTypes*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
41 Debug printf("CEnumMediaTypes::Next() called\n");
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
42 if (!ppMediaTypes)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
43 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
44 if (!pcFetched && (cMediaTypes!=1))
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
45 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
46 if (cMediaTypes <= 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
47 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
48
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
49 if (pcFetched)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
50 *pcFetched=1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
51 ppMediaTypes[0] = (AM_MEDIA_TYPE *)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
52 memcpy(*ppMediaTypes, &type, sizeof(AM_MEDIA_TYPE));
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
53 if (ppMediaTypes[0]->pbFormat)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
54 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
55 ppMediaTypes[0]->pbFormat=(char *)CoTaskMemAlloc(ppMediaTypes[0]->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
56 memcpy(ppMediaTypes[0]->pbFormat, type.pbFormat, ppMediaTypes[0]->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
57 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
58 if (cMediaTypes == 1)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
59 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
60 return 1;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
63 /* I expect that these methods are unused. */
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
64 static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
65 /* [in] */ ULONG cMediaTypes)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
66 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
67 Debug printf("CEnumMediaTypes::Skip() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
68 return E_NOTIMPL;
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_Reset(IEnumMediaTypes * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
72 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
73 Debug printf("CEnumMediaTypes::Reset() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
74 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
75 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
76
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
77 static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
78 /* [out] */ IEnumMediaTypes **ppEnum)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
79 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
80 Debug printf("CEnumMediaTypes::Clone() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
81 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
82 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
83
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
84
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
85 CEnumMediaTypes::CEnumMediaTypes(const AM_MEDIA_TYPE& amtype)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
86 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
87 refcount = 1;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
88 type = amtype;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
89
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
90 vt = new IEnumMediaTypes_vt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
91 vt->QueryInterface = QueryInterface;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
92 vt->AddRef = AddRef;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
93 vt->Release = Release;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
94 vt->Next = CEnumMediaTypes_Next;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
95 vt->Skip = CEnumMediaTypes_Skip;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
96 vt->Reset = CEnumMediaTypes_Reset;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
97 vt->Clone = CEnumMediaTypes_Clone;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
98 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
99
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
100
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
101 static HRESULT STDCALL COutputPin_AddRef(IUnknown* This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
102 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
103 Debug printf("COutputPin_AddRef(%p) called (%d)\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
104 This, ((COutputPin*)This)->refcount);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
105 ((COutputPin*)This)->refcount++;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
106 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
107 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
108
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
109 static HRESULT STDCALL COutputPin_Release(IUnknown* This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
110 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
111 Debug printf("COutputPin_Release(%p) called (%d)\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
112 This, ((COutputPin*)This)->refcount);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
113 if (--((COutputPin*)This)->refcount<=0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
114 delete (COutputPin*)This;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
115
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
116 return 0;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
119 static HRESULT STDCALL COutputPin_M_AddRef(IUnknown* This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
120 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
121 COutputMemPin* p = (COutputMemPin*) This;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
122 Debug printf("COutputPin_MAddRef(%p) called (%p, %d)\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
123 p, p->parent, p->parent->refcount);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
124 p->parent->refcount++;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
125 return 0;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
128 static HRESULT STDCALL COutputPin_M_Release(IUnknown* This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
129 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
130 COutputMemPin* p = (COutputMemPin*) This;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
131 Debug printf("COutputPin_MRelease(%p) called (%p, %d)\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
132 p, p->parent, p->parent->refcount);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
133 if (--p->parent->refcount <= 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
134 delete p->parent;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
135 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
136 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
137
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
138 /* Implementation of output pin object. */
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139 // Constructor
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
140
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
141
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
142 static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
143 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
144 Debug printf("COutputPin_QueryInterface(%p) called\n", This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
145 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
146 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
147
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
148 COutputPin* p = (COutputPin*) This;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
149
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
150 if (memcmp(iid, &IID_IUnknown, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
151 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
152 *ppv = p;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
153 p->vt->AddRef(This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
154 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
155 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
156 if (memcmp(iid, &IID_IMemInputPin, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
157 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
158 *ppv = p->mempin;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
159 p->mempin->vt->AddRef((IUnknown*)*ppv);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
160 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
161 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
162
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
163 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-" \
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
164 "%02x%02x%02x%02x%02x%02x\n",
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
165 iid->f1, iid->f2, iid->f3,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
166 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
167 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
168 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
169 (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
170 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173 // IPin methods
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
174 static HRESULT STDCALL COutputPin_Connect(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
175 /* [in] */ IPin *pReceivePin,
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 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
178 Debug printf("COutputPin_Connect() called\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
179 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
180 *pmt=((COutputPin*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
181 if(pmt->cbFormat>0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
182 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
183 pmt->pbFormat=CoTaskMemAlloc(pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
184 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
185 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
186 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
187 //return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
188 return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
189 // if I put return 0; here, it crashes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
190 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
191
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
192 static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
193 /* [in] */ IPin *pConnector,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
194 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
195 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
196 Debug printf("COutputPin_ReceiveConnection() called\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
197 ((COutputPin*)This)->remote=pConnector;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
199 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
200
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
201 static HRESULT STDCALL COutputPin_Disconnect(IPin * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
202 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
203 Debug printf("COutputPin_Disconnect() called\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
204 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
205 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
206
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
207 static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
208 /* [out] */ IPin **pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
209 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
210 Debug printf("COutputPin_ConnectedTo() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
211 if (!pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
212 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
213 *pPin = ((COutputPin*)This)->remote;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
214 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
215 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
216
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
217 static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
218 /* [out] */ AM_MEDIA_TYPE *pmt)
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 Debug printf("CInputPin::ConnectionMediaType() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
221 if (!pmt)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
222 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
223 *pmt = ((COutputPin*)This)->type;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
224 if (pmt->cbFormat>0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
225 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
226 pmt->pbFormat=(char *)CoTaskMemAlloc(pmt->cbFormat);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
227 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
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 return 0;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
232 static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
233 /* [out] */ PIN_INFO *pInfo)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
234 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
235 Debug printf("COutputPin_QueryPinInfo() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
236 return E_NOTIMPL;
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_QueryDirection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
240 /* [out] */ PIN_DIRECTION *pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
241 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
242 Debug printf("COutputPin_QueryDirection() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
243 if (!pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
244 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
245 *pPinDir = PINDIR_INPUT;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
246 return 0;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
249 static HRESULT STDCALL COutputPin_QueryId(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
250 /* [out] */ LPWSTR *Id)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
251 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
252 Debug printf("COutputPin_QueryId() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
253 return E_NOTIMPL;
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
256 static HRESULT STDCALL COutputPin_QueryAccept(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
257 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
258 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
259 Debug printf("COutputPin_QueryAccept() called\n");
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_EnumMediaTypes(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
264 /* [out] */ IEnumMediaTypes **ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
265 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
266 Debug printf("COutputPin_EnumMediaTypes() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
267 if (!ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
268 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
269 *ppEnum=new CEnumMediaTypes(((COutputPin*)This)->type);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
270 return 0;
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_QueryInternalConnections(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
274 /* [out] */ IPin **apPin,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
275 /* [out][in] */ ULONG *nPin)
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 Debug printf("COutputPin_QueryInternalConnections() called\n");
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_EndOfStream(IPin * This)
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 Debug printf("COutputPin_EndOfStream() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
284 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
285 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
286
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
287 static HRESULT STDCALL COutputPin_BeginFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
288 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
289 Debug printf("COutputPin_BeginFlush() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
290 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
291 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
292
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
293 static HRESULT STDCALL COutputPin_EndFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
294 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
295 Debug printf("COutputPin_EndFlush() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
296 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
297 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
298
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
299 static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
300 /* [in] */ REFERENCE_TIME tStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
301 /* [in] */ REFERENCE_TIME tStop,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
302 /* [in] */ double dRate)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
303 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
304 Debug printf("COutputPin_NewSegment(%ld,%ld,%f) called\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
305 tStart, tStop, dRate);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
306 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
307 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
308
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
309
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
310
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
311 // IMemInputPin->IUnknown methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
312
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
313 static HRESULT STDCALL COutputPin_M_QueryInterface(IUnknown* This, GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
314 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
315 Debug printf("COutputPin_M_QueryInterface() called\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
316 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
317 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
318
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
319 COutputPin* p = (COutputPin*)This;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
320 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
321 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
322 *ppv=p;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
323 p->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
324 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
325 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
326 /*if(!memcmp(iid, &IID_IPin, 16))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
327 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
328 COutputPin* ptr=(COutputPin*)(This-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
329 *ppv=(void*)ptr;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
330 AddRef((IUnknown*)ptr);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
331 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
332 }*/
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
333 if(!memcmp(iid, &IID_IMemInputPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
334 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
335 *ppv=p->mempin;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
336 p->mempin->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
337 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
338 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
339 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
340 "%02x%02x%02x%02x%02x%02x\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
341 iid->f1, iid->f2, iid->f3,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
342 (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
343 (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
344 (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
345 (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
346 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
347 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
348
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
349 // IMemInputPin methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
350
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
351 static HRESULT STDCALL COutputPin_GetAllocator(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
352 /* [out] */ IMemAllocator **ppAllocator)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
353 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
354 Debug printf("COutputPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
355 *ppAllocator=new MemAllocator;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
356 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
357 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
358
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
359 static HRESULT STDCALL COutputPin_NotifyAllocator(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
360 /* [in] */ IMemAllocator *pAllocator,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
361 /* [in] */ int bReadOnly)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
362 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
363 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
364 ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
365 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
366 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
367
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
368 static HRESULT STDCALL COutputPin_GetAllocatorRequirements(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
369 /* [out] */ ALLOCATOR_PROPERTIES *pProps)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
370 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
371 Debug printf("COutputPin_GetAllocatorRequirements() called\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
372 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
373 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
374
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
375 static HRESULT STDCALL COutputPin_Receive(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
376 /* [in] */ IMediaSample *pSample)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
377 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
378 Debug printf("COutputPin_Receive(%p) called\n", This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
379 if (!pSample)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
380 return E_INVALIDARG;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
381 char* pointer;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
382 if (pSample->vt->GetPointer(pSample, (BYTE **)&pointer))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
383 return -1;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
384 int len = pSample->vt->GetActualDataLength(pSample);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
385 if (len == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
386 len = pSample->vt->GetSize(pSample);//for iv50
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
387 //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
388
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
389 COutputMemPin* mp= (COutputMemPin*)This;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
390 if (mp->frame_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
391 *(mp->frame_pointer) = pointer;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
392 if (mp->frame_size_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
393 *(mp->frame_size_pointer) = len;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
394 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
395 FILE* file=fopen("./uncompr.bmp", "wb");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
396 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
397 *(int*)(&head[2])=len+0x36;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
398 fwrite(head, 14, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
399 fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
400 fwrite(pointer, len, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
401 fclose(file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
402 */
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
403 // pSample->vt->Release((IUnknown*)pSample);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
404 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
405 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
406
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
407 static HRESULT STDCALL COutputPin_ReceiveMultiple(IMemInputPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
408 /* [size_is][in] */ IMediaSample **pSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
409 /* [in] */ long nSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
410 /* [out] */ long *nSamplesProcessed)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
411 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
412 Debug printf("COutputPin_ReceiveMultiple() called (UNIMPLEMENTED)\n");
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
413 return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
414 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
415
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
416 static HRESULT STDCALL COutputPin_ReceiveCanBlock(IMemInputPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
417 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
418 Debug printf("COutputPin_ReceiveCanBlock() called (UNIMPLEMENTED)\n");
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
419 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
420 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
421
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
422 COutputPin::COutputPin(const AM_MEDIA_TYPE& vh)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
423 :refcount(1), type(vh), remote(0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
424 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
425 vt = new IPin_vt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
426 vt->QueryInterface = COutputPin_QueryInterface;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
427 vt->AddRef = COutputPin_AddRef;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
428 vt->Release = COutputPin_Release;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
429 vt->Connect = COutputPin_Connect;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
430 vt->ReceiveConnection = COutputPin_ReceiveConnection;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
431 vt->Disconnect = COutputPin_Disconnect;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
432 vt->ConnectedTo = COutputPin_ConnectedTo;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
433 vt->ConnectionMediaType = COutputPin_ConnectionMediaType;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
434 vt->QueryPinInfo = COutputPin_QueryPinInfo;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
435 vt->QueryDirection = COutputPin_QueryDirection;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
436 vt->QueryId = COutputPin_QueryId;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
437 vt->QueryAccept = COutputPin_QueryAccept;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
438 vt->EnumMediaTypes = COutputPin_EnumMediaTypes;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
439 vt->QueryInternalConnections = COutputPin_QueryInternalConnections;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
440 vt->EndOfStream = COutputPin_EndOfStream;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
441 vt->BeginFlush = COutputPin_BeginFlush;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
442 vt->EndFlush = COutputPin_EndFlush;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
443 vt->NewSegment = COutputPin_NewSegment;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
444
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
445 mempin = new COutputMemPin;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
446 mempin->vt = new IMemInputPin_vt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
447 mempin->vt->QueryInterface = COutputPin_M_QueryInterface;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
448 mempin->vt->AddRef = COutputPin_M_AddRef;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
449 mempin->vt->Release = COutputPin_M_Release;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
450 mempin->vt->GetAllocator = COutputPin_GetAllocator;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
451 mempin->vt->NotifyAllocator = COutputPin_NotifyAllocator;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
452 mempin->vt->GetAllocatorRequirements = COutputPin_GetAllocatorRequirements;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
453 mempin->vt->Receive = COutputPin_Receive;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
454 mempin->vt->ReceiveMultiple = COutputPin_ReceiveMultiple;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
455 mempin->vt->ReceiveCanBlock = COutputPin_ReceiveCanBlock;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
456
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
457 mempin->frame_size_pointer = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
458 mempin->frame_pointer = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
459 mempin->pAllocator = 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
460 mempin->parent = this;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
461 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
462
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
463 COutputPin::~COutputPin()
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
464 {
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
465 delete vt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
466 delete mempin->vt;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
467 }