summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2011-07-18 00:28:22 +0300
committerUoti Urpala <uau@mplayer2.org>2011-07-18 00:57:05 +0300
commita4f41308190b79d79a5ac7a50791332e5c1d5600 (patch)
tree5207b45480ff2317544e17118a58e321160f856c /libmpcodecs
parent4e2b15fc5e5f457f62605262a46962b5fd63ff99 (diff)
downloadmpv-a4f41308190b79d79a5ac7a50791332e5c1d5600.tar.bz2
mpv-a4f41308190b79d79a5ac7a50791332e5c1d5600.tar.xz
cleanup: do libav* initialization on startup
Do the global initialization of libavcodec and libavformat (avcodec_register_all(), av_register_all()) immediately on program startup and remove the initialization calls from various individual modules that use libavcodec/libavformat functionality.
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_ffmpeg.c2
-rw-r--r--libmpcodecs/vd_ffmpeg.c14
-rw-r--r--libmpcodecs/vd_ffmpeg.h24
-rw-r--r--libmpcodecs/vf_fspp.c3
-rw-r--r--libmpcodecs/vf_lavc.c3
-rw-r--r--libmpcodecs/vf_lavcdeint.c6
-rw-r--r--libmpcodecs/vf_mcdeint.c3
-rw-r--r--libmpcodecs/vf_screenshot.c1
-rw-r--r--libmpcodecs/vf_spp.c3
-rw-r--r--libmpcodecs/vf_uspp.c3
10 files changed, 0 insertions, 62 deletions
diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c
index b4ecd628c4..fb2d94dbfd 100644
--- a/libmpcodecs/ad_ffmpeg.c
+++ b/libmpcodecs/ad_ffmpeg.c
@@ -25,7 +25,6 @@
#include "options.h"
#include "ad_internal.h"
-#include "vd_ffmpeg.h"
#include "libaf/reorder_ch.h"
#include "mpbswap.h"
@@ -102,7 +101,6 @@ static int init(sh_audio_t *sh_audio)
AVCodec *lavc_codec;
mp_msg(MSGT_DECAUDIO,MSGL_V,"FFmpeg's libavcodec audio codec\n");
- init_avcodec();
lavc_codec = avcodec_find_decoder_by_name(sh_audio->codec->dll);
if(!lavc_codec){
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c
index 0a50415f66..9d33d5d963 100644
--- a/libmpcodecs/vd_ffmpeg.c
+++ b/libmpcodecs/vd_ffmpeg.c
@@ -38,7 +38,6 @@
#include "libmpdemux/stheader.h"
#include "codec-cfg.h"
#include "osdep/numcores.h"
-#include "vd_ffmpeg.h"
static const vd_info_t info = {
"FFmpeg's libavcodec codec family",
@@ -54,8 +53,6 @@ static const vd_info_t info = {
#error palette too large, adapt libmpcodecs/vf.c:vf_get_image
#endif
-int avcodec_initialized=0;
-
typedef struct {
AVCodecContext *avctx;
AVFrame *pic;
@@ -151,15 +148,6 @@ static int control(sh_video_t *sh, int cmd, void *arg, ...){
return CONTROL_UNKNOWN;
}
-void init_avcodec(void)
-{
- if (!avcodec_initialized) {
- avcodec_init();
- avcodec_register_all();
- avcodec_initialized = 1;
- }
-}
-
// init driver
static int init(sh_video_t *sh){
struct lavc_param *lavc_param = &sh->opts->lavc_param;
@@ -168,8 +156,6 @@ static int init(sh_video_t *sh){
AVCodec *lavc_codec;
int do_vis_debug= lavc_param->vismv || (lavc_param->debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP));
- init_avcodec();
-
ctx = sh->context = talloc_zero(NULL, vd_ffmpeg_ctx);
lavc_codec = avcodec_find_decoder_by_name(sh->codec->dll);
diff --git a/libmpcodecs/vd_ffmpeg.h b/libmpcodecs/vd_ffmpeg.h
deleted file mode 100644
index 004d477330..0000000000
--- a/libmpcodecs/vd_ffmpeg.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * This file is part of MPlayer.
- *
- * MPlayer is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * MPlayer is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with MPlayer; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef MPLAYER_VD_FFMPEG_H
-#define MPLAYER_VD_FFMPEG_H
-
-void init_avcodec(void);
-
-#endif /* MPLAYER_VD_FFMPEG_H */
diff --git a/libmpcodecs/vf_fspp.c b/libmpcodecs/vf_fspp.c
index c84422104f..e7e3af8310 100644
--- a/libmpcodecs/vf_fspp.c
+++ b/libmpcodecs/vf_fspp.c
@@ -45,7 +45,6 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#include "libvo/fastmemcpy.h"
#include "libavutil/internal.h"
@@ -637,8 +636,6 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->control= control;
vf->priv=av_mallocz(sizeof(struct vf_priv_s));//assumes align 16 !
- init_avcodec();
-
//vf->priv->avctx= avcodec_alloc_context();
//dsputil_init(&vf->priv->dsp, vf->priv->avctx);
diff --git a/libmpcodecs/vf_lavc.c b/libmpcodecs/vf_lavc.c
index c31044ba21..ba870a8b85 100644
--- a/libmpcodecs/vf_lavc.c
+++ b/libmpcodecs/vf_lavc.c
@@ -27,7 +27,6 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#include "libavcodec/avcodec.h"
struct vf_priv_s {
@@ -138,8 +137,6 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv,0,sizeof(struct vf_priv_s));
- init_avcodec();
-
vf->priv->codec = (AVCodec *)avcodec_find_encoder_by_name("mpeg1video");
if (!vf->priv->codec) {
mp_tmsg(MSGT_VFILTER,MSGL_ERR,"Cannot find codec '%s' in libavcodec...\n", "mpeg1video");
diff --git a/libmpcodecs/vf_lavcdeint.c b/libmpcodecs/vf_lavcdeint.c
index fd564e72af..3a67c8db59 100644
--- a/libmpcodecs/vf_lavcdeint.c
+++ b/libmpcodecs/vf_lavcdeint.c
@@ -27,7 +27,6 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#include "libavcodec/avcodec.h"
@@ -171,11 +170,6 @@ vf_open(vf_instance_t *vf, char *args)
vf->priv = malloc(sizeof(struct vf_priv_s));
memset(vf->priv,0,sizeof(struct vf_priv_s));
- /* This may not technically be necessary just for a deinterlace,
- * but it seems like a good idea.
- */
- init_avcodec();
-
return 1;
}
diff --git a/libmpcodecs/vf_mcdeint.c b/libmpcodecs/vf_mcdeint.c
index 444314ef47..82635e5dfd 100644
--- a/libmpcodecs/vf_mcdeint.c
+++ b/libmpcodecs/vf_mcdeint.c
@@ -61,7 +61,6 @@ Known Issues:
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#define MIN(a,b) ((a) > (b) ? (b) : (a))
#define MAX(a,b) ((a) < (b) ? (b) : (a))
@@ -312,8 +311,6 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
- init_avcodec();
-
vf->priv->mode=0;
vf->priv->parity= -1;
vf->priv->qp=1;
diff --git a/libmpcodecs/vf_screenshot.c b/libmpcodecs/vf_screenshot.c
index 1b5d575fba..655a014886 100644
--- a/libmpcodecs/vf_screenshot.c
+++ b/libmpcodecs/vf_screenshot.c
@@ -301,7 +301,6 @@ static int vf_open(vf_instance_t *vf, char *args)
vf->priv->outbuffer=0;
vf->priv->ctx=0;
vf->priv->avctx = avcodec_alloc_context();
- avcodec_register_all();
if (avcodec_open(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG))) {
mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n");
return 0;
diff --git a/libmpcodecs/vf_spp.c b/libmpcodecs/vf_spp.c
index ab8a7d9dd0..2402d72554 100644
--- a/libmpcodecs/vf_spp.c
+++ b/libmpcodecs/vf_spp.c
@@ -44,7 +44,6 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#include "libvo/fastmemcpy.h"
#define XMIN(a,b) ((a) < (b) ? (a) : (b))
@@ -571,8 +570,6 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
- init_avcodec();
-
vf->priv->avctx= avcodec_alloc_context();
dsputil_init(&vf->priv->dsp, vf->priv->avctx);
diff --git a/libmpcodecs/vf_uspp.c b/libmpcodecs/vf_uspp.c
index 85383716b5..332d59ee22 100644
--- a/libmpcodecs/vf_uspp.c
+++ b/libmpcodecs/vf_uspp.c
@@ -35,7 +35,6 @@
#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
-#include "vd_ffmpeg.h"
#include "libvo/fastmemcpy.h"
#define XMIN(a,b) ((a) < (b) ? (a) : (b))
@@ -354,8 +353,6 @@ static int vf_open(vf_instance_t *vf, char *args){
vf->priv=malloc(sizeof(struct vf_priv_s));
memset(vf->priv, 0, sizeof(struct vf_priv_s));
- init_avcodec();
-
vf->priv->log2_count= 4;
if (args) sscanf(args, "%d:%d:%d", &log2c, &vf->priv->qp, &vf->priv->mode);