1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

cleanup & memleak fix

Originally committed as revision 3095 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Michael Niedermayer 2004-04-30 17:42:58 +00:00
parent 60f41d13ef
commit eea8c08fa8
12 changed files with 10 additions and 54 deletions

View File

@ -738,8 +738,6 @@ static int decode_end(AVCodecContext *avctx){
}
free_vlc(&f->pre_vlc);
avcodec_default_free_buffers(avctx);
return 0;
}

View 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;
}

View 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);

View 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,
};

View 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

View 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

View File

@ -917,8 +917,6 @@ static int decode_end(AVCodecContext *avctx)
free_vlc(&s->vlc[i]);
}
avcodec_default_free_buffers(avctx);
return 0;
}

View 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;
}

View 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++)

View 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=

View 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;

View 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,
};