diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-01-08 19:16:21 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-01-08 19:16:21 +0000 |
commit | 479bdb2c08e8789d580c5c6f5a602499b25438f9 (patch) | |
tree | 2b9b63468b8425b83bc112e8acc0cc68b4ac515c /libmpcodecs/vd_ffmpeg.c | |
parent | 2ac89bd3885fd96de680a2965c105d1b77ace1ca (diff) | |
download | mpv-479bdb2c08e8789d580c5c6f5a602499b25438f9.tar.bz2 mpv-479bdb2c08e8789d580c5c6f5a602499b25438f9.tar.xz |
change malloc and free to av_ variants where needed.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14432 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_ffmpeg.c')
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 36 |
1 files changed, 14 insertions, 22 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 5a7ddfbe9a..42a1fa2f66 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -281,7 +281,7 @@ static int init(sh_video_t *sh){ { avctx->flags |= CODEC_FLAG_EXTERN_HUFF; avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); - avctx->extradata = malloc(avctx->extradata_size); + avctx->extradata = av_malloc(avctx->extradata_size); memcpy(avctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER), avctx->extradata_size); @@ -303,7 +303,7 @@ static int init(sh_video_t *sh){ || sh->format == mmioFOURCC('R', 'V', '4', '0') ){ avctx->extradata_size= 8; - avctx->extradata = malloc(avctx->extradata_size); + avctx->extradata = av_malloc(avctx->extradata_size); if(sh->bih->biSize!=sizeof(*sh->bih)+8){ /* only 1 packet per frame & sub_id from fourcc */ ((uint32_t*)avctx->extradata)[0] = 0; @@ -338,7 +338,7 @@ static int init(sh_video_t *sh){ )) { avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); - avctx->extradata = malloc(avctx->extradata_size); + avctx->extradata = av_malloc(avctx->extradata_size); memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size); } /* Pass palette to codec */ @@ -359,7 +359,7 @@ static int init(sh_video_t *sh){ if (sh->ImageDesc && sh->format == mmioFOURCC('S','V','Q','3')){ avctx->extradata_size = (*(int*)sh->ImageDesc) - sizeof(int); - avctx->extradata = malloc(avctx->extradata_size); + avctx->extradata = av_malloc(avctx->extradata_size); memcpy(avctx->extradata, ((int*)sh->ImageDesc)+1, avctx->extradata_size); } @@ -395,22 +395,14 @@ static void uninit(sh_video_t *sh){ if (avcodec_close(avctx) < 0) mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); - if (avctx->extradata_size) - free(avctx->extradata); - avctx->extradata=NULL; + av_freep(&avctx->extradata); #if LIBAVCODEC_BUILD >= 4689 - if (avctx->palctrl) - free(avctx->palctrl); - avctx->palctrl=NULL; + av_freep(&avctx->palctrl); #endif - if(avctx->slice_offset!=NULL) - free(avctx->slice_offset); - avctx->slice_offset=NULL; - - if (avctx) - free(avctx); - if (ctx->pic) - free(ctx->pic); + av_freep(&avctx->slice_offset); + + av_freep(&avctx); + av_freep(&ctx->pic); if (ctx) free(ctx); } @@ -601,7 +593,7 @@ static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ #if LIBAVCODEC_BUILD >= 4689 // Palette support: libavcodec copies palette to *data[1] if (mpi->bpp == 8) - mpi->planes[1] = malloc(AVPALETTE_SIZE); + mpi->planes[1] = av_malloc(AVPALETTE_SIZE); #endif pic->data[0]= mpi->planes[0]; @@ -677,8 +669,8 @@ static void release_buffer(struct AVCodecContext *avctx, AVFrame *pic){ } // Palette support: free palette buffer allocated in get_buffer - if ( mpi && (mpi->bpp == 8) && (mpi->planes[1] != NULL)) - free(mpi->planes[1]); + if ( mpi && (mpi->bpp == 8)) + av_freep(&mpi->planes[1]); #if LIBAVCODEC_BUILD >= 4644 if(pic->type!=FF_BUFFER_TYPE_USER){ @@ -751,7 +743,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ dp_hdr_t *hdr= (dp_hdr_t*)data; if(avctx->slice_offset==NULL) - avctx->slice_offset= malloc(sizeof(int)*1000); + avctx->slice_offset= av_malloc(sizeof(int)*1000); // for(i=0; i<25; i++) printf("%02X ", ((uint8_t*)data)[i]); |