Mercurial > mplayer.hg
comparison loader/dshow/cmediasample.c @ 22305:3d1b23cf3d08
Moving duplicated (and sometimes wrong) AM_MEDIA_TYPE related code into separate file
author | voroshil |
---|---|
date | Fri, 23 Feb 2007 09:58:01 +0000 |
parents | 24dc4ec0d08d |
children | bf37d4ba4b65 |
comparison
equal
deleted
inserted
replaced
22304:254733f57707 | 22305:3d1b23cf3d08 |
---|---|
3 * http://svn.mplayerhq.hu/mplayer/trunk/ | 3 * http://svn.mplayerhq.hu/mplayer/trunk/ |
4 * $Id$ | 4 * $Id$ |
5 */ | 5 */ |
6 | 6 |
7 #include "cmediasample.h" | 7 #include "cmediasample.h" |
8 #include "mediatype.h" | |
8 #include "wine/winerror.h" | 9 #include "wine/winerror.h" |
9 #include <stdio.h> | 10 #include <stdio.h> |
10 #include <string.h> | 11 #include <string.h> |
11 #include <stdlib.h> | 12 #include <stdlib.h> |
12 | 13 |
79 { | 80 { |
80 | 81 |
81 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); | 82 Debug printf("CMediaSample_Destroy(%p) called (ref:%d)\n", This, This->refcount); |
82 free(This->vt); | 83 free(This->vt); |
83 free(This->own_block); | 84 free(This->own_block); |
84 if (This->media_type.pbFormat) | 85 FreeMediaType(&(This->media_type)); |
85 free(This->media_type.pbFormat); | |
86 free(This); | 86 free(This); |
87 } | 87 } |
88 | 88 |
89 /** | 89 /** |
90 * \brief IUnknown::Release (desreases reference counter for interface) | 90 * \brief IUnknown::Release (desreases reference counter for interface) |
350 return 1; | 350 return 1; |
351 } | 351 } |
352 | 352 |
353 t = &((CMediaSample*)This)->media_type; | 353 t = &((CMediaSample*)This)->media_type; |
354 // if(t.pbFormat)free(t.pbFormat); | 354 // if(t.pbFormat)free(t.pbFormat); |
355 (*ppMediaType) = malloc(sizeof(AM_MEDIA_TYPE)); | 355 *ppMediaType=CreateMediaType(t); |
356 **ppMediaType = *t; | |
357 (*ppMediaType)->pbFormat = malloc(t->cbFormat); | |
358 memcpy((*ppMediaType)->pbFormat, t->pbFormat, t->cbFormat); | |
359 // *ppMediaType=0; //media type was not changed | 356 // *ppMediaType=0; //media type was not changed |
360 return 0; | 357 return 0; |
361 } | 358 } |
362 | 359 |
363 /** | 360 /** |
376 AM_MEDIA_TYPE* t; | 373 AM_MEDIA_TYPE* t; |
377 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); | 374 Debug printf("CMediaSample_SetMediaType(%p) called\n", This); |
378 if (!pMediaType) | 375 if (!pMediaType) |
379 return E_INVALIDARG; | 376 return E_INVALIDARG; |
380 t = &((CMediaSample*)This)->media_type; | 377 t = &((CMediaSample*)This)->media_type; |
381 if (t->pbFormat) | 378 FreeMediaType(t); |
382 free(t->pbFormat); | 379 CopyMediaType(t,pMediaType); |
383 t = pMediaType; | |
384 if (t->cbFormat) | |
385 { | |
386 t->pbFormat = malloc(t->cbFormat); | |
387 memcpy(t->pbFormat, pMediaType->pbFormat, t->cbFormat); | |
388 } | |
389 else | |
390 t->pbFormat = 0; | |
391 ((CMediaSample*) This)->type_valid=1; | 380 ((CMediaSample*) This)->type_valid=1; |
392 | 381 |
393 return 0; | 382 return 0; |
394 } | 383 } |
395 | 384 |