On Sun, Jan 25, 2015 at 02:31:33AM +0100, wm4 wrote: > On Sun, 25 Jan 2015 02:28:01 +0100 > Michael Niedermayer <michae...@gmx.at> wrote: > > > On Sun, Jan 25, 2015 at 02:16:58AM +0100, wm4 wrote: > > > On Sun, 25 Jan 2015 01:56:30 +0100 > > > Michael Niedermayer <michae...@gmx.at> wrote: > > > > > > > TODO: APIChanges/version bump > > > > > > > > Signed-off-by: Michael Niedermayer <michae...@gmx.at> > > > > --- > > > > ffmpeg.c | 30 ++++-------------------------- > > > > libavformat/avformat.h | 6 ++++++ > > > > libavformat/options.c | 30 ++++++++++++++++++++++++++++++ > > > > 3 files changed, 40 insertions(+), 26 deletions(-) > > > > > > > > diff --git a/ffmpeg.c b/ffmpeg.c > > > > index b836448..af576c7 100644 > > > > --- a/ffmpeg.c > > > > +++ b/ffmpeg.c > > > > @@ -2970,32 +2970,10 @@ static int transcode_init(void) > > > > } > > > > > > > > if (ost->disposition) { > > > > - static const AVOption opts[] = { > > > > - { "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, > > > > { .i64 = 0 }, INT64_MIN, INT64_MAX, .unit = "flags" }, > > > > - { "default" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_DEFAULT }, .unit = "flags" }, > > > > - { "dub" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_DUB }, .unit = "flags" }, > > > > - { "original" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_ORIGINAL }, .unit = "flags" }, > > > > - { "comment" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_COMMENT }, .unit = "flags" }, > > > > - { "lyrics" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_LYRICS }, .unit = "flags" }, > > > > - { "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_KARAOKE }, .unit = "flags" }, > > > > - { "forced" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_FORCED }, .unit = "flags" }, > > > > - { "hearing_impaired" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "flags" }, > > > > - { "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "flags" }, > > > > - { "clean_effects" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "flags" }, > > > > - { "captions" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_CAPTIONS }, .unit = "flags" }, > > > > - { "descriptions" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_DESCRIPTIONS }, .unit = "flags" }, > > > > - { "metadata" , NULL, 0, AV_OPT_TYPE_CONST, > > > > { .i64 = AV_DISPOSITION_METADATA }, .unit = "flags" }, > > > > - { NULL }, > > > > - }; > > > > - static const AVClass class = { > > > > - .class_name = "", > > > > - .item_name = av_default_item_name, > > > > - .option = opts, > > > > - .version = LIBAVUTIL_VERSION_INT, > > > > - }; > > > > - const AVClass *pclass = &class; > > > > - > > > > - ret = av_opt_eval_flags(&pclass, &opts[0], > > > > ost->disposition, &ost->st->disposition); > > > > + const AVClass *pclass = avstream_get_class(); > > > > + const AVOption *o = av_opt_find(&pclass, "disposition", > > > > NULL, 0, 0); > > > > + > > > > + ret = av_opt_eval_flags(&pclass, o, ost->disposition, > > > > &ost->st->disposition); > > > > if (ret < 0) > > > > goto dump_format; > > > > } > > > > diff --git a/libavformat/avformat.h b/libavformat/avformat.h > > > > index db72c18..e6cd301 100644 > > > > --- a/libavformat/avformat.h > > > > +++ b/libavformat/avformat.h > > > > @@ -1895,6 +1895,12 @@ void avformat_free_context(AVFormatContext *s); > > > > const AVClass *avformat_get_class(void); > > > > > > > > /** > > > > + * Get the AVClass for AVStream. It can be used in combination with > > > > + * AV_OPT_SEARCH_FAKE_OBJ for examining options. > > > > + */ > > > > +const AVClass *avstream_get_class(void); > > > > + > > > > +/** > > > > * Add a new stream to a media file. > > > > * > > > > * When demuxing, it is called by the demuxer in read_header(). If the > > > > diff --git a/libavformat/options.c b/libavformat/options.c > > > > index 5044043..d10226d 100644 > > > > --- a/libavformat/options.c > > > > +++ b/libavformat/options.c > > > > @@ -130,3 +130,33 @@ const AVClass *avformat_get_class(void) > > > > { > > > > return &av_format_context_class; > > > > } > > > > + > > > > +static const AVOption stream_options[] = { > > > > + { "disposition" , NULL, 0, AV_OPT_TYPE_FLAGS, { .i64 = 0 > > > > }, INT64_MIN, INT64_MAX, .unit = "flags" }, > > > > + { "default" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_DEFAULT }, .unit = "flags" }, > > > > + { "dub" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_DUB }, .unit = "flags" }, > > > > + { "original" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_ORIGINAL }, .unit = "flags" }, > > > > + { "comment" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_COMMENT }, .unit = "flags" }, > > > > + { "lyrics" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_LYRICS }, .unit = "flags" }, > > > > + { "karaoke" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_KARAOKE }, .unit = "flags" }, > > > > + { "forced" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_FORCED }, .unit = "flags" }, > > > > + { "hearing_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_HEARING_IMPAIRED }, .unit = "flags" }, > > > > + { "visual_impaired" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_VISUAL_IMPAIRED }, .unit = "flags" }, > > > > + { "clean_effects" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_CLEAN_EFFECTS }, .unit = "flags" }, > > > > + { "captions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_CAPTIONS }, .unit = "flags" }, > > > > + { "descriptions" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_DESCRIPTIONS }, .unit = "flags" }, > > > > + { "metadata" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = > > > > AV_DISPOSITION_METADATA }, .unit = "flags" }, > > > > + { NULL }, > > > > +}; > > > > + > > > > +static const AVClass av_stream_class = { > > > > + .class_name = "AVStream", > > > > + .item_name = av_default_item_name, > > > > + .option = stream_options, > > > > + .version = LIBAVUTIL_VERSION_INT, > > > > +}; > > > > + > > > > +const AVClass *avstream_get_class(void) > > > > +{ > > > > + return &av_stream_class; > > > > +} > > > > \ No newline at end of file > > > > > > As an experienced API user, I don't have the slightest clue what I'd do > > > with this API, or where to find information about it. > > > > the primary goal is to remove duplicated disposition type tables, > > which needs one of the tables to be public first > > > > [...] > > And this is the most awkward way you could find to do this?
No, i could certainly find a more akward way, if people prefer this is just the way that would be a big step towards consistent and simple access to the structs All public structs use AVClass and AVOptions to allow applications to extract/enumerate fields except a few like AVStream this patch would add these AVClass & AVOption for AVStream, its indeed not populated for all fields and AVStream doesnt have a AVClass as its first field due to ABI. But its a step toward it Would people prefer that each field in AVStream has a custom and different way to access it, as long as it looks simpler when looked at in isolation ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I am the wisest man alive, for I know one thing, and that is that I know nothing. -- Socrates
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel