[MPlayer-cvslog] r33342 - in trunk: av_opts.c libmpcodecs/vd_ffmpeg.c

philipl subversion at mplayerhq.hu
Sun May 1 17:25:42 CEST 2011


Author: philipl
Date: Sun May  1 17:25:41 2011
New Revision: 33342

Log:
Command Line Options: Support FFmpeg per-codec AVOptions.

This change extends the existing support for arbitrary FFmpeg options
to also include per-codec AVOptions.

You can now pass per-codec options in the same way as global options
are passed:

mplayer -lavdopts o=<option>

Modified:
   trunk/av_opts.c
   trunk/libmpcodecs/vd_ffmpeg.c

Modified: trunk/av_opts.c
==============================================================================
--- trunk/av_opts.c	Fri Apr 29 15:05:49 2011	(r33341)
+++ trunk/av_opts.c	Sun May  1 17:25:41 2011	(r33342)
@@ -27,6 +27,10 @@
 
 int parse_avopts(void *v, char *str){
     char *start;
+
+    if (!v)
+        return -1;
+
     start= str= strdup(str);
 
     while(str && *str){

Modified: trunk/libmpcodecs/vd_ffmpeg.c
==============================================================================
--- trunk/libmpcodecs/vd_ffmpeg.c	Fri Apr 29 15:05:49 2011	(r33341)
+++ trunk/libmpcodecs/vd_ffmpeg.c	Sun May  1 17:25:41 2011	(r33342)
@@ -304,6 +304,7 @@ static int init(sh_video_t *sh){
     ctx->pic = avcodec_alloc_frame();
     ctx->avctx = avcodec_alloc_context();
     avctx = ctx->avctx;
+    avcodec_get_context_defaults3(avctx, lavc_codec);
     avctx->opaque = sh;
     avctx->codec_type = AVMEDIA_TYPE_VIDEO;
     avctx->codec_id = lavc_codec->id;
@@ -346,7 +347,9 @@ static int init(sh_video_t *sh){
     avctx->skip_frame = str2AVDiscard(lavc_param_skip_frame_str);
 
     if(lavc_avopt){
-        if(parse_avopts(avctx, lavc_avopt) < 0){
+        if (parse_avopts(avctx, lavc_avopt) < 0 &&
+            (!lavc_codec->priv_class ||
+             parse_avopts(avctx->priv_data, lavc_avopt) < 0)) {
             mp_msg(MSGT_DECVIDEO, MSGL_ERR, "Your options /%s/ look like gibberish to me pal\n", lavc_avopt);
             uninit(sh);
             return 0;


More information about the MPlayer-cvslog mailing list