[FFmpeg-cvslog] libx264: support passing arbitrary parameters.

Michael Niedermayer michaelni at gmx.at
Tue May 24 23:20:01 CEST 2011


On Wed, May 18, 2011 at 11:47:27PM +0200, Stefano Sabatini wrote:
> On date Wednesday 2011-05-18 17:18:24 +0200, Michael Niedermayer wrote:
> > ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed May 18 15:39:40 2011 +0200| [d1f9621d39b80add240d09daf1328ceae613bcd4] | committer: Michael Niedermayer
> > 
> > libx264: support passing arbitrary parameters.
> > 
> > Idea taken from mencoder. This should fix conflicts with presets as long as
> > the new system is used.
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > 
> > > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d1f9621d39b80add240d09daf1328ceae613bcd4
> > ---
> > 
> >  libavcodec/libx264.c |   13 +++++++++++++
> >  1 files changed, 13 insertions(+), 0 deletions(-)
> > 
> > diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
> > index eae21fe..519dc51 100644
> > --- a/libavcodec/libx264.c
> > +++ b/libavcodec/libx264.c
> > @@ -42,6 +42,7 @@ typedef struct X264Context {
> >      int fastfirstpass;
> >      char *stats;
> >      char *weightp;
> > +    char *x264opts;
> >  } X264Context;
> >  
> >  static void X264_log(void *p, int level, const char *fmt, va_list args)
> > @@ -344,6 +345,17 @@ static av_cold int X264_init(AVCodecContext *avctx)
> >  
> >      OPT_STR("level", x4->level);
> >  
> > +    if(x4->x264opts){
> > +        const char *p= x4->x264opts;
> > +        while(p){
> > +            char param[256]={0}, val[256]={0};
> 
> > +            sscanf(p, "%255[^:=]=%255[^:]", param, val);
> 
> Maybe av_get_token() can help to make this more robust.
> 
> > +            OPT_STR(param, val);
> > +            p= strchr(p, ':');
> > +            p+=!!p;
> > +        }
> > +    }
> > +
> >      if (x4->fastfirstpass)
> >          x264_param_apply_fastfirstpass(&x4->params);
> >  
> > @@ -416,6 +428,7 @@ static const AVOption options[] = {
> >      {"level", "Specify level (as defined by Annex A)", OFFSET(level), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
> >      {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
> >      {"wpredp", "Weighted prediction for P-frames", OFFSET(weightp), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
> > +    {"x264opts", "x264 options", OFFSET(x264opts), FF_OPT_TYPE_STRING, 0, 0, 0, VE},
> 
> If I understand this correctly, I suppose the new option allows to
> remove the old ones, right (but we should keep it for backward
> compatibility of course)?

yes but it seems not everyone agrees

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-cvslog/attachments/20110524/caecc026/attachment.asc>


More information about the ffmpeg-cvslog mailing list