annotate loader/dshow/outputpin.c @ 22251:f2f62540bd0d

smil over realrtsp
author rtogni
date Sun, 18 Feb 2007 22:57:47 +0000
parents 0421ee482f38
children 3d1b23cf3d08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
1 /*
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
2 * Modified for use with MPlayer, detailed changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
3 * http://svn.mplayerhq.hu/mplayer/trunk/
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
4 * $Id$
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
5 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
6
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
7 #include "wine/winerror.h"
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
8 #include "wine/windef.h"
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
9 #include "outputpin.h"
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
10 #include <stdio.h>
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
11 #include <string.h>
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
12 #include <stdlib.h>
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
13
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
14 static inline int output_unimplemented(const char* s, void* p)
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
15 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
16 Debug printf("%s(%p) called (UNIMPLEMENTED)", s, p);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
17 return E_NOTIMPL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
18 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
19
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
20 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
21 An object beyond interface IEnumMediaTypes.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
22 Returned by COutputPin through call IPin::EnumMediaTypes().
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
23 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
24 typedef struct CEnumMediaTypes
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
25 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
26 IEnumMediaTypes_vt* vt;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
27 DECLARE_IUNKNOWN();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28 AM_MEDIA_TYPE type;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
29 GUID interfaces[2];
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
30 } CEnumMediaTypes;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
31
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
32 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
33 IMemOutput interface implementation
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
34 */
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
35 struct _COutputMemPin
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
36 {
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
37 IMemInputPin_vt* vt;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
38 DECLARE_IUNKNOWN();
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
39 char** frame_pointer;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
40 long* frame_size_pointer;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
41 MemAllocator* pAllocator;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
42 COutputPin* parent;
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
43 };
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
44
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
45 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
46 * \brief IEnumMediaTypes:Next (retrives a specified number of media types )
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
47 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
48 * \param[in] This pointer to CEnumMediaTypes object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
49 * \param[in] cMediaTypes number of media types to retrive
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
50 * \param[out] ppMediaTypes array of AM_MEDIA_TYPE structure pointers of size cMediaTypes
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
51 * \param[out] pcFetched address of variables that receives number of returned media types
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
52 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
53 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
54 * \return S_FALSE - did not return as meny structures as requested
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
55 * \return E_INVALIDARG Invalid argument
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
56 * \return E_POINTER Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
57 * \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
58 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
59 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
60 static HRESULT STDCALL CEnumMediaTypes_Next(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
61 /* [in] */ ULONG cMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
62 /* [size_is][out] */ AM_MEDIA_TYPE **ppMediaTypes,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
63 /* [out] */ ULONG *pcFetched)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
64 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
65 AM_MEDIA_TYPE* type = &((CEnumMediaTypes*)This)->type;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
66 Debug printf("CEnumMediaTypes::Next(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
67 if (!ppMediaTypes)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
68 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
69 if (!pcFetched && (cMediaTypes!=1))
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
70 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
71 if (cMediaTypes <= 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
72 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
73
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
74 if (pcFetched)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
75 *pcFetched=1;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
76 ppMediaTypes[0] = malloc(sizeof(AM_MEDIA_TYPE));
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
77 // copy structures - C can handle this...
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
78 **ppMediaTypes = *type;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
79 if (ppMediaTypes[0]->pbFormat)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
80 {
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
81 ppMediaTypes[0]->pbFormat=malloc(ppMediaTypes[0]->cbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
82 memcpy(ppMediaTypes[0]->pbFormat, type->pbFormat, ppMediaTypes[0]->cbFormat);
168
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 if (cMediaTypes == 1)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
85 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
86 return 1;
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 /* I expect that these methods are unused. */
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
90
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
91 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
92 * \brief IEnumMediaTypes::Skip (skips over a specified number of media types)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
93 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
94 * \param[in] This pointer to CEnumMEdiaTypes object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
95 * \param[in] cMediaTypes number of media types to skip
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
96 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
97 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
98 * \return S_FALSE - skipped past the end of the sequence
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
99 * \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
100 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
101 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
102 static HRESULT STDCALL CEnumMediaTypes_Skip(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
103 /* [in] */ ULONG cMediaTypes)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
104 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
105 return output_unimplemented("CEnumMediaTypes::Skip", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
106 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
107
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
108 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
109 * \brief IEnumMediaTypes::Reset (resets enumeration sequence to beginning)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
110 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
111 * \param[in] This pointer to CEnumMEdiaTypes object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
112 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
113 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
114 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
115 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
116 static HRESULT STDCALL CEnumMediaTypes_Reset(IEnumMediaTypes * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
117 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
118 Debug printf("CEnumMediaTypes::Reset(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
119 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
120 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
121
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
122 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
123 * \brief IEnumMediaTypes::Clone (makes a copy of enumerator, returned object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
124 * starts at the same position as original)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
125 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
126 * \param[in] This pointer to CEnumMEdiaTypes object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
127 * \param[out] ppEnum address of variable that receives pointer to IEnumMediaTypes interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
128 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
129 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
130 * \return E_OUTOFMEMRY - Insufficient memory
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
131 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
132 * \return VFW_E_ENUM_OUT_OF_SYNC - pin's state has changed and is now inconsistent with enumerator
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
133 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
134 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
135 static HRESULT STDCALL CEnumMediaTypes_Clone(IEnumMediaTypes * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
136 /* [out] */ IEnumMediaTypes **ppEnum)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
137 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
138 Debug printf("CEnumMediaTypes::Clone(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
140 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
141
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
142 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
143 * \brief CEnumMediaTypes destructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
144 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
145 * \param[in] This pointer to CEnumMediaTypes object
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
146 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
147 */
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
148 static void CEnumMediaTypes_Destroy(CEnumMediaTypes* This)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
149 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
150 free(This->vt);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
151 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
152 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
153
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
154 // IEnumMediaTypes->IUnknown methods
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
155 IMPLEMENT_IUNKNOWN(CEnumMediaTypes)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
156
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
157 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
158 * \brief CEnumMediaTypes constructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
159 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
160 * \param[in] amt media type for enumerating
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
161 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
162 * \return pointer to CEnumMEdiaTypes object or NULL if error occured
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
163 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
164 */
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
165 static CEnumMediaTypes* CEnumMediaTypesCreate(const AM_MEDIA_TYPE* amt)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
166 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
167 CEnumMediaTypes *This = (CEnumMediaTypes*) malloc(sizeof(CEnumMediaTypes)) ;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
168
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
169 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
170 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
171
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
172 This->vt = (IEnumMediaTypes_vt*) malloc(sizeof(IEnumMediaTypes_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
173 if (!This->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
174 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
175 free(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
176 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
177 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
178
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
179 This->refcount = 1;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
180 This->type = *amt;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
181
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
182 This->vt->QueryInterface = CEnumMediaTypes_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
183 This->vt->AddRef = CEnumMediaTypes_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
184 This->vt->Release = CEnumMediaTypes_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
185 This->vt->Next = CEnumMediaTypes_Next;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
186 This->vt->Skip = CEnumMediaTypes_Skip;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
187 This->vt->Reset = CEnumMediaTypes_Reset;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
188 This->vt->Clone = CEnumMediaTypes_Clone;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
189
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
190 This->interfaces[0] = IID_IUnknown;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
191 This->interfaces[1] = IID_IEnumMediaTypes;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
192
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
193 return This;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
194 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
195
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
196
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
197 /*************
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
198 * COutputPin
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
199 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
200 * WARNING:
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
201 * This is implementation of INPUT pin in DirectShow's terms
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
202 *
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
203 *************/
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
204
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
205
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
206 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
207 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
208 * \brief IUnknown::QueryInterface (query object for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
209 * \param[in] This pointer to IUnknown interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
210 * \param[in] iid GUID of requested interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
211 * \param[out] ppv receives pointer to interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
212 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
213 * \return S_OK - success (and *ppv contains valid pointer)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
214 * \return E_NOINTERFACE - interface not found (and *ppv was set NULL)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
215 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
216 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
217 * Make sure to call Release on received interface when you are done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
218 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
219 */
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
220 static HRESULT STDCALL COutputPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
221 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
222 COutputPin* p = (COutputPin*) This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
223
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
224 Debug printf("COutputPin_QueryInterface(%p) called\n", This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
225 if (!ppv)
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
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
228 if (memcmp(iid, &IID_IUnknown, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
229 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
230 *ppv = p;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
231 p->vt->AddRef(This);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
232 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
233 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
234 if (memcmp(iid, &IID_IMemInputPin, 16) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
235 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
236 *ppv = p->mempin;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
237 p->mempin->vt->AddRef((IUnknown*)*ppv);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
238 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
239 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
240
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
241 Debug printf("Unknown interface : %08x-%04x-%04x-%02x%02x-"
713
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
242 "%02x%02x%02x%02x%02x%02x\n",
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
243 iid->f1, iid->f2, iid->f3,
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
244 (unsigned char)iid->f4[1], (unsigned char)iid->f4[0],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
245 (unsigned char)iid->f4[2], (unsigned char)iid->f4[3],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
246 (unsigned char)iid->f4[4], (unsigned char)iid->f4[5],
9355b2ae634e avifile-0.6-CVS merge
arpi_esp
parents: 168
diff changeset
247 (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
248 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
249 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
250
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
251 // IPin methods
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
252
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
253 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
254 * \brief IPin::Connect (connects pin to another pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
255 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
256 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
257 * \param[in] pReceivePin pointer to IPin interface of remote pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
258 * \param[in] pmt suggested media type for link. Can be NULL (any media type)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
259 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
260 * \return S_OK - success.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
261 * \return VFW_E_ALREADY_CONNECTED - pin already connected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
262 * \return VFW_E_NOT_STOPPED - filter is active
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
263 * \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
264 * \return Apropriate error code otherwise.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
265 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
266 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
267 static HRESULT STDCALL COutputPin_Connect(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
268 /* [in] */ IPin *pReceivePin,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
269 /* [in] */ /* const */ AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
270 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
271 Debug printf("COutputPin_Connect(%p) called\n",This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
272 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
273 *pmt=((COutputPin*)This)->type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
274 if(pmt->cbFormat>0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
275 {
9964
6454a2ba2e33 CoTaskMemAlloc/Free vs malloc/free cleanup
alex
parents: 8292
diff changeset
276 pmt->pbFormat=malloc(pmt->cbFormat);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
277 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
278 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
279 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
280 //return E_NOTIMPL;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
281 return 0;// XXXXXXXXXXXXX CHECKME XXXXXXXXXXXXXXX
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
282 // if I put return 0; here, it crashes
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
283 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
284
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
285 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
286 * \brief IPin::ReceiveConnection (accepts a connection from another pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
287 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
288 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
289 * \param[in] pConnector connecting pin's IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
290 * \param[in] pmt suggested media type for connection
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
291 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
292 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
293 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
294 * \return VFW_E_ALREADY_CONNECTED - pin already connected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
295 * \return VFW_E_NOT_STOPPED - filter is active
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
296 * \return VFW_E_TYPE_NOT_ACCEPT - type is not acceptable
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
297 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
298 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
299 * When returning S_OK method should also do the following:
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
300 * - store media type and return the same type in IPin::ConnectionMediaType
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
301 * - store pConnector and return it in IPin::ConnectedTo
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
302 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
303 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
304 static HRESULT STDCALL COutputPin_ReceiveConnection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
305 /* [in] */ IPin *pConnector,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
306 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
307 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
308 Debug printf("COutputPin_ReceiveConnection(%p) called\n", This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
309 ((COutputPin*)This)->remote = pConnector;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
310 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
311 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
312
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
313 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
314 * \brief IPin::Disconnect (accepts a connection from another pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
315 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
316 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
317 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
318 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
319 * \return S_FALSE - pin was not connected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
320 * \return VFW_E_NOT_STOPPED - filter is active
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
321 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
322 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
323 * To break connection you have to also call Disconnect on other pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
324 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
325 static HRESULT STDCALL COutputPin_Disconnect(IPin * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
326 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
327 Debug printf("COutputPin_Disconnect(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
328 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
329 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
330
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
331 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
332 * \brief IPin::ConnectedTo (retrieves pointer to the connected pin, if such exist)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
333 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
334 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
335 * \param[out] pPin pointer to remote pin's IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
336 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
337 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
338 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
339 * \return VFW_E_NOT_CONNECTED - pin is not connected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
340 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
341 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
342 * Caller must call Release on received IPin, when done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
343 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
344 static HRESULT STDCALL COutputPin_ConnectedTo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
345 /* [out] */ IPin **pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
346 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
347 Debug printf("COutputPin_ConnectedTo(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
348 if (!pPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
349 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
350 *pPin = ((COutputPin*)This)->remote;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
351 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
352 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
353
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
354 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
355 * \brief IPin::ConnectionMediaType (retrieves media type for connection, if such exist)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
356 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
357 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
358 * \param[out] pmt pointer to AM_MEDIA_TYPE, that receives connection media type
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
359 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
360 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
361 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
362 * \return VFW_E_NOT_CONNECTED - pin is not connected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
363 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
364 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
365 static HRESULT STDCALL COutputPin_ConnectionMediaType(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
366 /* [out] */ AM_MEDIA_TYPE *pmt)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
367 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
368 Debug printf("COutputPin_ConnectionMediaType(%p) called\n",This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
369 if (!pmt)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
370 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
371 *pmt = ((COutputPin*)This)->type;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
372 if (pmt->cbFormat>0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
373 {
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
374 pmt->pbFormat=malloc(pmt->cbFormat);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
375 memcpy(pmt->pbFormat, ((COutputPin*)This)->type.pbFormat, pmt->cbFormat);
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
376 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
377 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
378 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
379
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
380 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
381 * \brief IPin::QueryPinInfo (retrieves information about the pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
382 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
383 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
384 * \param[out] pInfo pointer to PIN_INFO structure, that receives pin info
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
385 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
386 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
387 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
388 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
389 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
390 * If pInfo->pFilter is not NULL, then caller must call Release on pInfo->pFilter when done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
391 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
392 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
393 static HRESULT STDCALL COutputPin_QueryPinInfo(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
394 /* [out] */ PIN_INFO *pInfo)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
395 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
396 return output_unimplemented("COutputPin_QueryPinInfo", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
397 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
398
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
399 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
400 * \brief IPin::QueryDirection (retrieves pin direction)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
401 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
402 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
403 * \param[out] pPinDir pointer to variable, that receives pin direction (PINDIR_INPUT,PINDIR_OUTPUT)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
404 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
405 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
406 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
407 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
408 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
409 static HRESULT STDCALL COutputPin_QueryDirection(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
410 /* [out] */ PIN_DIRECTION *pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
411 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
412 Debug printf("COutputPin_QueryDirection(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
413 if (!pPinDir)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
414 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
415 *pPinDir = PINDIR_INPUT;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
416 return 0;
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
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
419 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
420 * \brief IPin::QueryId (retrieves pin identificator)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
421 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
422 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
423 * \param[out] Id adress of variable, that receives string with pin's Id.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
424 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
425 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
426 * \return E_OUTOFMEMORY - Insufficient memory
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
427 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
428 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
429 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
430 * Pin's Id is not the same as pin's name
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
431 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
432 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
433 static HRESULT STDCALL COutputPin_QueryId(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
434 /* [out] */ LPWSTR *Id)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
435 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
436 return output_unimplemented("COutputPin_QueryId", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
437 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
438
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
439 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
440 * \brief IPin::QueryAccept (determines can media type be accepted or not)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
441 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
442 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
443 * \param[in] pmt Media type to check
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
444 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
445 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
446 * \return S_FALSE - pin rejects media type
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
447 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
448 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
449 static HRESULT STDCALL COutputPin_QueryAccept(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
450 /* [in] */ const AM_MEDIA_TYPE *pmt)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
451 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
452 return output_unimplemented("COutputPin_QueryAccept", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
453 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
454
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
455 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
456 * \brief IPin::EnumMediaTypes (enumerates the pin's preferred media types)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
457 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
458 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
459 * \param[out] ppEnum adress of variable that receives pointer to IEnumMEdiaTypes interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
460 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
461 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
462 * \return E_OUTOFMEMORY - Insufficient memory
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
463 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
464 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
465 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
466 * Caller must call Release on received interface when done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
467 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
468 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
469 static HRESULT STDCALL COutputPin_EnumMediaTypes(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
470 /* [out] */ IEnumMediaTypes **ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
471 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
472 Debug printf("COutputPin_EnumMediaTypes(%p) called\n",This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
473 if (!ppEnum)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
474 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
475 *ppEnum = (IEnumMediaTypes*) CEnumMediaTypesCreate(&((COutputPin*)This)->type);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
476 return 0;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
477 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
478
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
479 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
480 * \brief IPin::QueryInternalConnections (retries pin's internal connections)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
481 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
482 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
483 * \param[out] apPin Array that receives pins, internally connected to this
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
484 * \param[in,out] nPint Size of an array
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
485 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
486 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
487 * \return S_FALSE - pin rejects media type
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
488 * \return E_NOTIMPL - not implemented
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
489 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
490 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
491 static HRESULT STDCALL COutputPin_QueryInternalConnections(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
492 /* [out] */ IPin **apPin,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
493 /* [out][in] */ ULONG *nPin)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
494 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
495 return output_unimplemented("COutputPin_QueryInternalConnections", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
496 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
497
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
498 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
499 * \brief IPin::EndOfStream (notifies pin, that no data is expected, until new run command)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
500 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
501 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
502 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
503 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
504 * \return E_UNEXPECTED - The pin is output pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
505 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
506 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
507 * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
508 * IMemAllocator::GetBuffer runs in different (streaming) thread then other
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
509 * methods (application thread).
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
510 * IMemoryInputPin::NewSegment runs either in streaming or application thread.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
511 * Developer must use critical sections for thread-safing work.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
512 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
513 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
514 static HRESULT STDCALL COutputPin_EndOfStream(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
515 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
516 return output_unimplemented("COutputPin_EndOfStream", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
517 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
518
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
519 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
520 * \brief IPin::BeginFlush (begins a flush operation)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
521 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
522 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
523 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
524 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
525 * \return E_UNEXPECTED - The pin is output pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
526 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
527 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
528 static HRESULT STDCALL COutputPin_BeginFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
529 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
530 return output_unimplemented("COutputPin_BeginFlush", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
531 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
532
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
533 /**
22015
857cc6beb662 fix typos from previous commit
voroshil
parents: 22014
diff changeset
534 * \brief IPin::EndFlush (ends a flush operation)
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
535 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
536 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
537 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
538 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
539 * \return E_UNEXPECTED - The pin is output pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
540 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
541 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
542 static HRESULT STDCALL COutputPin_EndFlush(IPin * This)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
543 {
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
544 return output_unimplemented("COutputPin_EndFlush", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
545 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
546
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
547 /**
22015
857cc6beb662 fix typos from previous commit
voroshil
parents: 22014
diff changeset
548 * \brief IPin::NewSegment (media sample received after this call grouped as segment with common
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
549 * start,stop time and rate)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
550 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
551 * \param[in] This pointer to IPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
552 * \param[in] tStart start time of new segment
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
553 * \param[in] tStop end time of new segment
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
554 * \param[in] dRate rate at wich segment should be processed
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
555 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
556 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
557 * \return E_UNEXPECTED - The pin is output pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
558 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
559 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
560 static HRESULT STDCALL COutputPin_NewSegment(IPin * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
561 /* [in] */ REFERENCE_TIME tStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
562 /* [in] */ REFERENCE_TIME tStop,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
563 /* [in] */ double dRate)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
564 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
565 Debug printf("COutputPin_NewSegment(%Ld,%Ld,%f) called\n",
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
566 tStart, tStop, dRate);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
567 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
568 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
569
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
570
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
571
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
572 // IMemInputPin->IUnknown methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
573
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
574 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
575 * \brief IUnknown::QueryInterface (query object for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
576 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
577 * \param[in] This pointer to IUnknown interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
578 * \param[in] iid GUID of requested interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
579 * \param[out] ppv receives pointer to interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
580 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
581 * \return S_OK - success (and *ppv contains valid pointer)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
582 * \return E_NOINTERFACE - interface not found (and *ppv was set NULL)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
583 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
584 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
585 * Make sure to call Release on received interface when you are done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
586 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
587 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
588 static HRESULT STDCALL COutputMemPin_QueryInterface(IUnknown* This, const GUID* iid, void** ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
589 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
590 COutputPin* p = (COutputPin*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
591
22017
0421ee482f38 fix overlooked debug message
voroshil
parents: 22016
diff changeset
592 Debug printf("COutputMemPin_QueryInterface(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
593 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
594 return E_INVALIDARG;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
595
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
596 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
597 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
598 *ppv = p;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
599 p->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
600 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
601 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
602 /*if(!memcmp(iid, &IID_IPin, 16))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
603 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
604 COutputPin* ptr=(COutputPin*)(This-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
605 *ppv=(void*)ptr;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
606 AddRef((IUnknown*)ptr);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
607 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
608 }*/
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
609 if(!memcmp(iid, &IID_IMemInputPin, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
610 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
611 *ppv = p->mempin;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
612 p->mempin->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
613 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
614 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
615 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
616 "%02x%02x%02x%02x%02x%02x\n",
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
617 iid->f1, iid->f2, iid->f3,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
618 (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
619 (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
620 (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
621 (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
622 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
623 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
624
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
625 // IMemInputPin methods
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
626
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
627 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
628 * \brief IMemInputPin::GetAllocator (retrives memory allocator, proposed by pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
629 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
630 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
631 * \param[out] ppAllocator address of variable that receives allocator's IMemAllocator interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
632 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
633 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
634 * \return VFW_E_NO_ALLOCATOR - No allocator
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
635 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
636 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
637 * Make sure to call Release on received interface when you are done
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
638 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
639 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
640 static HRESULT STDCALL COutputMemPin_GetAllocator(IMemInputPin* This,
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
641 /* [out] */ IMemAllocator** ppAllocator)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
642 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
643 Debug printf("COutputMemPin_GetAllocator(%p, %p) called\n", This->vt, ppAllocator);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
644 *ppAllocator = (IMemAllocator*) MemAllocatorCreate();
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
645 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
646 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
647
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
648 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
649 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
650 * \brief IMemInputPin::NotifyAllocator (specifies an allocator for the connection)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
651 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
652 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
653 * \param[in] pAllocator allocator's IMemAllocator interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
654 * \param[in] bReadOnly specifies whether samples from allocator are readonly
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
655 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
656 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
657 * \return Apropriate error code otherwise
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
658 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
659 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
660 static HRESULT STDCALL COutputMemPin_NotifyAllocator(IMemInputPin* This,
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
661 /* [in] */ IMemAllocator* pAllocator,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
662 /* [in] */ int bReadOnly)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
663 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
664 Debug printf("COutputMemPin_NotifyAllocator(%p, %p) called\n", This, pAllocator);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
665 ((COutputMemPin*)This)->pAllocator = (MemAllocator*) pAllocator;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
666 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
667 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
668
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
669 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
670 * \brief IMemInputPin::GetAllocatorRequirements (retrieves allocator properties requested by
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
671 * input pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
672 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
673 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
674 * \param[out] pProps pointer to a structure that receives allocator properties
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
675 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
676 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
677 * \return E_NOTIMPL - Not implemented
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
678 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
679 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
680 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
681 static HRESULT STDCALL COutputMemPin_GetAllocatorRequirements(IMemInputPin* This,
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
682 /* [out] */ ALLOCATOR_PROPERTIES* pProps)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
683 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
684 return output_unimplemented("COutputMemPin_GetAllocatorRequirements", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
685 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
686
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
687 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
688 * \brief IMemInputPin::Receive (receives the next media sample int thre stream)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
689 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
690 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
691 * \param[in] pSample pointer to sample's IMediaSample interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
692 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
693 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
694 * \return S_FALSE - The sample was rejected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
695 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
696 * \return VFW_E_INVALIDMEDIATYPE - invalid media type
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
697 * \return VFW_E_RUNTIME_ERROR - run-time error occured
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
698 * \return VFW_E_WRONG_STATE - pin is stopped
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
699 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
700 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
701 * Method san do on of the following:
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
702 * - reject sample
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
703 * - accept sample and process it in another thread
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
704 * - accept sample and process it before returning
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
705 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
706 * In second case method should increase reference count for sample (through AddRef)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
707 * In the last case method might block indefinitely. If this might
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
708 * happen IMemInpuPin::ReceiveCAnBlock returns S_OK
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
709 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
710 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
711 * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
712 * IMemAllocator::GetBuffer runs in different (streaming) thread then other
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
713 * methods (application thread).
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
714 * IMemoryInputPin::NewSegment runs either in streaming or application thread.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
715 * Developer must use critical sections for thread-safing work.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
716 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
717 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
718 static HRESULT STDCALL COutputMemPin_Receive(IMemInputPin* This,
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
719 /* [in] */ IMediaSample* pSample)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
720 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
721 COutputMemPin* mp = (COutputMemPin*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
722 char* pointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
723 int len;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
724
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
725 Debug printf("COutputMemPin_Receive(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
726 if (!pSample)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
727 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
728 if (pSample->vt->GetPointer(pSample, (BYTE**) &pointer))
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
729 return -1;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
730 len = pSample->vt->GetActualDataLength(pSample);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
731 if (len == 0)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
732 len = pSample->vt->GetSize(pSample);//for iv50
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
733 //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
734
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
735 if (mp->frame_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
736 *(mp->frame_pointer) = pointer;
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
737 if (mp->frame_size_pointer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
738 *(mp->frame_size_pointer) = len;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
739 /*
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
740 FILE* file=fopen("./uncompr.bmp", "wb");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
741 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
742 *(int*)(&head[2])=len+0x36;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
743 fwrite(head, 14, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
744 fwrite(&((VIDEOINFOHEADER*)me.type.pbFormat)->bmiHeader, sizeof(BITMAPINFOHEADER), 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
745 fwrite(pointer, len, 1, file);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
746 fclose(file);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
747 */
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
748 // pSample->vt->Release((IUnknown*)pSample);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
749
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
750 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
751 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
752
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
753 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
754 * \brief IMemInputPin::ReceiveMultiple (receives multiple samples in the stream)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
755 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
756 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
757 * \param[in] pSamples pointer to array with samples
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
758 * \param[in] nSamples number of samples in array
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
759 * \param[out] nSamplesProcessed number of processed samples
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
760 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
761 * \return S_OK - success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
762 * \return S_FALSE - The sample was rejected
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
763 * \return E_POINTER - Null pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
764 * \return VFW_E_INVALIDMEDIATYPE - invalid media type
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
765 * \return VFW_E_RUNTIME_ERROR - run-time error occured
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
766 * \return VFW_E_WRONG_STATE - pin is stopped
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
767 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
768 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
769 * This method behaves like IMemInputPin::Receive but for array of samples
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
770 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
771 * \note
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
772 * IMemoryInputPin::Receive,IMemoryInputPin::ReceiveMultiple, IMemoryInputPin::EndOfStream,
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
773 * IMemAllocator::GetBuffer runs in different (streaming) thread then other
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
774 * methods (application thread).
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
775 * IMemoryInputPin::NewSegment runs either in streaming or application thread.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
776 * Developer must use critical sections for thread-safing work.
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
777 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
778 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
779 static HRESULT STDCALL COutputMemPin_ReceiveMultiple(IMemInputPin * This,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
780 /* [size_is][in] */ IMediaSample **pSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
781 /* [in] */ long nSamples,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
782 /* [out] */ long *nSamplesProcessed)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
783 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
784 return output_unimplemented("COutputMemPin_ReceiveMultiple", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
785 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
786
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
787 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
788 * \brief IMemInputPin::ReceiveCanBlock (determines whether IMemInputPin:::Receive might block)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
789 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
790 * \param[in] This pointer to IMemInputPin interface
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
791 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
792 * \return S_OK - the pin might block
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
793 * \return S_FALSE - the pin will not block
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
794 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
795 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
796 static HRESULT STDCALL COutputMemPin_ReceiveCanBlock(IMemInputPin * This)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
797 {
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
798 return output_unimplemented("COutputMemPin_ReceiveCanBlock", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
799 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
800
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
801 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
802 * \brief COutputPin::SetFramePointer (sets internal frame pointer to an external buffer)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
803 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
804 * \param[in] This pointer to COutputPin class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
805 * \param[in] z new pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
806 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
807 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
808 static void COutputPin_SetFramePointer(COutputPin* This, char** z)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
809 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
810 This->mempin->frame_pointer = z;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
811 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
812
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
813 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
814 * \brief COutputPin::SetFramePointer2 (sets allocator's pointer to an external buffer)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
815 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
816 * \param[in] This pointer to COutputPin class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
817 * \param[in] z new pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
818 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
819 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
820 static void COutputPin_SetPointer2(COutputPin* This, char* p)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
821 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
822 if (This->mempin->pAllocator)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
823 // fixme
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
824 This->mempin->pAllocator->SetPointer(This->mempin->pAllocator, p);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
825 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
826
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
827 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
828 * \brief COutputPin::SetFrameSizePointer (sets pointer to variable that receives frame size)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
829 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
830 * \param[in] This pointer to COutputPin class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
831 * \param[in] z new pointer
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
832 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
833 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
834 static void COutputPin_SetFrameSizePointer(COutputPin* This, long* z)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
835 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
836 This->mempin->frame_size_pointer = z;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
837 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
838
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
839 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
840 * \brief COutputPin::SetNewFormat(sets new media format for the pin)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
841 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
842 * \param[in] This pointer to COutputPin class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
843 * \param[in] amt new media format
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
844 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
845 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
846 static void COutputPin_SetNewFormat(COutputPin* This, const AM_MEDIA_TYPE* amt)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
847 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
848 This->type = *amt;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
849 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
850
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
851 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
852 * \brief COutputPin destructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
853 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
854 * \param[in] This pointer to COutputPin class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
855 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
856 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
857 static void COutputPin_Destroy(COutputPin* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
858 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
859 if (This->mempin->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
860 free(This->mempin->vt);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
861 if (This->mempin)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
862 free(This->mempin);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
863 if (This->vt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
864 free(This->vt);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
865 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
866 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
867
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
868 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
869 * \brief IUnknown::AddRef (increases reference counter for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
870 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
871 * \param[in] This pointer to IUnknown class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
872 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
873 * \return new value of reference counter
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
874 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
875 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
876 * Return value should be used only for debug purposes
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
877 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
878 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
879 static HRESULT STDCALL COutputPin_AddRef(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
880 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
881 Debug printf("COutputPin_AddRef(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
882 ((COutputPin*)This)->refcount++;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
883 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
884 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
885
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
886 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
887 * \brief IUnknown::Release (desreases reference counter for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
888 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
889 * \param[in] This pointer to IUnknown class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
890 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
891 * \return new value of reference counter
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
892 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
893 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
894 * When reference counter reaches zero calls destructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
895 * Return value should be used only for debug purposes
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
896 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
897 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
898 static HRESULT STDCALL COutputPin_Release(IUnknown* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
899 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
900 Debug printf("COutputPin_Release(%p) called (%d)\n", This, ((COutputPin*)This)->refcount);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
901 if (--((COutputPin*)This)->refcount <= 0)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
902 COutputPin_Destroy((COutputPin*)This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
903
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
904 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
905 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
906
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
907 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
908 * \brief IUnknown::AddRef (increases reference counter for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
909 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
910 * \param[in] This pointer to IUnknown class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
911 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
912 * \return new value of reference counter
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
913 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
914 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
915 * Return value should be used only for debug purposes
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
916 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
917 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
918 static HRESULT STDCALL COutputMemPin_AddRef(IUnknown* This)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
919 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
920 COutputMemPin* p = (COutputMemPin*) This;
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
921 Debug printf("COutputMemPin_AddRef(%p) called (%p, %d)\n", p, p->parent, p->parent->refcount);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
922 p->parent->refcount++;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
923 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
924 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
925
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
926 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
927 * \brief IUnknown::Release (desreases reference counter for interface)
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
928 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
929 * \param[in] This pointer to IUnknown class
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
930 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
931 * \return new value of reference counter
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
932 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
933 * \remarks
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
934 * When reference counter reaches zero calls destructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
935 * Return value should be used only for debug purposes
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
936 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
937 */
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
938 static HRESULT STDCALL COutputMemPin_Release(IUnknown* This)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
939 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
940 COutputMemPin* p = (COutputMemPin*) This;
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
941 Debug printf("COutputMemPin_Release(%p) called (%p, %d)\n",
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
942 p, p->parent, p->parent->refcount);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
943 if (--p->parent->refcount <= 0)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
944 COutputPin_Destroy(p->parent);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
945 return 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
946 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
947
22014
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
948 /**
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
949 * \brief COutputPin constructor
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
950 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
951 * \param[in] amt media type for pin
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
952 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
953 * \return pointer to COutputPin if success
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
954 * \return NULL if error occured
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
955 *
9472dc33de99 Cosmetics. Doxygen comments.
voroshil
parents: 18878
diff changeset
956 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
957 COutputPin* COutputPinCreate(const AM_MEDIA_TYPE* amt)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
958 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
959 COutputPin* This = (COutputPin*) malloc(sizeof(COutputPin));
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
960 IMemInputPin_vt* ivt;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
961
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
962 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
963 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
964
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
965 This->vt = (IPin_vt*) malloc(sizeof(IPin_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
966 This->mempin = (COutputMemPin*) malloc(sizeof(COutputMemPin));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
967 ivt = (IMemInputPin_vt*) malloc(sizeof(IMemInputPin_vt));
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
968
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
969 if (!This->vt || !This->mempin || !ivt)
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
970 {
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
971 COutputPin_Destroy(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
972 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
973 }
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
974
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
975 This->mempin->vt = ivt;
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
976
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
977 This->refcount = 1;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
978 This->remote = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
979 This->type = *amt;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3130
diff changeset
980
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
981 This->vt->QueryInterface = COutputPin_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
982 This->vt->AddRef = COutputPin_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
983 This->vt->Release = COutputPin_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
984 This->vt->Connect = COutputPin_Connect;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
985 This->vt->ReceiveConnection = COutputPin_ReceiveConnection;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
986 This->vt->Disconnect = COutputPin_Disconnect;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
987 This->vt->ConnectedTo = COutputPin_ConnectedTo;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
988 This->vt->ConnectionMediaType = COutputPin_ConnectionMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
989 This->vt->QueryPinInfo = COutputPin_QueryPinInfo;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
990 This->vt->QueryDirection = COutputPin_QueryDirection;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
991 This->vt->QueryId = COutputPin_QueryId;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
992 This->vt->QueryAccept = COutputPin_QueryAccept;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
993 This->vt->EnumMediaTypes = COutputPin_EnumMediaTypes;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
994 This->vt->QueryInternalConnections = COutputPin_QueryInternalConnections;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
995 This->vt->EndOfStream = COutputPin_EndOfStream;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
996 This->vt->BeginFlush = COutputPin_BeginFlush;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
997 This->vt->EndFlush = COutputPin_EndFlush;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
998 This->vt->NewSegment = COutputPin_NewSegment;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
999
22016
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1000 This->mempin->vt->QueryInterface = COutputMemPin_QueryInterface;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1001 This->mempin->vt->AddRef = COutputMemPin_AddRef;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1002 This->mempin->vt->Release = COutputMemPin_Release;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1003 This->mempin->vt->GetAllocator = COutputMemPin_GetAllocator;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1004 This->mempin->vt->NotifyAllocator = COutputMemPin_NotifyAllocator;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1005 This->mempin->vt->GetAllocatorRequirements = COutputMemPin_GetAllocatorRequirements;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1006 This->mempin->vt->Receive = COutputMemPin_Receive;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1007 This->mempin->vt->ReceiveMultiple = COutputMemPin_ReceiveMultiple;
4479e6a1a140 Changing debug messages and renaming method names according to their
voroshil
parents: 22015
diff changeset
1008 This->mempin->vt->ReceiveCanBlock = COutputMemPin_ReceiveCanBlock;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1009
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1010 This->mempin->frame_size_pointer = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1011 This->mempin->frame_pointer = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1012 This->mempin->pAllocator = 0;
3130
623cdb771e97 avifile sync. seems to some bugs fixed...
arpi
parents: 3056
diff changeset
1013 This->mempin->refcount = 1;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1014 This->mempin->parent = This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1015
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1016 This->SetPointer2 = COutputPin_SetPointer2;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1017 This->SetFramePointer = COutputPin_SetFramePointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1018 This->SetFrameSizePointer = COutputPin_SetFrameSizePointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1019 This->SetNewFormat = COutputPin_SetNewFormat;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1020
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2072
diff changeset
1021 return This;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 1063
diff changeset
1022 }