[FFmpeg-devel] [PATCH 2/6] FF_OPT_TYPE_* -> AV_OPT_TYPE_*.

Ronald S. Bultje rsbultje at gmail.com
Mon Aug 17 19:34:11 CEST 2015


Hi,

On Mon, Aug 17, 2015 at 1:25 PM, Michael Niedermayer <michael at niedermayer.cc
> wrote:

> On Mon, Aug 17, 2015 at 11:52:15AM -0400, Ronald S. Bultje wrote:
> > ---
> >  libavcodec/dvbsubdec.c       |  6 +++---
> >  libavcodec/frwu.c            |  2 +-
> >  libavcodec/h264.c            |  4 ++--
> >  libavcodec/libvpxenc.c       |  6 +++---
> >  libavcodec/mpeg4videodec.c   |  4 ++--
> >  libavcodec/s302m.c           | 10 +++++-----
> >  libavcodec/v210dec.c         |  2 +-
> >  libavformat/hls.c            |  2 +-
> >  libavformat/mov.c            |  6 +++---
> >  libavformat/tedcaptionsdec.c |  2 +-
> >  10 files changed, 22 insertions(+), 22 deletions(-)
> >
> > diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
> > index ff835ab..8aa203a 100644
> > --- a/libavcodec/dvbsubdec.c
> > +++ b/libavcodec/dvbsubdec.c
> > @@ -1718,9 +1718,9 @@ end:
> >
> >  #define DS AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_SUBTITLE_PARAM
> >  static const AVOption options[] = {
> > -    {"compute_edt", "compute end of time using pts or timeout",
> offsetof(DVBSubContext, compute_edt), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 1,
> DS},
> > -    {"compute_clut", "compute clut when not available(-1) or always(1)
> or never(0)", offsetof(DVBSubContext, compute_clut), FF_OPT_TYPE_INT, {.i64
> = -1}, -1, 1, DS},
> > -    {"dvb_substream", "", offsetof(DVBSubContext, substream),
> FF_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS},
> > +    {"compute_edt", "compute end of time using pts or timeout",
> offsetof(DVBSubContext, compute_edt), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1,
> DS},
> > +    {"compute_clut", "compute clut when not available(-1) or always(1)
> or never(0)", offsetof(DVBSubContext, compute_clut), AV_OPT_TYPE_INT, {.i64
> = -1}, -1, 1, DS},
> > +    {"dvb_substream", "", offsetof(DVBSubContext, substream),
> AV_OPT_TYPE_INT, {.i64 = -1}, -1, 63, DS},
> >      {NULL}
> >  };
> >  static const AVClass dvbsubdec_class = {
> > diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c
> > index db4c1ba..1aabefe 100644
> > --- a/libavcodec/frwu.c
> > +++ b/libavcodec/frwu.c
> > @@ -103,7 +103,7 @@ static int decode_frame(AVCodecContext *avctx, void
> *data, int *got_frame,
> >  }
> >
> >  static const AVOption frwu_options[] = {
> > -    {"change_field_order", "Change field order", offsetof(FRWUContext,
> change_field_order), FF_OPT_TYPE_INT,
> > +    {"change_field_order", "Change field order", offsetof(FRWUContext,
> change_field_order), AV_OPT_TYPE_INT,
> >       {.i64 = 0}, 0, 1, AV_OPT_FLAG_DECODING_PARAM |
> AV_OPT_FLAG_VIDEO_PARAM},
> >      {NULL}
> >  };
> > diff --git a/libavcodec/h264.c b/libavcodec/h264.c
> > index 24e209c..ca0a4a5 100644
> > --- a/libavcodec/h264.c
> > +++ b/libavcodec/h264.c
> > @@ -1946,8 +1946,8 @@ static av_cold int h264_decode_end(AVCodecContext
> *avctx)
> >  #define OFFSET(x) offsetof(H264Context, x)
> >  #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
> >  static const AVOption h264_options[] = {
> > -    {"is_avc", "is avc", offsetof(H264Context, is_avc),
> FF_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 0},
> > -    {"nal_length_size", "nal_length_size", offsetof(H264Context,
> nal_length_size), FF_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
> > +    {"is_avc", "is avc", offsetof(H264Context, is_avc),
> AV_OPT_TYPE_INT, {.i64 = 0}, 0, 1, 0},
> > +    {"nal_length_size", "nal_length_size", offsetof(H264Context,
> nal_length_size), AV_OPT_TYPE_INT, {.i64 = 0}, 0, 4, 0},
> >      { "enable_er", "Enable error resilience on damaged frames
> (unsafe)", OFFSET(enable_er), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VD },
> >      { NULL },
> >  };
> > diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
> > index 3db617d..58e8f5d 100644
> > --- a/libavcodec/libvpxenc.c
> > +++ b/libavcodec/libvpxenc.c
> > @@ -985,9 +985,9 @@ static int vp8_encode(AVCodecContext *avctx,
> AVPacket *pkt,
> >  #define LEGACY_OPTIONS \
> >      {"speed", "", offsetof(VP8Context, cpu_used), AV_OPT_TYPE_INT,
> {.i64 = 1}, -16, 16, VE}, \
> >      {"quality", "", offsetof(VP8Context, deadline), AV_OPT_TYPE_INT,
> {.i64 = VPX_DL_GOOD_QUALITY}, INT_MIN, INT_MAX, VE, "quality"}, \
>
> > -    {"vp8flags", "", offsetof(VP8Context, flags), FF_OPT_TYPE_FLAGS,
> {.i64 = 0}, 0, UINT_MAX, VE, "flags"}, \
> > -    {"error_resilient", "enable error resilience", 0,
> FF_OPT_TYPE_CONST, {.dbl = VP8F_ERROR_RESILIENT}, INT_MIN, INT_MAX, VE,
> "flags"}, \
> > -    {"altref", "enable use of alternate reference frames (VP8/2-pass
> only)", 0, FF_OPT_TYPE_CONST, {.dbl = VP8F_AUTO_ALT_REF}, INT_MIN, INT_MAX,
> VE, "flags"}, \
> > +    {"vp8flags", "", offsetof(VP8Context, flags), AV_OPT_TYPE_FLAGS,
> {.i64 = 0}, 0, UINT_MAX, VE, "flags"}, \
> > +    {"error_resilient", "enable error resilience", 0,
> AV_OPT_TYPE_CONST, {.dbl = VP8F_ERROR_RESILIENT}, INT_MIN, INT_MAX, VE,
> "flags"}, \
> > +    {"altref", "enable use of alternate reference frames (VP8/2-pass
> only)", 0, AV_OPT_TYPE_CONST, {.dbl = VP8F_AUTO_ALT_REF}, INT_MIN, INT_MAX,
> VE, "flags"}, \
>
> not related to the patch but is .i64 + .dbl correct here ?


Good point, I can add an extra patch that changes that to i64. (In practice
it's a boolean, (double==0) == (int==0) and (double!=0) == (int!=0), so I
guess it doesn't make a difference, but it's obviously kind of obfuscatory.)

Ronald


More information about the ffmpeg-devel mailing list