# HG changeset patch # User diego # Date 1283589398 0 # Node ID 1ba5eef167aaefef4f44e9a9b4ddee24f62dd66c # Parent f957f330aa6d1ffbcc0195c91b994284482c3da7 Refactor more instances of avcodec_initialized handling into init_avcodec(). This is a leftover from the previous commit. diff -r f957f330aa6d -r 1ba5eef167aa libaf/af_lavcac3enc.c --- a/libaf/af_lavcac3enc.c Sat Sep 04 08:11:31 2010 +0000 +++ b/libaf/af_lavcac3enc.c Sat Sep 04 08:36:38 2010 +0000 @@ -25,6 +25,7 @@ #include #include +#include "libmpcodecs/vd_ffmpeg.h" #include "config.h" #include "af.h" #include "help_mp.h" @@ -46,8 +47,6 @@ int min_channel_num; } af_ac3enc_t; -extern int avcodec_initialized; - // Initialization and runtime control static int control(struct af_instance_s *af, int cmd, void *arg) { @@ -273,11 +272,7 @@ af->data=calloc(1,sizeof(af_data_t)); af->setup=s; - if (!avcodec_initialized){ - avcodec_init(); - avcodec_register_all(); - avcodec_initialized=1; - } + init_avcodec(); s->lavc_acodec = avcodec_find_encoder_by_name("ac3"); if (!s->lavc_acodec) { diff -r f957f330aa6d -r 1ba5eef167aa libmpdemux/demuxer.c --- a/libmpdemux/demuxer.c Sat Sep 04 08:11:31 2010 +0000 +++ b/libmpdemux/demuxer.c Sat Sep 04 08:36:38 2010 +0000 @@ -42,6 +42,7 @@ #include "libaf/af_format.h" #include "libmpcodecs/dec_teletext.h" +#include "libmpcodecs/vd_ffmpeg.h" #ifdef CONFIG_ASS #include "libass/ass.h" @@ -460,12 +461,9 @@ static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parser, unsigned format) { enum CodecID codec_id = CODEC_ID_NONE; - extern int avcodec_initialized; - if (!avcodec_initialized) { - avcodec_init(); - avcodec_register_all(); - avcodec_initialized = 1; - } + + init_avcodec(); + switch (format) { case 0x2000: case 0x332D6361: diff -r f957f330aa6d -r 1ba5eef167aa libvo/jpeg_enc.c --- a/libvo/jpeg_enc.c Sat Sep 04 08:11:31 2010 +0000 +++ b/libvo/jpeg_enc.c Sat Sep 04 08:36:38 2010 +0000 @@ -41,10 +41,9 @@ #include "libavcodec/mpegvideo.h" #include "libavcodec/mjpegenc.h" +#include "libmpcodecs/vd_ffmpeg.h" #include "jpeg_enc.h" -extern int avcodec_initialized; - /* Begin excessive code duplication ************************************/ /* Code coming from mpegvideo.c and mjpeg.c in ../libavcodec ***********/ @@ -320,15 +319,7 @@ j->cheap_upsample = cu; j->bw = b; - /* if libavcodec is used by the decoder then we must not - * initialize again, but if it is not initialized then we must - * initialize it here. */ - if (!avcodec_initialized) { - /* we need to initialize libavcodec */ - avcodec_init(); - avcodec_register_all(); - avcodec_initialized=1; - } + init_avcodec(); if (ff_mjpeg_encode_init(j->s) < 0) { av_free(j->s);