]> rtime.felk.cvut.cz Git - frescor/ffmpeg.git/commitdiff
cleanup & memleak fix
authormichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 30 Apr 2004 17:42:58 +0000 (17:42 +0000)
committermichael <michael@9553f0bf-9b14-0410-a0b8-cfaf0461ba5b>
Fri, 30 Apr 2004 17:42:58 +0000 (17:42 +0000)
git-svn-id: file:///var/local/repositories/ffmpeg/trunk@3095 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

12 files changed:
libavcodec/4xm.c
libavcodec/asv1.c
libavcodec/avcodec.h
libavcodec/cljr.c
libavcodec/dv.c
libavcodec/ffv1.c
libavcodec/huffyuv.c
libavcodec/mdec.c
libavcodec/mjpeg.c
libavcodec/mpegvideo.c
libavcodec/utils.c
libavcodec/vcr1.c

index 6544d88d0f86cd9fb1d8e2e2efa4e4c232da5d32..50dc4a55bd6b3ea32126d4cd2838cb1443e0bbf3 100644 (file)
@@ -738,8 +738,6 @@ static int decode_end(AVCodecContext *avctx){
     }
     free_vlc(&f->pre_vlc);
     
-    avcodec_default_free_buffers(avctx);
-
     return 0;
 }
 
index 87b13c637b5931de2e90d47f69ffdc37b4713d8f..24916590f8e518597c91f501400a00b77a3cfac5 100644 (file)
@@ -613,8 +613,6 @@ static int decode_end(AVCodecContext *avctx){
     av_freep(&a->picture.qscale_table);
     a->bitstream_buffer_size=0;
     
-    avcodec_default_free_buffers(avctx);
-
     return 0;
 }
 
index 6a4d223769f199be67a67fa3ea3168fb0d19be2c..e6eb11f9550a0011048dbea4048dd1f2a862f2ac 100644 (file)
@@ -1934,7 +1934,6 @@ AVFrame *avcodec_alloc_frame(void);
 
 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic);
 void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic);
-void avcodec_default_free_buffers(AVCodecContext *s);
 
 int avcodec_thread_init(AVCodecContext *s, int thread_count);
 void avcodec_thread_free(AVCodecContext *s);
index 382a77ac7d7d12ade53795f49b043ca6fa63e93a..912a050fbd27d5c5e60a127b181c18e6756ca6fd 100644 (file)
@@ -133,13 +133,6 @@ static int encode_init(AVCodecContext *avctx){
     return 0;
 }
 
