annotate loader/dshow/outputpin.c @ 2226:9582af160d04

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