annotate loader/dshow/cmediasample.c @ 24182:8d6ad131c010

Split lschunks function further, it is simply too huge to do any useful changes (e.g. for more proper support for multi-codec tracks).
author reimar
date Sat, 25 Aug 2007 18:09:00 +0000
parents 3d1b23cf3d08
children bf37d4ba4b65
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);
22305
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
85 FreeMediaType(&(This->media_type));
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
86 free(This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
87 }
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
88
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
89 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
90 * \brief IUnknown::Release (desreases reference counter for interface)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
91 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
92 * \param[in] This pointer to IUnknown class
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
93 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
94 * \return new value of reference counter
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
95 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
96 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
97 * When reference counter reaches zero calls destructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
98 * Return value should be used only for debug purposes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
99 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
100 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
101 static long STDCALL CMediaSample_Release(IUnknown* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
102 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
103 CMediaSample* parent = (CMediaSample*)This;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
104 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
105 This, ((CMediaSample*)This)->refcount-1);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
106
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
107 if (--((CMediaSample*) This)->refcount == 0)
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
108 {
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
109 parent->all->vt->ReleaseBuffer((IMemAllocator*)(parent->all),
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
110 (IMediaSample*)This);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
111 }
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
112 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
113 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
114
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
115 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
116 * \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
117 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
118 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
119 * \param[out] address of variable that receives pointer to sample's buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
120 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
121 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
122 * \return apropriate error otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
123 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
124 * \note The calles should not free or reallocate buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
125 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
126 */
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
127 static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This,
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
128 /* [out] */ BYTE** ppBuffer)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
129 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
130 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
131 if (!ppBuffer)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
132 return E_INVALIDARG;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
133 *ppBuffer = (BYTE*) ((CMediaSample*) This)->block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
134 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
135 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
136
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
137 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
138 * \brief IMediaSample::GetSize (retrieves a size of buffer in bytes)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
139 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
140 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
141 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
142 * \return size of buffer in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
143 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
144 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
145 static long STDCALL CMediaSample_GetSize(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
146 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
147 Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
148 return ((CMediaSample*) This)->size;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
149 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
150
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
151 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
152 * \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
153 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
154 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
155 * \param[out] pTimeStart pointer to variable that receives start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
156 * \param[out] pTimeEnd pointer to variable that receives end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
157 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
158 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
159 * \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
160 * \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
161 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
162 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
163 * Both values are relative to stream time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
164 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
165 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
166 static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
167 /* [out] */ REFERENCE_TIME *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
168 /* [out] */ REFERENCE_TIME *pTimeEnd)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
169 {
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
170 Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
174 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
175 * \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
176 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
177 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
178 * \param[out] pTimeStart pointer to variable that contains start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
179 * \param[out] pTimeEnd pointer to variable that contains end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
180 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
181 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
182 * \return apropriate error otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
183 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
184 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
185 * Both values are relative to stream time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
186 * 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
187 * IMEdiaSample::GetTime to return VFW_E_SAMPLE_TIME_NOT_SET
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
188 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
189 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
190 static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
191 /* [in] */ REFERENCE_TIME *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
192 /* [in] */ REFERENCE_TIME *pTimeEnd)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
193 {
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
194 Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
195 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
196 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
197
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
198 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
199 * \brief IMediaSample::IsSyncPoint (determines if start of this sample is sync point)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
200 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
201 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
202 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
203 * \return S_OK start of this sample is sync point
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
204 * \return S_FALSE start of this sample is not sync point
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
205 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
206 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
207 * 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
208 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
209 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
210 static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
211 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
212 Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
213 if (((CMediaSample*)This)->isSyncPoint)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
214 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
215 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
216 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
217
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
218 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
219 * \brief IMediaSample::SetSyncPoint (specifies if start of this sample is sync point)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
220 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
221 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
222 * \param[in] bIsSyncPoint specifies whether this is sync point or not
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
223 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
224 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
225 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
226 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
227 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
228 static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
229 long bIsSyncPoint)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
230 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
231 Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
232 ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
233 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
234 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
235
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
236 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
237 * \brief IMediaSample::IsPreroll (determines if this sample is preroll sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
238 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
239 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
240 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
241 * \return S_OK if this sample is preroll sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
242 * \return S_FALSE if this sample is not preroll sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
243 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
244 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
245 * 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
246 * before displayable samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
247 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
248 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
249 static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
250 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
251 Debug printf("CMediaSample_IsPreroll(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
252
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
253 if (((CMediaSample*)This)->isPreroll)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
254 return 0;//S_OK
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
255
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
256 return 1;//S_FALSE
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
257 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
258
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
259 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
260 * \brief IMediaSample::SetPreroll (specifies if this sample is preroll sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
261 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
262 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
263 * \param[in] bIsPreroll specifies whether this sample is preroll sample or not
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
264 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
265 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
266 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
267 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
268 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
269 * 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
270 * before displayable samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
271 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
272 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
273 static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
274 long bIsPreroll)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
275 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
276 Debug printf("CMediaSample_SetPreroll(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
277 ((CMediaSample*)This)->isPreroll=bIsPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
278 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
279 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
280
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
281 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
282 * \brief IMediaSample::GetActualDataLength (retrieves the length of valid data in the buffer)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
283 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
284 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
285 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
286 * \return length of valid data in buffer in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
287 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
288 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
289 static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
290 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
291 Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
292 return ((CMediaSample*)This)->actual_size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
293 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
294
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
295 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
296 * \brief IMediaSample::SetActualDataLength (specifies the length of valid data in the buffer)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
297 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
298 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
299 * \param[in] __MIDL_0010 length of data in sample in bytes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
300 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
301 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
302 * \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
303 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
304 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
305 static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
306 long __MIDL_0010)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
307 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
308 CMediaSample* cms = (CMediaSample*)This;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
309 Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010);
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
310
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
311 if (__MIDL_0010 > cms->size)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
312 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
313 char* c = cms->own_block;
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
314 Debug printf("CMediaSample - buffer overflow %ld %d %p %p\n",
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
315 __MIDL_0010, ((CMediaSample*)This)->size, cms->own_block, cms->block);
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
316 cms->own_block = (char*) realloc(cms->own_block, (size_t) __MIDL_0010 + SAFETY_ACEL);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
317 if (c == cms->block)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
318 cms->block = cms->own_block;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
319 cms->size = __MIDL_0010;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
320 }
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
321 cms->actual_size = __MIDL_0010;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
322 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
323 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
324
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
325 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
326 * \brief IMediaSample::GetMediaType (retrieves media type, if it changed from previous sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
327 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
328 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
329 * \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
330 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
331 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
332 * \return S_FALSE Media type was not changed from previous sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
333 * \return E_OUTOFMEMORY Insufficient memory
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
334 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
335 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
336 * If media type is not changed from previous sample, ppMediaType is null
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
337 * If method returns S_OK caller should free memory allocated for structure
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
338 * including pbFormat block
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
339 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
340 static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This,
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
341 AM_MEDIA_TYPE** ppMediaType)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
342 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
343 AM_MEDIA_TYPE* t;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
344 Debug printf("CMediaSample_GetMediaType(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
345 if(!ppMediaType)
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
346 return E_INVALIDARG;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
347 if(!((CMediaSample*)This)->type_valid)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
348 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
349 *ppMediaType=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
350 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
351 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
352
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
353 t = &((CMediaSample*)This)->media_type;
9964
6454a2ba2e33 CoTaskMemAlloc/Free vs malloc/free cleanup
alex
parents: 8292
diff changeset
354 // 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
355 *ppMediaType=CreateMediaType(t);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
356 // *ppMediaType=0; //media type was not changed
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
357 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
358 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
359
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
360 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
361 * \brief IMediaType::SetMediaType (specifies media type for sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
362 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
363 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
364 * \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
365 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
366 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
367 * \return E_OUTOFMEMORY insufficient memory
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
368 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
369 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
370 static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
371 AM_MEDIA_TYPE *pMediaType)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
372 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
373 AM_MEDIA_TYPE* t;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
374 Debug printf("CMediaSample_SetMediaType(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
375 if (!pMediaType)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
376 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
377 t = &((CMediaSample*)This)->media_type;
22305
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
378 FreeMediaType(t);
3d1b23cf3d08 Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
voroshil
parents: 22028
diff changeset
379 CopyMediaType(t,pMediaType);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
380 ((CMediaSample*) This)->type_valid=1;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
381
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
382 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
383 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
384
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
385 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
386 * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
387 * in stream)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
388 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
389 * \param[in] This pointer to CMediaSample object
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 * \return S_OK if this sample is break in data stream
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
392 * \return S_FALSE otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
393 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
394 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
395 * 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
396 * samples.
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
397 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
398 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
399 static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
400 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
401 Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
402 return ((CMediaSample*) This)->isDiscontinuity;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
403 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
404
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
405 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
406 * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
407 * in stream)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
408 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
409 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
410 * \param[in] bDiscontinuity if TRUE this sample represents discontinuity with previous sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
411 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
412 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
413 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
414 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
415 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
416 static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
417 long bDiscontinuity)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
418 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
419 Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
420 ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
421 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
422 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
423
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
424 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
425 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
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 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
428 * \param[out] pTimeStart pointer to variable that receives start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
429 * \param[out] pTimeEnd pointer to variable that receives end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
430 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
431 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
432 * \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
433 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
434 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
435 static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
436 /* [out] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
437 /* [out] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
438 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
439 Debug printf("CMediaSample_GetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
440 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
441 *pTimeStart = ((CMediaSample*) This)->time_start;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
442 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
443 *pTimeEnd = ((CMediaSample*) This)->time_end;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
444 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
445 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
446
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
447 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
448 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
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 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
451 * \param[out] pTimeStart pointer to variable that specifies start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
452 * \param[out] pTimeEnd pointer to variable that specifies end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
453 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
454 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
455 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
456 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
457 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
458 * 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
459 * IMEdiaSample::GetTime to return VFW_E_MEDIA_TIME_NOT_SET
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
460 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
461 static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
462 /* [in] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
463 /* [in] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
464 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
465 Debug printf("CMediaSample_SetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
466 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
467 ((CMediaSample*) This)->time_start = *pTimeStart;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
468 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
469 ((CMediaSample*) This)->time_end = *pTimeEnd;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
470 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
471 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
472
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
473 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
474 * \brief CMediaSample::SetPointer (extension for direct memory write of decompressed data)
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 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
477 * \param[in] pointer pointer to an external buffer to store data to
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
478 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
479 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
480 static void CMediaSample_SetPointer(CMediaSample* This, char* pointer)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
481 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
482 Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
483 if (pointer)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
484 This->block = pointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
485 else
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
486 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
487 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
488
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
489 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
490 * \brief CMediaSample::SetPointer (resets pointer to external buffer with internal one)
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 * \param[in] This pointer to CMediaSample object
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 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
495 static void CMediaSample_ResetPointer(CMediaSample* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
496 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
497 Debug printf("CMediaSample_ResetPointer(%p) called\n", This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
498 This->block = This->own_block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
499 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
500
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
501 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
502 * \brief CMediaSample constructor
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 * \param[in] allocator IMemallocator interface of allocator to use
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
505 * \param[in] _size size of internal buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
506 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
507 * \return pointer to CMediaSample object of NULL if error occured
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 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
510 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
511 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
512 CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample));
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
513 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
514 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
515
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
516 // some hack here!
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
517 // it looks like Acelp decoder is actually accessing
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
518 // the allocated memory before it sets the new size for it ???
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
519 // -- maybe it's being initialized with wrong parameters
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
520 // anyway this is fixes the problem somehow with some reserves
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
521 //
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
522 // using different trick for now - in DS_Audio modify sample size
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
523 //if (_size < 0x1000)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
524 // _size = (_size + 0xfff) & ~0xfff;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
525
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
526 This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt));
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
527 This->own_block = (char*) malloc((size_t)_size + SAFETY_ACEL);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
528 This->media_type.pbFormat = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
529
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
530 if (!This->vt || !This->own_block)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
531 {
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
532 CMediaSample_Destroy(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
533 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
534 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
535
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
536 This->vt->QueryInterface = CMediaSample_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
537 This->vt->AddRef = CMediaSample_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
538 This->vt->Release = CMediaSample_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
539 This->vt->GetPointer = CMediaSample_GetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
540 This->vt->GetSize = CMediaSample_GetSize;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
541 This->vt->GetTime = CMediaSample_GetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
542 This->vt->SetTime = CMediaSample_SetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
543 This->vt->IsSyncPoint = CMediaSample_IsSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
544 This->vt->SetSyncPoint = CMediaSample_SetSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
545 This->vt->IsPreroll = CMediaSample_IsPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
546 This->vt->SetPreroll = CMediaSample_SetPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
547 This->vt->GetActualDataLength = CMediaSample_GetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
548 This->vt->SetActualDataLength = CMediaSample_SetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
549 This->vt->GetMediaType = CMediaSample_GetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
550 This->vt->SetMediaType = CMediaSample_SetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
551 This->vt->IsDiscontinuity = CMediaSample_IsDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
552 This->vt->SetDiscontinuity = CMediaSample_SetDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
553 This->vt->GetMediaTime = CMediaSample_GetMediaTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
554 This->vt->SetMediaTime = CMediaSample_SetMediaTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
555
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
556 This->all = allocator;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
557 This->size = _size;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
558 This->refcount = 0; // increased by MemAllocator
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
559 This->actual_size = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
560 This->isPreroll = 0;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
561 This->isDiscontinuity = 1;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
562 This->time_start = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
563 This->time_end = 0;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
564 This->type_valid = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
565 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
566
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
567 This->SetPointer = CMediaSample_SetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
568 This->ResetPointer = CMediaSample_ResetPointer;
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 Debug printf("CMediaSample_Create(%p) called - sample size %d, buffer %p\n",
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
571 This, This->size, This->block);
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 return This;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
574 }