[MPlayer-cvslog] r32044 - in trunk: libaf/af_lavcac3enc.c libmpdemux/demuxer.c libvo/jpeg_enc.c

diego subversion at mplayerhq.hu
Sat Sep 4 10:36:38 CEST 2010


Author: diego
Date: Sat Sep  4 10:36:38 2010
New Revision: 32044

Log:
Refactor more instances of avcodec_initialized handling into init_avcodec().
This is a leftover from the previous commit.

Modified:
   trunk/libaf/af_lavcac3enc.c
   trunk/libmpdemux/demuxer.c
   trunk/libvo/jpeg_enc.c

Modified: trunk/libaf/af_lavcac3enc.c
==============================================================================
--- trunk/libaf/af_lavcac3enc.c	Sat Sep  4 10:11:31 2010	(r32043)
+++ trunk/libaf/af_lavcac3enc.c	Sat Sep  4 10:36:38 2010	(r32044)
@@ -25,6 +25,7 @@
 #include <string.h>
 #include <inttypes.h>
 
+#include "libmpcodecs/vd_ffmpeg.h"
 #include "config.h"
 #include "af.h"
 #include "help_mp.h"
@@ -46,8 +47,6 @@ typedef struct af_ac3enc_s {
     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 @@ static int af_open(af_instance_t* af){
     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) {

Modified: trunk/libmpdemux/demuxer.c
==============================================================================
--- trunk/libmpdemux/demuxer.c	Sat Sep  4 10:11:31 2010	(r32043)
+++ trunk/libmpdemux/demuxer.c	Sat Sep  4 10:36:38 2010	(r32044)
@@ -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 ds_add_packet_internal(demux
 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:

Modified: trunk/libvo/jpeg_enc.c
==============================================================================
--- trunk/libvo/jpeg_enc.c	Sat Sep  4 10:11:31 2010	(r32043)
+++ trunk/libvo/jpeg_enc.c	Sat Sep  4 10:36:38 2010	(r32044)
@@ -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 @@ jpeg_enc_t *jpeg_enc_init(int w, int h, 
 	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);


More information about the MPlayer-cvslog mailing list