annotate loader/dshow/cmediasample.c @ 22028:24dc4ec0d08d

Doxygen comments for used DirectShow methods. Info was got from DirectShow SDK.
author voroshil
date Sun, 28 Jan 2007 16:53:33 +0000
parents 3bf0d70b4c7f
children 3d1b23cf3d08
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
1 /*
18783
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
2 * Modified for use with MPlayer, detailed changelog at
0783dd397f74 CVS --> Subversion in copyright notices
diego
parents: 15166
diff changeset
3 * http://svn.mplayerhq.hu/mplayer/trunk/
15166
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
4 * $Id$
f5537cc95b02 Mark modified imported files as such to comply with GPL ¡ø2a.
diego
parents: 9964
diff changeset
5 */
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"
2069
ce45cce7f7a5 sync with avifile
arpi
parents: 1545
diff changeset
8 #include "wine/winerror.h"
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9 #include <stdio.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 #include <string.h>
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
11 #include <stdlib.h>
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
12
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
13 /*
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
14 * currently hack to make some extra room for DS Acel codec which
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
15 * seems to overwrite allocated memory - FIXME better later
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
16 * check the buffer allocation
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
17 */
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
18 static const int SAFETY_ACEL = 1024;
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
19
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
20 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
21 * \brief IPin::QueryInternalConnections (retries pin's internal connections)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
22 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
23 * \param[in] This pointer to IPin interface
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
24 * \param[out] apPin Array that receives pins, internally connected to this
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
25 * \param[in,out] nPint Size of an array
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
26 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
27 * \return S_OK - success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
28 * \return S_FALSE - pin rejects media type
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
29 * \return E_NOTIMPL - not implemented
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
30 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
31 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
32 static long STDCALL CMediaSample_QueryInterface(IUnknown* This,
7386
174e2a58b4cd avifile sync - 95% cosmetics 5% bug
arpi
parents: 3467
diff changeset
33 /* [in] */ const GUID* iid,
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
34 /* [iid_is][out] */ void **ppv)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
35 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
36 Debug printf("CMediaSample_QueryInterface(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
37 if (!ppv)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
38 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
39 if (memcmp(iid, &IID_IUnknown, sizeof(*iid)) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
40 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
41 *ppv = (void*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
42 ((IMediaSample*) This)->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
43 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
44 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
45 if (memcmp(iid, &IID_IMediaSample, sizeof(*iid)) == 0)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
46 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
47 *ppv = (void*)This;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
48 ((IMediaSample*) This)->vt->AddRef(This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
49 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
50 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
51 return E_NOINTERFACE;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
52 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
53
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
54 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
55 * \brief IUnknown::AddRef (increases reference counter for interface)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
56 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
57 * \param[in] This pointer to IUnknown class
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
58 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
59 * \return new value of reference counter
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
60 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
61 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
62 * Return value should be used only for debug purposes
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
63 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
64 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
65 static long STDCALL CMediaSample_AddRef(IUnknown* This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
66 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
67 Debug printf("CMediaSample_AddRef(%p) called\n", This);
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
68 ((CMediaSample*)This)->refcount++;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
70 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
71
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
72 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
73 * \brief CMediaSample destructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
74 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
75 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
76 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
77 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
78 void CMediaSample_Destroy(CMediaSample* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
79 {
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 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
82 free(This->vt);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
83 free(This->own_block);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
84 if (This->media_type.pbFormat)
9964
6454a2ba2e33 CoTaskMemAlloc/Free vs malloc/free cleanup
alex
parents: 8292
diff changeset
85 free(This->media_type.pbFormat);
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);
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
355 (*ppMediaType) = malloc(sizeof(AM_MEDIA_TYPE));
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
356 **ppMediaType = *t;
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
357 (*ppMediaType)->pbFormat = malloc(t->cbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
358 memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
359 // *ppMediaType=0; //media type was not changed
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
360 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
361 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
362
22028
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 * \brief IMediaType::SetMediaType (specifies media type for sample)
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 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
367 * \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type
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 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
370 * \return E_OUTOFMEMORY insufficient memory
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
371 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
372 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
373 static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
374 AM_MEDIA_TYPE *pMediaType)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
375 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
376 AM_MEDIA_TYPE* t;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
377 Debug printf("CMediaSample_SetMediaType(%p) called\n", This);
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
378 if (!pMediaType)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
379 return E_INVALIDARG;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
380 t = &((CMediaSample*)This)->media_type;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
381 if (t->pbFormat)
9964
6454a2ba2e33 CoTaskMemAlloc/Free vs malloc/free cleanup
alex
parents: 8292
diff changeset
382 free(t->pbFormat);
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
383 t = pMediaType;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
384 if (t->cbFormat)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
385 {
18878
3bf0d70b4c7f rm unnecesary casts from void* - part 2
reynaldo
parents: 18783
diff changeset
386 t->pbFormat = malloc(t->cbFormat);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
387 memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
388 }
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
389 else
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
390 t->pbFormat = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
391 ((CMediaSample*) This)->type_valid=1;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
392
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
393 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
394 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
395
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
396 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
397 * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
398 * in stream)
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 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
401 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
402 * \return S_OK if this sample is break in data stream
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
403 * \return S_FALSE otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
404 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
405 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
406 * 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
407 * samples.
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 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
410 static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
411 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
412 Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
413 return ((CMediaSample*) This)->isDiscontinuity;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
414 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
415
22028
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 * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
418 * in stream)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
419 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
420 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
421 * \param[in] bDiscontinuity if TRUE this sample represents discontinuity with previous sample
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
422 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
423 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
424 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
425 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
426 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
427 static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
428 long bDiscontinuity)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
429 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
430 Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
431 ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
432 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
433 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
434
22028
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 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
437 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
438 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
439 * \param[out] pTimeStart pointer to variable that receives start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
440 * \param[out] pTimeEnd pointer to variable that receives end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
441 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
442 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
443 * \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
444 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
445 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
446 static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
447 /* [out] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
448 /* [out] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
449 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
450 Debug printf("CMediaSample_GetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
451 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
452 *pTimeStart = ((CMediaSample*) This)->time_start;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
453 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
454 *pTimeEnd = ((CMediaSample*) This)->time_end;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
455 return 0;
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
456 }
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
457
22028
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 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
460 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
461 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
462 * \param[out] pTimeStart pointer to variable that specifies start time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
463 * \param[out] pTimeEnd pointer to variable that specifies end time
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
464 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
465 * \return S_OK success
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
466 * \return apropriate error code otherwise
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
467 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
468 * \remarks
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
469 * 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
470 * IMEdiaSample::GetTime to return VFW_E_MEDIA_TIME_NOT_SET
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
471 */
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
472 static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
473 /* [in] */ LONGLONG *pTimeStart,
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
474 /* [in] */ LONGLONG *pTimeEnd)
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
475 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
476 Debug printf("CMediaSample_SetMediaTime(%p) called\n", This);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
477 if (pTimeStart)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
478 ((CMediaSample*) This)->time_start = *pTimeStart;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
479 if (pTimeEnd)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
480 ((CMediaSample*) This)->time_end = *pTimeEnd;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
481 return 0;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
482 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
483
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
484 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
485 * \brief CMediaSample::SetPointer (extension for direct memory write of decompressed data)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
486 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
487 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
488 * \param[in] pointer pointer to an external buffer to store data to
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 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
491 static void CMediaSample_SetPointer(CMediaSample* This, char* pointer)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
492 {
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
493 Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
494 if (pointer)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
495 This->block = pointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
496 else
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
497 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
498 }
1545
da26060c81ef big avifile sync - from now we have common code
arpi
parents: 713
diff changeset
499
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
500 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
501 * \brief CMediaSample::SetPointer (resets pointer to external buffer with internal one)
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
502 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
503 * \param[in] This pointer to CMediaSample object
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
504 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
505 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
506 static void CMediaSample_ResetPointer(CMediaSample* This)
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
507 {
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
508 Debug printf("CMediaSample_ResetPointer(%p) called\n", This);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
509 This->block = This->own_block;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
510 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
511
22028
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
512 /**
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
513 * \brief CMediaSample constructor
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
514 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
515 * \param[in] allocator IMemallocator interface of allocator to use
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
516 * \param[in] _size size of internal buffer
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
517 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
518 * \return pointer to CMediaSample object of NULL if error occured
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
519 *
24dc4ec0d08d Doxygen comments for used DirectShow methods.
voroshil
parents: 18878
diff changeset
520 */
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
521 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size)
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
522 {
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
523 CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample));
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
524 if (!This)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
525 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
526
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
527 // some hack here!
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
528 // it looks like Acelp decoder is actually accessing
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
529 // the allocated memory before it sets the new size for it ???
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
530 // -- maybe it's being initialized with wrong parameters
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
531 // anyway this is fixes the problem somehow with some reserves
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
532 //
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
533 // using different trick for now - in DS_Audio modify sample size
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
534 //if (_size < 0x1000)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
535 // _size = (_size + 0xfff) & ~0xfff;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
536
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
537 This->vt = (IMediaSample_vt*) malloc(sizeof(IMediaSample_vt));
8292
9533c26c0806 avifile sync (mostly cosmetics)
arpi
parents: 7386
diff changeset
538 This->own_block = (char*) malloc((size_t)_size + SAFETY_ACEL);
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
539 This->media_type.pbFormat = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
540
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
541 if (!This->vt || !This->own_block)
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
542 {
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
543 CMediaSample_Destroy(This);
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
544 return NULL;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
545 }
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
546
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
547 This->vt->QueryInterface = CMediaSample_QueryInterface;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
548 This->vt->AddRef = CMediaSample_AddRef;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
549 This->vt->Release = CMediaSample_Release;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
550 This->vt->GetPointer = CMediaSample_GetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
551 This->vt->GetSize = CMediaSample_GetSize;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
552 This->vt->GetTime = CMediaSample_GetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
553 This->vt->SetTime = CMediaSample_SetTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
554 This->vt->IsSyncPoint = CMediaSample_IsSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
555 This->vt->SetSyncPoint = CMediaSample_SetSyncPoint;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
556 This->vt->IsPreroll = CMediaSample_IsPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
557 This->vt->SetPreroll = CMediaSample_SetPreroll;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
558 This->vt->GetActualDataLength = CMediaSample_GetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
559 This->vt->SetActualDataLength = CMediaSample_SetActualDataLength;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
560 This->vt->GetMediaType = CMediaSample_GetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
561 This->vt->SetMediaType = CMediaSample_SetMediaType;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
562 This->vt->IsDiscontinuity = CMediaSample_IsDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
563 This->vt->SetDiscontinuity = CMediaSample_SetDiscontinuity;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
564 This->vt->GetMediaTime = CMediaSample_GetMediaTime;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
565 This->vt->SetMediaTime = CMediaSample_SetMediaTime;
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->all = allocator;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
568 This->size = _size;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
569 This->refcount = 0; // increased by MemAllocator
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
570 This->actual_size = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
571 This->isPreroll = 0;
3467
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
572 This->isDiscontinuity = 1;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
573 This->time_start = 0;
e3bbf44dbab2 avifile sync
arpi
parents: 3056
diff changeset
574 This->time_end = 0;
3056
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
575 This->type_valid = 0;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
576 This->block = This->own_block;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
577
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
578 This->SetPointer = CMediaSample_SetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
579 This->ResetPointer = CMediaSample_ResetPointer;
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
580
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
581 Debug printf("CMediaSample_Create(%p) called - sample size %d, buffer %p\n",
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
582 This, This->size, This->block);
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
583
213b35f84cf3 C++ -> C (import from avifile cvs)
arpi
parents: 2069
diff changeset
584 return This;
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
585 }