Mercurial > mplayer.hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
22027:0b262e00bc99 | 22028:24dc4ec0d08d |
---|---|
15 * seems to overwrite allocated memory - FIXME better later | 15 * seems to overwrite allocated memory - FIXME better later |
16 * check the buffer allocation | 16 * check the buffer allocation |
17 */ | 17 */ |
18 static const int SAFETY_ACEL = 1024; | 18 static const int SAFETY_ACEL = 1024; |
19 | 19 |
20 /** | |
21 * \brief IPin::QueryInternalConnections (retries pin's internal connections) | |
22 * | |
23 * \param[in] This pointer to IPin interface | |
24 * \param[out] apPin Array that receives pins, internally connected to this | |
25 * \param[in,out] nPint Size of an array | |
26 * | |
27 * \return S_OK - success | |
28 * \return S_FALSE - pin rejects media type | |
29 * \return E_NOTIMPL - not implemented | |
30 * | |
31 */ | |
20 static long STDCALL CMediaSample_QueryInterface(IUnknown* This, | 32 static long STDCALL CMediaSample_QueryInterface(IUnknown* This, |
21 /* [in] */ const GUID* iid, | 33 /* [in] */ const GUID* iid, |
22 /* [iid_is][out] */ void **ppv) | 34 /* [iid_is][out] */ void **ppv) |
23 { | 35 { |
24 Debug printf("CMediaSample_QueryInterface(%p) called\n", This); | 36 Debug printf("CMediaSample_QueryInterface(%p) called\n", This); |
37 return 0; | 49 return 0; |
38 } | 50 } |
39 return E_NOINTERFACE; | 51 return E_NOINTERFACE; |
40 } | 52 } |
41 | 53 |
54 /** | |
55 * \brief IUnknown::AddRef (increases reference counter for interface) | |
56 * | |
57 * \param[in] This pointer to IUnknown class | |
58 * | |
59 * \return new value of reference counter | |
60 * | |
61 * \remarks | |
62 * Return value should be used only for debug purposes | |
63 * | |
64 */ | |
42 static long STDCALL CMediaSample_AddRef(IUnknown* This) | 65 static long STDCALL CMediaSample_AddRef(IUnknown* This) |
43 { | 66 { |
44 Debug printf("CMediaSample_AddRef(%p) called\n", This); | 67 Debug printf("CMediaSample_AddRef(%p) called\n", This); |
45 ((CMediaSample*)This)->refcount++; | 68 ((CMediaSample*)This)->refcount++; |
46 return 0; | 69 return 0; |
47 } | 70 } |
48 | 71 |
72 /** | |
73 * \brief CMediaSample destructor | |
74 * | |
75 * \param[in] This pointer to CMediaSample object | |
76 * | |
77 */ | |
49 void CMediaSample_Destroy(CMediaSample* This) | 78 void CMediaSample_Destroy(CMediaSample* This) |
50 { | 79 { |
51 | 80 |
52 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); | 81 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); |
53 free(This->vt); | 82 free(This->vt); |
55 if (This->media_type.pbFormat) | 84 if (This->media_type.pbFormat) |
56 free(This->media_type.pbFormat); | 85 free(This->media_type.pbFormat); |
57 free(This); | 86 free(This); |
58 } | 87 } |
59 | 88 |
89 /** | |
90 * \brief IUnknown::Release (desreases reference counter for interface) | |
91 * | |
92 * \param[in] This pointer to IUnknown class | |
93 * | |
94 * \return new value of reference counter | |
95 * | |
96 * \remarks | |
97 * When reference counter reaches zero calls destructor | |
98 * Return value should be used only for debug purposes | |
99 * | |
100 */ | |
60 static long STDCALL CMediaSample_Release(IUnknown* This) | 101 static long STDCALL CMediaSample_Release(IUnknown* This) |
61 { | 102 { |
62 CMediaSample* parent = (CMediaSample*)This; | 103 CMediaSample* parent = (CMediaSample*)This; |
63 Debug printf("CMediaSample_Release(%p) called (new ref:%d)\n", | 104 Debug printf("CMediaSample_Release(%p) called (new ref:%d)\n", |
64 This, ((CMediaSample*)This)->refcount-1); | 105 This, ((CMediaSample*)This)->refcount-1); |
69 (IMediaSample*)This); | 110 (IMediaSample*)This); |
70 } | 111 } |
71 return 0; | 112 return 0; |
72 } | 113 } |
73 | 114 |
115 /** | |
116 * \brief IMediaSample::GetPointer (retrieves a read/write pointer to the media sample's buffer) | |
117 * | |
118 * \param[in] This pointer to CMediaSample object | |
119 * \param[out] address of variable that receives pointer to sample's buffer | |
120 * | |
121 * \return S_OK success | |
122 * \return apropriate error otherwise | |
123 * | |
124 * \note The calles should not free or reallocate buffer | |
125 * | |
126 */ | |
74 static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This, | 127 static HRESULT STDCALL CMediaSample_GetPointer(IMediaSample* This, |
75 /* [out] */ BYTE** ppBuffer) | 128 /* [out] */ BYTE** ppBuffer) |
76 { | 129 { |
77 Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size); | 130 Debug printf("CMediaSample_GetPointer(%p) called -> %p, size: %d %d\n", This, ((CMediaSample*) This)->block, ((CMediaSample*)This)->actual_size, ((CMediaSample*)This)->size); |
78 if (!ppBuffer) | 131 if (!ppBuffer) |
79 return E_INVALIDARG; | 132 return E_INVALIDARG; |
80 *ppBuffer = (BYTE*) ((CMediaSample*) This)->block; | 133 *ppBuffer = (BYTE*) ((CMediaSample*) This)->block; |
81 return 0; | 134 return 0; |
82 } | 135 } |
83 | 136 |
137 /** | |
138 * \brief IMediaSample::GetSize (retrieves a size of buffer in bytes) | |
139 * | |
140 * \param[in] This pointer to CMediaSample object | |
141 * | |
142 * \return size of buffer in bytes | |
143 * | |
144 */ | |
84 static long STDCALL CMediaSample_GetSize(IMediaSample * This) | 145 static long STDCALL CMediaSample_GetSize(IMediaSample * This) |
85 { | 146 { |
86 Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size); | 147 Debug printf("CMediaSample_GetSize(%p) called -> %d\n", This, ((CMediaSample*) This)->size); |
87 return ((CMediaSample*) This)->size; | 148 return ((CMediaSample*) This)->size; |
88 } | 149 } |
89 | 150 |
151 /** | |
152 * \brief IMediaSample::GetTime (retrieves a stream time at wich sample sould start and finish) | |
153 * | |
154 * \param[in] This pointer to CMediaSample object | |
155 * \param[out] pTimeStart pointer to variable that receives start time | |
156 * \param[out] pTimeEnd pointer to variable that receives end time | |
157 * | |
158 * \return S_OK success | |
159 * \return VFW_E_NO_STOP_TIME The sample has valid start time, but no stop time | |
160 * \return VFW_E_SAMPLE_TIME_NOT_SET The sample is not time-stamped | |
161 * | |
162 * \remarks | |
163 * Both values are relative to stream time | |
164 * | |
165 */ | |
90 static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This, | 166 static HRESULT STDCALL CMediaSample_GetTime(IMediaSample * This, |
91 /* [out] */ REFERENCE_TIME *pTimeStart, | 167 /* [out] */ REFERENCE_TIME *pTimeStart, |
92 /* [out] */ REFERENCE_TIME *pTimeEnd) | 168 /* [out] */ REFERENCE_TIME *pTimeEnd) |
93 { | 169 { |
94 Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This); | 170 Debug printf("CMediaSample_GetTime(%p) called (UNIMPLEMENTED)\n", This); |
95 return E_NOTIMPL; | 171 return E_NOTIMPL; |
96 } | 172 } |
97 | 173 |
174 /** | |
175 * \brief IMediaSample::SetTime (sets a stream time at wich sample sould start and finish) | |
176 * | |
177 * \param[in] This pointer to CMediaSample object | |
178 * \param[out] pTimeStart pointer to variable that contains start time | |
179 * \param[out] pTimeEnd pointer to variable that contains end time | |
180 * | |
181 * \return S_OK success | |
182 * \return apropriate error otherwise | |
183 * | |
184 * \remarks | |
185 * Both values are relative to stream time | |
186 * To invalidate the stream times set pTimeStart and pTimeEnd to NULL. this will cause | |
187 * IMEdiaSample::GetTime to return VFW_E_SAMPLE_TIME_NOT_SET | |
188 * | |
189 */ | |
98 static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This, | 190 static HRESULT STDCALL CMediaSample_SetTime(IMediaSample * This, |
99 /* [in] */ REFERENCE_TIME *pTimeStart, | 191 /* [in] */ REFERENCE_TIME *pTimeStart, |
100 /* [in] */ REFERENCE_TIME *pTimeEnd) | 192 /* [in] */ REFERENCE_TIME *pTimeEnd) |
101 { | 193 { |
102 Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This); | 194 Debug printf("CMediaSample_SetTime(%p) called (UNIMPLEMENTED)\n", This); |
103 return E_NOTIMPL; | 195 return E_NOTIMPL; |
104 } | 196 } |
105 | 197 |
198 /** | |
199 * \brief IMediaSample::IsSyncPoint (determines if start of this sample is sync point) | |
200 * | |
201 * \param[in] This pointer to CMediaSample object | |
202 * | |
203 * \return S_OK start of this sample is sync point | |
204 * \return S_FALSE start of this sample is not sync point | |
205 * | |
206 * \remarks | |
207 * If bTemporalCompression of AM_MEDIA_TYPE is FALSE, all samples are sync points. | |
208 * | |
209 */ | |
106 static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This) | 210 static HRESULT STDCALL CMediaSample_IsSyncPoint(IMediaSample * This) |
107 { | 211 { |
108 Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This); | 212 Debug printf("CMediaSample_IsSyncPoint(%p) called\n", This); |
109 if (((CMediaSample*)This)->isSyncPoint) | 213 if (((CMediaSample*)This)->isSyncPoint) |
110 return 0; | 214 return 0; |
111 return 1; | 215 return 1; |
112 } | 216 } |
113 | 217 |
218 /** | |
219 * \brief IMediaSample::SetSyncPoint (specifies if start of this sample is sync point) | |
220 * | |
221 * \param[in] This pointer to CMediaSample object | |
222 * \param[in] bIsSyncPoint specifies whether this is sync point or not | |
223 * | |
224 * \return S_OK success | |
225 * \return apropriate error code otherwise | |
226 * | |
227 */ | |
114 static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This, | 228 static HRESULT STDCALL CMediaSample_SetSyncPoint(IMediaSample * This, |
115 long bIsSyncPoint) | 229 long bIsSyncPoint) |
116 { | 230 { |
117 Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This); | 231 Debug printf("CMediaSample_SetSyncPoint(%p) called\n", This); |
118 ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint; | 232 ((CMediaSample*)This)->isSyncPoint = bIsSyncPoint; |
119 return 0; | 233 return 0; |
120 } | 234 } |
121 | 235 |
236 /** | |
237 * \brief IMediaSample::IsPreroll (determines if this sample is preroll sample) | |
238 * | |
239 * \param[in] This pointer to CMediaSample object | |
240 * | |
241 * \return S_OK if this sample is preroll sample | |
242 * \return S_FALSE if this sample is not preroll sample | |
243 * | |
244 * \remarks | |
245 * Preroll samples are processed but not displayed. They are lokated in media stream | |
246 * before displayable samples. | |
247 * | |
248 */ | |
122 static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This) | 249 static HRESULT STDCALL CMediaSample_IsPreroll(IMediaSample * This) |
123 { | 250 { |
124 Debug printf("CMediaSample_IsPreroll(%p) called\n", This); | 251 Debug printf("CMediaSample_IsPreroll(%p) called\n", This); |
125 | 252 |
126 if (((CMediaSample*)This)->isPreroll) | 253 if (((CMediaSample*)This)->isPreroll) |
127 return 0;//S_OK | 254 return 0;//S_OK |
128 | 255 |
129 return 1;//S_FALSE | 256 return 1;//S_FALSE |
130 } | 257 } |
131 | 258 |
259 /** | |
260 * \brief IMediaSample::SetPreroll (specifies if this sample is preroll sample) | |
261 * | |
262 * \param[in] This pointer to CMediaSample object | |
263 * \param[in] bIsPreroll specifies whether this sample is preroll sample or not | |
264 * | |
265 * \return S_OK success | |
266 * \return apropriate error code otherwise | |
267 * | |
268 * \remarks | |
269 * Preroll samples are processed but not displayed. They are lokated in media stream | |
270 * before displayable samples. | |
271 * | |
272 */ | |
132 static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This, | 273 static HRESULT STDCALL CMediaSample_SetPreroll(IMediaSample * This, |
133 long bIsPreroll) | 274 long bIsPreroll) |
134 { | 275 { |
135 Debug printf("CMediaSample_SetPreroll(%p) called\n", This); | 276 Debug printf("CMediaSample_SetPreroll(%p) called\n", This); |
136 ((CMediaSample*)This)->isPreroll=bIsPreroll; | 277 ((CMediaSample*)This)->isPreroll=bIsPreroll; |
137 return 0; | 278 return 0; |
138 } | 279 } |
139 | 280 |
281 /** | |
282 * \brief IMediaSample::GetActualDataLength (retrieves the length of valid data in the buffer) | |
283 * | |
284 * \param[in] This pointer to CMediaSample object | |
285 * | |
286 * \return length of valid data in buffer in bytes | |
287 * | |
288 */ | |
140 static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This) | 289 static long STDCALL CMediaSample_GetActualDataLength(IMediaSample* This) |
141 { | 290 { |
142 Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size); | 291 Debug printf("CMediaSample_GetActualDataLength(%p) called -> %d\n", This, ((CMediaSample*)This)->actual_size); |
143 return ((CMediaSample*)This)->actual_size; | 292 return ((CMediaSample*)This)->actual_size; |
144 } | 293 } |
145 | 294 |
295 /** | |
296 * \brief IMediaSample::SetActualDataLength (specifies the length of valid data in the buffer) | |
297 * | |
298 * \param[in] This pointer to CMediaSample object | |
299 * \param[in] __MIDL_0010 length of data in sample in bytes | |
300 * | |
301 * \return S_OK success | |
302 * \return VFW_E_BUFFER_OVERFLOW length specified by parameter is larger than buffer size | |
303 * | |
304 */ | |
146 static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, | 305 static HRESULT STDCALL CMediaSample_SetActualDataLength(IMediaSample* This, |
147 long __MIDL_0010) | 306 long __MIDL_0010) |
148 { | 307 { |
149 CMediaSample* cms = (CMediaSample*)This; | 308 CMediaSample* cms = (CMediaSample*)This; |
150 Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010); | 309 Debug printf("CMediaSample_SetActualDataLength(%p, %ld) called\n", This, __MIDL_0010); |
161 } | 320 } |
162 cms->actual_size = __MIDL_0010; | 321 cms->actual_size = __MIDL_0010; |
163 return 0; | 322 return 0; |
164 } | 323 } |
165 | 324 |
325 /** | |
326 * \brief IMediaSample::GetMediaType (retrieves media type, if it changed from previous sample) | |
327 * | |
328 * \param[in] This pointer to CMediaSample object | |
329 * \param[out] ppMediaType address of variable that receives pointer to AM_MEDIA_TYPE. | |
330 * | |
331 * \return S_OK success | |
332 * \return S_FALSE Media type was not changed from previous sample | |
333 * \return E_OUTOFMEMORY Insufficient memory | |
334 * | |
335 * \remarks | |
336 * If media type is not changed from previous sample, ppMediaType is null | |
337 * If method returns S_OK caller should free memory allocated for structure | |
338 * including pbFormat block | |
339 */ | |
166 static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This, | 340 static HRESULT STDCALL CMediaSample_GetMediaType(IMediaSample* This, |
167 AM_MEDIA_TYPE** ppMediaType) | 341 AM_MEDIA_TYPE** ppMediaType) |
168 { | 342 { |
169 AM_MEDIA_TYPE* t; | 343 AM_MEDIA_TYPE* t; |
170 Debug printf("CMediaSample_GetMediaType(%p) called\n", This); | 344 Debug printf("CMediaSample_GetMediaType(%p) called\n", This); |
184 memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); | 358 memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); |
185 // *ppMediaType=0; //media type was not changed | 359 // *ppMediaType=0; //media type was not changed |
186 return 0; | 360 return 0; |
187 } | 361 } |
188 | 362 |
363 /** | |
364 * \brief IMediaType::SetMediaType (specifies media type for sample) | |
365 * | |
366 * \param[in] This pointer to CMediaSample object | |
367 * \param[in] pMediaType pointer to AM_MEDIA_TYPE specifies new media type | |
368 * | |
369 * \return S_OK success | |
370 * \return E_OUTOFMEMORY insufficient memory | |
371 * | |
372 */ | |
189 static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This, | 373 static HRESULT STDCALL CMediaSample_SetMediaType(IMediaSample * This, |
190 AM_MEDIA_TYPE *pMediaType) | 374 AM_MEDIA_TYPE *pMediaType) |
191 { | 375 { |
192 AM_MEDIA_TYPE* t; | 376 AM_MEDIA_TYPE* t; |
193 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); | 377 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); |
207 ((CMediaSample*) This)->type_valid=1; | 391 ((CMediaSample*) This)->type_valid=1; |
208 | 392 |
209 return 0; | 393 return 0; |
210 } | 394 } |
211 | 395 |
396 /** | |
397 * \brief IMediaSample::IsDiscontinuity (determines if this sample represents data break | |
398 * in stream) | |
399 * | |
400 * \param[in] This pointer to CMediaSample object | |
401 * | |
402 * \return S_OK if this sample is break in data stream | |
403 * \return S_FALSE otherwise | |
404 * | |
405 * \remarks | |
406 * Discontinuity occures when filter seeks to different place in the stream or when drops | |
407 * samples. | |
408 * | |
409 */ | |
212 static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This) | 410 static HRESULT STDCALL CMediaSample_IsDiscontinuity(IMediaSample * This) |
213 { | 411 { |
214 Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This); | 412 Debug printf("CMediaSample_IsDiscontinuity(%p) called\n", This); |
215 return ((CMediaSample*) This)->isDiscontinuity; | 413 return ((CMediaSample*) This)->isDiscontinuity; |
216 } | 414 } |
217 | 415 |
416 /** | |
417 * \brief IMediaSample::IsDiscontinuity (specifies whether this sample represents data break | |
418 * in stream) | |
419 * | |
420 * \param[in] This pointer to CMediaSample object | |
421 * \param[in] bDiscontinuity if TRUE this sample represents discontinuity with previous sample | |
422 * | |
423 * \return S_OK success | |
424 * \return apropriate error code otherwise | |
425 * | |
426 */ | |
218 static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This, | 427 static HRESULT STDCALL CMediaSample_SetDiscontinuity(IMediaSample * This, |
219 long bDiscontinuity) | 428 long bDiscontinuity) |
220 { | 429 { |
221 Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity); | 430 Debug printf("CMediaSample_SetDiscontinuity(%p) called (%ld)\n", This, bDiscontinuity); |
222 ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity; | 431 ((CMediaSample*) This)->isDiscontinuity = bDiscontinuity; |
223 return 0; | 432 return 0; |
224 } | 433 } |
225 | 434 |
435 /** | |
436 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample) | |
437 * | |
438 * \param[in] This pointer to CMediaSample object | |
439 * \param[out] pTimeStart pointer to variable that receives start time | |
440 * \param[out] pTimeEnd pointer to variable that receives end time | |
441 * | |
442 * \return S_OK success | |
443 * \return VFW_E_MEDIA_TIME_NOT_SET The sample is not time-stamped | |
444 * | |
445 */ | |
226 static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This, | 446 static HRESULT STDCALL CMediaSample_GetMediaTime(IMediaSample * This, |
227 /* [out] */ LONGLONG *pTimeStart, | 447 /* [out] */ LONGLONG *pTimeStart, |
228 /* [out] */ LONGLONG *pTimeEnd) | 448 /* [out] */ LONGLONG *pTimeEnd) |
229 { | 449 { |
230 Debug printf("CMediaSample_GetMediaTime(%p) called\n", This); | 450 Debug printf("CMediaSample_GetMediaTime(%p) called\n", This); |
233 if (pTimeEnd) | 453 if (pTimeEnd) |
234 *pTimeEnd = ((CMediaSample*) This)->time_end; | 454 *pTimeEnd = ((CMediaSample*) This)->time_end; |
235 return 0; | 455 return 0; |
236 } | 456 } |
237 | 457 |
458 /** | |
459 * \brief IMediaSample::GetMediaTime (retrieves the media times of this sample) | |
460 * | |
461 * \param[in] This pointer to CMediaSample object | |
462 * \param[out] pTimeStart pointer to variable that specifies start time | |
463 * \param[out] pTimeEnd pointer to variable that specifies end time | |
464 * | |
465 * \return S_OK success | |
466 * \return apropriate error code otherwise | |
467 * | |
468 * \remarks | |
469 * To invalidate the media times set pTimeStart and pTimeEnd to NULL. this will cause | |
470 * IMEdiaSample::GetTime to return VFW_E_MEDIA_TIME_NOT_SET | |
471 */ | |
238 static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This, | 472 static HRESULT STDCALL CMediaSample_SetMediaTime(IMediaSample * This, |
239 /* [in] */ LONGLONG *pTimeStart, | 473 /* [in] */ LONGLONG *pTimeStart, |
240 /* [in] */ LONGLONG *pTimeEnd) | 474 /* [in] */ LONGLONG *pTimeEnd) |
241 { | 475 { |
242 Debug printf("CMediaSample_SetMediaTime(%p) called\n", This); | 476 Debug printf("CMediaSample_SetMediaTime(%p) called\n", This); |
245 if (pTimeEnd) | 479 if (pTimeEnd) |
246 ((CMediaSample*) This)->time_end = *pTimeEnd; | 480 ((CMediaSample*) This)->time_end = *pTimeEnd; |
247 return 0; | 481 return 0; |
248 } | 482 } |
249 | 483 |
250 // extension for direct memory write or decompressed data | 484 /** |
485 * \brief CMediaSample::SetPointer (extension for direct memory write of decompressed data) | |
486 * | |
487 * \param[in] This pointer to CMediaSample object | |
488 * \param[in] pointer pointer to an external buffer to store data to | |
489 * | |
490 */ | |
251 static void CMediaSample_SetPointer(CMediaSample* This, char* pointer) | 491 static void CMediaSample_SetPointer(CMediaSample* This, char* pointer) |
252 { | 492 { |
253 Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer); | 493 Debug printf("CMediaSample_SetPointer(%p) called -> %p\n", This, pointer); |
254 if (pointer) | 494 if (pointer) |
255 This->block = pointer; | 495 This->block = pointer; |
256 else | 496 else |
257 This->block = This->own_block; | 497 This->block = This->own_block; |
258 } | 498 } |
259 | 499 |
500 /** | |
501 * \brief CMediaSample::SetPointer (resets pointer to external buffer with internal one) | |
502 * | |
503 * \param[in] This pointer to CMediaSample object | |
504 * | |
505 */ | |
260 static void CMediaSample_ResetPointer(CMediaSample* This) | 506 static void CMediaSample_ResetPointer(CMediaSample* This) |
261 { | 507 { |
262 Debug printf("CMediaSample_ResetPointer(%p) called\n", This); | 508 Debug printf("CMediaSample_ResetPointer(%p) called\n", This); |
263 This->block = This->own_block; | 509 This->block = This->own_block; |
264 } | 510 } |
265 | 511 |
512 /** | |
513 * \brief CMediaSample constructor | |
514 * | |
515 * \param[in] allocator IMemallocator interface of allocator to use | |
516 * \param[in] _size size of internal buffer | |
517 * | |
518 * \return pointer to CMediaSample object of NULL if error occured | |
519 * | |
520 */ | |
266 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size) | 521 CMediaSample* CMediaSampleCreate(IMemAllocator* allocator, int _size) |
267 { | 522 { |
268 CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample)); | 523 CMediaSample* This = (CMediaSample*) malloc(sizeof(CMediaSample)); |
269 if (!This) | 524 if (!This) |
270 return NULL; | 525 return NULL; |