-static int decode_end(AVCodecContext *avctx){
-
-    avcodec_default_free_buffers(avctx);
-
-    return 0;
-}
-
 AVCodec cljr_decoder = {
     "cljr",
     CODEC_TYPE_VIDEO,
@@ -147,7 +140,7 @@ AVCodec cljr_decoder = {
     sizeof(CLJRContext),
     decode_init,
     NULL,
-    decode_end,
+    NULL,
     decode_frame,
     CODEC_CAP_DR1,
 };
index 5f1eaaa3b4b47f378a6deb90f29c953f1e7e7c99..c62c964fbc9471d85a006f8f8bd5f63ed732a0dc 100644 (file)
@@ -235,12 +235,6 @@ static int dvvideo_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int dvvideo_end(AVCodecContext *avctx)
-{
-    avcodec_default_free_buffers(avctx);    
-    return 0;
-}
-
 // #define VLC_DEBUG
 // #define printf(...) av_log(NULL, AV_LOG_ERROR, __VA_ARGS__)
 
@@ -954,7 +948,7 @@ AVCodec dvvideo_encoder = {
     sizeof(DVVideoContext),
     dvvideo_init,
     dvvideo_encode_frame,
-    dvvideo_end,
+    NULL,
     NULL,
     CODEC_CAP_DR1,
     NULL
@@ -967,7 +961,7 @@ AVCodec dvvideo_decoder = {
     sizeof(DVVideoContext),
     dvvideo_init,
     NULL,
-    dvvideo_end,
+    NULL,
     dvvideo_decode_frame,
     CODEC_CAP_DR1,
     NULL
index eefce937054a90592497862166b53b9d5f510ca7..aacbe3ed68d504b084ec2d62f312c3df95ae569a 100644 (file)
@@ -1018,22 +1018,6 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, uint8
     return bytes_read;
 }
 
-static int decode_end(AVCodecContext *avctx)
-{
-    FFV1Context *s = avctx->priv_data;
-    int i;
-    
-    if(avctx->get_buffer == avcodec_default_get_buffer){
-        for(i=0; i<4; i++){
-            av_freep(&s->picture.base[i]);
-            s->picture.data[i]= NULL;
-        }
-        av_freep(&s->picture.opaque);
-    }
-
-    return 0;
-}
-
 AVCodec ffv1_decoder = {
     "ffv1",
     CODEC_TYPE_VIDEO,
@@ -1041,7 +1025,7 @@ AVCodec ffv1_decoder = {
     sizeof(FFV1Context),
     decode_init,
     NULL,
-    decode_end,
+    NULL,
     decode_frame,
     CODEC_CAP_DR1 /*| CODEC_CAP_DRAW_HORIZ_BAND*/,
     NULL
index 4047a6a9380beb49ff3194e168038f90bd5059fb..210d454190ab29d263df724889ab0272cef8bb1d 100644 (file)
@@ -916,8 +916,6 @@ static int decode_end(AVCodecContext *avctx)
     for(i=0; i<3; i++){
         free_vlc(&s->vlc[i]);
     }
-    
-    avcodec_default_free_buffers(avctx);
 
     return 0;
 }
index faf3cef3168058adefb9090aa35bac370efa31db..219a39b25726f2cd168e61f9bd6efc23bf2fc6e8 100644 (file)
@@ -257,8 +257,6 @@ static int decode_end(AVCodecContext *avctx){
     av_freep(&a->picture.qscale_table);
     a->bitstream_buffer_size=0;
     
-    avcodec_default_free_buffers(avctx);
-
     return 0;
 }
 
index 255a82d2cbfc406697a424cf92daedd581aaadf5..78a620fd3c2f6709af1fe810e1754df5f4b167c8 100644 (file)
@@ -1340,7 +1340,7 @@ static int mjpeg_decode_scan(MJpegDecodeContext *s){
                         (h * mb_x + x) * 8;
                     if (s->interlaced && s->bottom_field)
                         ptr += s->linesize[c] >> 1;
-//printf("%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8);
+//av_log(NULL, AV_LOG_DEBUG, "%d %d %d %d %d %d %d %d \n", mb_x, mb_y, x, y, c, s->bottom_field, (v * mb_y + y) * 8, (h * mb_x + x) * 8);
                     s->idct_put(ptr, s->linesize[c], s->block);
                     if (++x == h) {
                         x = 0;
@@ -2171,7 +2171,6 @@ static int mjpeg_decode_end(AVCodecContext *avctx)
 
     av_free(s->buffer);
     av_free(s->qscale_table);
-    avcodec_default_free_buffers(avctx);
     
     for(i=0;i<2;i++) {
         for(j=0;j<4;j++)
index 1fa39e0f1fb2a2ea17dc145b35fc3448bceb6a09..196ba01853afb63b85e0643ae2ca7147a6bada72 100644 (file)
@@ -847,7 +847,6 @@ void MPV_common_end(MpegEncContext *s)
         }
     }
     av_freep(&s->picture);
-    avcodec_default_free_buffers(s->avctx);
     s->context_initialized = 0;
     s->last_picture_ptr=
     s->next_picture_ptr=
index ba4387c1c86db8bf82825a7f81c080263f11781f..59e9a3058f5d75a4f9abf8af18342b8d779959ce 100644 (file)
@@ -29,6 +29,8 @@
 #include "mpegvideo.h"
 #include <stdarg.h>
 
+static void avcodec_default_free_buffers(AVCodecContext *s);
+
 void *av_mallocz(unsigned int size)
 {
     void *ptr;
@@ -514,6 +516,7 @@ int avcodec_close(AVCodecContext *avctx)
 {
     if (avctx->codec->close)
         avctx->codec->close(avctx);
+    avcodec_default_free_buffers(avctx);
     av_freep(&avctx->priv_data);
     avctx->codec = NULL;
     return 0;
@@ -738,7 +741,7 @@ void avcodec_flush_buffers(AVCodecContext *avctx)
         avctx->codec->flush(avctx);
 }
 
-void avcodec_default_free_buffers(AVCodecContext *s){
+static void avcodec_default_free_buffers(AVCodecContext *s){
     int i, j;
 
     if(s->internal_buffer==NULL) return;
index 4b8c9fc41d8acd67282b47983c7267032f8668bc..05539452a46ff099dc4fadf0da35eba2c8cf1f62 100644 (file)
@@ -165,13 +165,6 @@ static int encode_init(AVCodecContext *avctx){
     return 0;
 }
 
-static int decode_end(AVCodecContext *avctx){
-
-    avcodec_default_free_buffers(avctx);
-
-    return 0;
-}
-
 AVCodec vcr1_decoder = {
     "vcr1",
     CODEC_TYPE_VIDEO,
@@ -179,7 +172,7 @@ AVCodec vcr1_decoder = {
     sizeof(VCR1Context),
     decode_init,
     NULL,
-    decode_end,
+    NULL,
     decode_frame,
     CODEC_CAP_DR1,
 };