Mercurial > mplayer.hg
comparison libmpcodecs/vd_ffmpeg.c @ 31959:f957f330aa6d
Introduce init_avcodec function to avoid duplicated FFmpeg initializations.
Vlad Seryakov, vseryakov gmail com
author | diego |
---|---|
date | Sat, 04 Sep 2010 08:11:31 +0000 |
parents | 7eaaed7331f3 |
children | c08363dc5320 |
comparison
equal
deleted
inserted
replaced
31958:4cccb69779ef | 31959:f957f330aa6d |
---|---|
30 #include "libavutil/intreadwrite.h" | 30 #include "libavutil/intreadwrite.h" |
31 #include "mpbswap.h" | 31 #include "mpbswap.h" |
32 #include "fmt-conversion.h" | 32 #include "fmt-conversion.h" |
33 | 33 |
34 #include "vd_internal.h" | 34 #include "vd_internal.h" |
35 #include "vd_ffmpeg.h" | |
35 | 36 |
36 static const vd_info_t info = { | 37 static const vd_info_t info = { |
37 "FFmpeg's libavcodec codec family", | 38 "FFmpeg's libavcodec codec family", |
38 "ffmpeg", | 39 "ffmpeg", |
39 "A'rpi", | 40 "A'rpi", |
247 mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2); | 248 mp_msg(MSGT_DECVIDEO, MSGL_INFO, MSGTR_MPCODECS_XVMCAcceleratedMPEG2); |
248 avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; | 249 avctx->slice_flags = SLICE_FLAG_CODED_ORDER|SLICE_FLAG_ALLOW_FIELD; |
249 } | 250 } |
250 } | 251 } |
251 | 252 |
253 void init_avcodec(void) | |
254 { | |
255 if (!avcodec_initialized) { | |
256 avcodec_init(); | |
257 avcodec_register_all(); | |
258 avcodec_initialized = 1; | |
259 av_log_set_callback(mp_msp_av_log_callback); | |
260 } | |
261 } | |
262 | |
252 // init driver | 263 // init driver |
253 static int init(sh_video_t *sh){ | 264 static int init(sh_video_t *sh){ |
254 AVCodecContext *avctx; | 265 AVCodecContext *avctx; |
255 vd_ffmpeg_ctx *ctx; | 266 vd_ffmpeg_ctx *ctx; |
256 AVCodec *lavc_codec; | 267 AVCodec *lavc_codec; |
257 int lowres_w=0; | 268 int lowres_w=0; |
258 int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP)); | 269 int do_vis_debug= lavc_param_vismv || (lavc_param_debug&(FF_DEBUG_VIS_MB_TYPE|FF_DEBUG_VIS_QP)); |
259 | 270 |
260 if(!avcodec_initialized){ | 271 init_avcodec(); |
261 avcodec_init(); | |
262 avcodec_register_all(); | |
263 avcodec_initialized=1; | |
264 av_log_set_callback(mp_msp_av_log_callback); | |
265 } | |
266 | 272 |
267 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx)); | 273 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx)); |
268 if (!ctx) | 274 if (!ctx) |
269 return 0; | 275 return 0; |
270 memset(ctx, 0, sizeof(vd_ffmpeg_ctx)); | 276 memset(ctx, 0, sizeof(vd_ffmpeg_ctx)); |