diff options
author | diego <diego@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2010-09-04 08:11:31 +0000 |
---|---|---|
committer | Uoti Urpala <uau@glyph.nonexistent.invalid> | 2010-11-02 04:15:51 +0200 |
commit | f2899d96eecc7de5a3f4b2ef231e514085e467e0 (patch) | |
tree | 43afa4796389fd043b0b6d8172a71b069598bb0b /libmpcodecs/vd_ffmpeg.c | |
parent | a92b4adf61c4f2a77822326d18b983e7e8fb21fb (diff) | |
download | mpv-f2899d96eecc7de5a3f4b2ef231e514085e467e0.tar.bz2 mpv-f2899d96eecc7de5a3f4b2ef231e514085e467e0.tar.xz |
Add central init_avcodec() to avoid duplicated libavcodec init code
Patch by Vlad Seryakov, vseryakov gmail com
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32043 b3059339-0415-0410-9bf9-f77b7e298cf2
Refactor more instances of avcodec_initialized handling into init_avcodec().
This is a leftover from the previous commit.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32044 b3059339-0415-0410-9bf9-f77b7e298cf2
Add missing #include for vd_ffmpeg.h; fixes the warning:
libmpcodecs/vf_zrmjpeg.c:472: warning: implicit declaration of function 'init_avcodec'
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32176 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs/vd_ffmpeg.c')
-rw-r--r-- | libmpcodecs/vd_ffmpeg.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 0101c5d39d..30ee162743 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -37,6 +37,7 @@ #include "img_format.h" #include "libmpdemux/stheader.h" #include "codec-cfg.h" +#include "vd_ffmpeg.h" static const vd_info_t info = { "FFmpeg's libavcodec codec family", @@ -158,6 +159,15 @@ 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; @@ -167,11 +177,7 @@ static int init(sh_video_t *sh){ int lowres_w=0; int do_vis_debug= lavc_param->vismv || (lavc_param->debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP)); - if(!avcodec_initialized){ - avcodec_init(); - avcodec_register_all(); - avcodec_initialized=1; - } + init_avcodec(); ctx = sh->context = talloc_zero(NULL, vd_ffmpeg_ctx); |