annotate loader/dshow/cmediasample.c @ 24408:614f9efc91a8

Fix indentation after r24367.
author cehoyos
date Mon, 10 Sep 2007 23:14:17 +0000
parents 89347ff2c31a
children 2c8cdb9123b8
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 */
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
6
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
7 #include "cmediasample.h"
22305
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
8 #include "mediatype.h"
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
9 #include "wine/winerror.h"
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 #include <stdio.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
11 #include <string.h>
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
12 #include <stdlib.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
13
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
14 /*
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
15 * currently hack to make some extra room for DS Acel codec which
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
16 * seems to overwrite allocated memory - FIXME better later
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
17 * check the buffer allocation
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
18 */
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
19 static const int SAFETY_ACEL = 1024;
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
20
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
21 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
22 * \brief IPin::QueryInternalConnections (retries pin's internal connections)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
23 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
24 * \param[in] This pointer to IPin interface
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
25 * \param[out] apPin Array that receives pins, internally connected to this
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
26 * \param[in,out] nPint Size of an array
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
27 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
28 * \return S_OK - success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
29 * \return S_FALSE - pin rejects media type
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
30 * \return E_NOTIMPL - not implemented
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
31 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
32 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
33 static long STDCALL CMediaSample_QueryInterface(IUnknown* This,
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
34 /* [in] */ const GUID* iid,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
35 /* [iid_is][out] */ void **ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
36 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
37 Debug printf("CMediaSample_QueryInterface(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
38 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
39 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
40 if (memcmp(iid, &IID_IUnknown, sizeof(*iid)) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
41 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
42 *ppv = (void*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
43 ((IMediaSample*) This)->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
44 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
45 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
46 if (memcmp(iid, &IID_IMediaSample, sizeof(*iid)) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
47 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
48 *ppv = (void*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
49 ((IMediaSample*) This)->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
50 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
51 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
52 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
53 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
54
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
55 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
56 * \brief IUnknown::AddRef (increases reference counter for interface)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
57 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
58 * \param[in] This pointer to IUnknown class
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
59 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
60 * \return new value of reference counter
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
61 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
62 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
63 * Return value should be used only for debug purposes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
64 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
65 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
66 static long STDCALL CMediaSample_AddRef(IUnknown* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
67 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
68 Debug printf("CMediaSample_AddRef(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 ((CMediaSample*)This)->refcount++;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
70 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
71 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
72
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
73 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
74 * \brief CMediaSample destructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
75 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
76 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
77 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
78 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
79 void CMediaSample_Destroy(CMediaSample* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
80 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
81
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
82 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
83 free(This->vt);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
84 free(This->own_block);
24347
89347ff2c31a Avoid releasing of unallocated memory.
voroshil
parents: 24343
diff changeset
85 if(((CMediaSample*)This)->type_valid)
24408
614f9efc91a8 Fix indentation after r24367.
cehoyos
parents: 24347
diff changeset
86 FreeMediaType(&(This->media_type));
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
87 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
88 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
89
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
90 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
91 * \brief IUnknown::Release (desreases reference counter for interface)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
92 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
93 * \param[in] This pointer to IUnknown class
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
94 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
95 * \return new value of reference counter
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
96 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
97 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
98 * When reference counter reaches zero calls destructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
99 * Return value should be used only for debug purposes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
100 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
101 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
102 static long STDCALL CMediaSample_Release(IUnknown* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
103 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
104 CMediaSample* parent = (CMediaSample*)This;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
105 Debug printf("CMediaSample_Release(%p) called (new ref:%d)\n",
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
106 This, ((CMediaSample*)This)->refcount-1);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
107
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
108 if (--((CMediaSample*) This)->refcount == 0)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
109 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
110 parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all),
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
111 (IMediaSample*)This);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
112 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
113 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
114 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
115
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
116 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
117 * \brief IMediaSample::GetPointer (retrieves a read/write pointer to the media sample's buffer)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
118 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
119 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
120 * \param[out] address of variable that receives pointer to sample's buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
121 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
122 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
123 * \return apropriate error otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
124 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
125 * \note The calles should not free or reallocate buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
126 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
127 */
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
128 static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This,
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
129 /* [out] */ BYTE** ppBuffer)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
130 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
131 Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
132 if (!ppBuffer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
133 return E_INVALIDARG;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
134 *ppBuffer = (BYTE*) ((CMediaSample*) This)->block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
135 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
136 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
137
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
138 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
139 * \brief IMediaSample::GetSize (retrieves a size of buffer in bytes)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
140 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
141 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
142 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
143 * \return size of buffer in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
144 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
145 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
146 static long STDCALL CMediaSample_GetSize(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
147 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
148 Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
149 return ((CMediaSample*) This)->size;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
150 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
151
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
152 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
153 * \brief IMediaSample::GetTime (retrieves a stream time at wich sample sould start and finish)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
154 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
155 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
156 * \param[out] pTimeStart pointer to variable that receives start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
157 * \param[out] pTimeEnd pointer to variable that receives end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
158 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
159 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
160 * \return VFW_E_NO_STOP_TIME The sample has valid start time, but no stop time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
161 * \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
162 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
163 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
164 * Both values are relative to stream time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
165 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
166 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
167 static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
168 /* [out] */ REFERENCE_TIME *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
169 /* [out] */ REFERENCE_TIME *pTimeEnd)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
170 {
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
171 Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
174
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
175 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
176 * \brief IMediaSample::SetTime (sets a stream time at wich sample sould start and finish)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
177 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
178 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
179 * \param[out] pTimeStart pointer to variable that contains start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
180 * \param[out] pTimeEnd pointer to variable that contains end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
181 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
182 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
183 * \return apropriate error otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
184 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
185 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
186 * Both values are relative to stream time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
187 * To invalidate the stream times set pTimeStart and pTimeEnd to NULL. this will cause
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
188 * IMEdiaSample::GetTime to return VFW_E_SAMPLE_TIME_NOT_SET
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
189 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
190 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
191 static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
192 /* [in] */ REFERENCE_TIME *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
193 /* [in] */ REFERENCE_TIME *pTimeEnd)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
194 {
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
195 Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
196 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
197 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
199 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
200 * \brief IMediaSample::IsSyncPoint (determines if start of this sample is sync point)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
201 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
202 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
203 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
204 * \return S_OK start of this sample is sync point
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
205 * \return S_FALSE start of this sample is not sync point
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
206 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
207 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
208 * If bTemporalCompression of AM_MEDIA_TYPE is FALSE, all samples are sync points.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
209 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
210 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
211 static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
212 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
213 Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
214 if (((CMediaSample*)This)->isSyncPoint)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
215 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
216 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
217 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
218
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
219 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
220 * \brief IMediaSample::SetSyncPoint (specifies if start of this sample is sync point)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
221 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
222 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
223 * \param[in] bIsSyncPoint specifies whether this is sync point or not
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
224 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
225 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
226 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
227 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
228 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
229 static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
230 long bIsSyncPoint)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
231 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
232 Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
233 ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
234 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
235 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
236
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
237 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
238 * \brief IMediaSample::IsPreroll (determines if this sample is preroll sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
239 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
240 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
241 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
242 * \return S_OK if this sample is preroll sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
243 * \return S_FALSE if this sample is not preroll sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
244 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
245 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
246 * Preroll samples are processed but not displayed. They are lokated in media stream
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
247 * before displayable samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
248 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
249 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
250 static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
251 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
252 Debug printf("CMediaSample_IsPreroll(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
253
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
254 if (((CMediaSample*)This)->isPreroll)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
255 return 0;//S_OK
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
256
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
257 return 1;//S_FALSE
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
258 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
259
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
260 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
261 * \brief IMediaSample::SetPreroll (specifies if this sample is preroll sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
262 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
263 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
264 * \param[in] bIsPreroll specifies whether this sample is preroll sample or not
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
265 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
266 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
267 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
268 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
269 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
270 * Preroll samples are processed but not displayed. They are lokated in media stream
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
271 * before displayable samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
272 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
273 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
274 static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
275 long bIsPreroll)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
276 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
277 Debug printf("CMediaSample_SetPreroll(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
278 ((CMediaSample*)This)->isPreroll=bIsPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
279 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
280 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
281
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
282 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
283 * \brief IMediaSample::GetActualDataLength (retrieves the length of valid data in the buffer)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
284 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
285 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
286 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
287 * \return length of valid data in buffer in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
288 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
289 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
290 static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
291 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
292 Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
293 return ((CMediaSample*)This)->actual_size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
294 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
295
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
296 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
297 * \brief IMediaSample::SetActualDataLength (specifies the length of valid data in the buffer)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
298 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
299 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
300 * \param[in] __MIDL_0010 length of data in sample in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
301 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
302 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
303 * \return VFW_E_BUFFER_OVERFLOW length specified by parameter is larger than buffer size
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
304 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
305 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
306 static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
307 long __MIDL_0010)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
308 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
309 CMediaSample* cms = (CMediaSample*)This;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
310 Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010);
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
311
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
312 if (__MIDL_0010 > cms->size)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
313 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
314 char* c = cms->own_block;
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
315 Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n",
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
316 __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block);
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
317 cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
318 if (c == cms->block)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
319 cms->block = cms->own_block;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
320 cms->size = __MIDL_0010;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
321 }
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
322 cms->actual_size = __MIDL_0010;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
323 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
324 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
325
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
326 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
327 * \brief IMediaSample::GetMediaType (retrieves media type, if it changed from previous sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
328 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
329 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
330 * \param[out] ppMediaType address of variable that receives pointer to AM_MEDIA_TYPE.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
331 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
332 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
333 * \return S_FALSE Media type was not changed from previous sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
334 * \return E_OUTOFMEMORY Insufficient memory
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
335 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
336 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
337 * If media type is not changed from previous sample, ppMediaType is null
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
338 * If method returns S_OK caller should free memory allocated for structure
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
339 * including pbFormat block
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
340 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
341 static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
342 AM_MEDIA_TYPE** ppMediaType)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
343 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
344 AM_MEDIA_TYPE* t;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
345 Debug printf("CMediaSample_GetMediaType(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
346 if(!ppMediaType)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
347 return E_INVALIDARG;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
348 if(!((CMediaSample*)This)->type_valid)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
349 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
350 *ppMediaType=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
351 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
352 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
353
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
354 t = &((CMediaSample*)This)->media_type;
9964
6454a2ba2e33 CoTaskMemAlloc/Free vs malloc/free cleanup
alex
parents: 8292
diff changeset
355 // if(t.pbFormat)free(t.pbFormat);
22305
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
356 *ppMediaType=CreateMediaType(t);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
357 // *ppMediaType=0; //media type was not changed
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
358 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
359 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
360
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
361 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
362 * \brief IMediaType::SetMediaType (specifies media type for sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
363 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
364 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
365 * \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
366 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
367 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
368 * \return E_OUTOFMEMORY insufficient memory
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
369 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
370 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
371 static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
372 AM_MEDIA_TYPE *pMediaType)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
373 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
374 AM_MEDIA_TYPE* t;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
375 Debug printf("CMediaSample_SetMediaType(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
376 if (!pMediaType)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
377 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
378 t = &((CMediaSample*)This)->media_type;
24347
89347ff2c31a Avoid releasing of unallocated memory.
voroshil
parents: 24343
diff changeset
379 if(((CMediaSample*)This)->type_valid)
24408
614f9efc91a8 Fix indentation after r24367.
cehoyos
parents: 24347
diff changeset
380 FreeMediaType(t);
22305
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
381 CopyMediaType(t,pMediaType);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
382 ((CMediaSample*) This)->type_valid=1;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
383
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
384 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
385 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
386
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
387 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
388 * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
389 * in stream)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
390 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
391 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
392 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
393 * \return S_OK if this sample is break in data stream
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
394 * \return S_FALSE otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
395 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
396 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
397 * Discontinuity occures when filter seeks to different place in the stream or when drops
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
398 * samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
399 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
400 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
401 static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
402 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
403 Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
404 return ((CMediaSample*) This)->isDiscontinuity;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
405 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
406
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
407 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
408 * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
409 * in stream)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
410 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
411 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
412 * \param[in] bDiscontinuity if TRUE this sample represents discontinuity with previous sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
413 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
414 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
415 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
416 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
417 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
418 static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
419 long bDiscontinuity)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
420 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
421 Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
422 ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
423 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
424 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
425
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
426 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
427 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
428 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
429 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
430 * \param[out] pTimeStart pointer to variable that receives start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
431 * \param[out] pTimeEnd pointer to variable that receives end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
432 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
433 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
434 * \return VFW_E_MEDIA_TIME_NOT_SET The sample is not time-stamped
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
435 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
436 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
437 static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
438 /* [out] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
439 /* [out] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
440 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
441 Debug printf("CMediaSample_GetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
442 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
443 *pTimeStart = ((CMediaSample*) This)->time_start;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
444 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
445 *pTimeEnd = ((CMediaSample*) This)->time_end;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
446 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
447 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
448
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
449 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
450 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
451 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
452 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
453 * \param[out] pTimeStart pointer to variable that specifies start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
454 * \param[out] pTimeEnd pointer to variable that specifies end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
455 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
456 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
457 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
458 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
459 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
460 * To invalidate the media times set pTimeStart and pTimeEnd to NULL. this will cause
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
461 * IMEdiaSample::GetTime to return VFW_E_MEDIA_TIME_NOT_SET
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
462 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
463 static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
464 /* [in] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
465 /* [in] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
466 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
467 Debug printf("CMediaSample_SetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
468 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
469 ((CMediaSample*) This)->time_start = *pTimeStart;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
470 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
471 ((CMediaSample*) This)->time_end = *pTimeEnd;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
472 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
473 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
474
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
475 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
476 * \brief CMediaSample::SetPointer (extension for direct memory write of decompressed data)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
477 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
478 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
479 * \param[in] pointer pointer to an external buffer to store data to
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
480 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
481 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
482 static void CMediaSample_SetPointer(CMediaSample* This, char* pointer)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
483 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
484 Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
485 if (pointer)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
486 This->block = pointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
487 else
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
488 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
489 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
490
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
491 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
492 * \brief CMediaSample::SetPointer (resets pointer to external buffer with internal one)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
493 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
494 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
495 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
496 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
497 static void CMediaSample_ResetPointer(CMediaSample* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
498 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
499 Debug printf("CMediaSample_ResetPointer(%p) called\n", This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
500 This->block = This->own_block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
501 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
502
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
503 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
504 * \brief CMediaSample constructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
505 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
506 * \param[in] allocator IMemallocator interface of allocator to use
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
507 * \param[in] _size size of internal buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
508 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
509 * \return pointer to CMediaSample object of NULL if error occured
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
510 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
511 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
512 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
513 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
514 CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample));
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
515 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
516 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
517
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
518 // some hack here!
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
519 // it looks like Acelp decoder is actually accessing
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
520 // the allocated memory before it sets the new size for it ???
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
521 // -- maybe it's being initialized with wrong parameters
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
522 // anyway this is fixes the problem somehow with some reserves
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
523 //
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
524 // using different trick for now - in DS_Audio modify sample size
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
525 //if (_size < 0x1000)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
526 // _size = (_size + 0xfff) & ~0xfff;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
527
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
528 This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt));
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
529 This->own_block = (char*) malloc((size_t)_size + SAFETY_ACEL);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
530 This->media_type.pbFormat = 0;
24343
bf37d4ba4b65 Always initialize pUnk pointer with zero.
voroshil
parents: 22305
diff changeset
531 This->media_type.pUnk = 0;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
532
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
533 if (!This->vt || !This->own_block)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
534 {
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
535 CMediaSample_Destroy(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
536 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
537 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
538
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
539 This->vt->QueryInterface = CMediaSample_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
540 This->vt->AddRef = CMediaSample_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
541 This->vt->Release = CMediaSample_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
542 This->vt->GetPointer = CMediaSample_GetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
543 This->vt->GetSize = CMediaSample_GetSize;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
544 This->vt->GetTime = CMediaSample_GetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
545 This->vt->SetTime = CMediaSample_SetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
546 This->vt->IsSyncPoint = CMediaSample_IsSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
547 This->vt->SetSyncPoint = CMediaSample_SetSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
548 This->vt->IsPreroll = CMediaSample_IsPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
549 This->vt->SetPreroll = CMediaSample_SetPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
550 This->vt->GetActualDataLength = CMediaSample_GetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
551 This->vt->SetActualDataLength = CMediaSample_SetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
552 This->vt->GetMediaType = CMediaSample_GetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
553 This->vt->SetMediaType = CMediaSample_SetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
554 This->vt->IsDiscontinuity = CMediaSample_IsDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
555 This->vt->SetDiscontinuity = CMediaSample_SetDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
556 This->vt->GetMediaTime = CMediaSample_GetMediaTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
557 This->vt->SetMediaTime = CMediaSample_SetMediaTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
558
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
559 This->all = allocator;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
560 This->size = _size;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
561 This->refcount = 0; // increased by MemAllocator
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
562 This->actual_size = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
563 This->isPreroll = 0;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
564 This->isDiscontinuity = 1;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
565 This->time_start = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
566 This->time_end = 0;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
567 This->type_valid = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
568 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
569
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
570 This->SetPointer = CMediaSample_SetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
571 This->ResetPointer = CMediaSample_ResetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
572
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
573 Debug printf("CMediaSample_Create(%p) called - sample size %d, buffer %p\n",
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
574 This, This->size, This->block);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
575
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
576 return This;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
577 }