On Sun, Nov 30, 2014 at 12:45:51AM +0000, Christophe Gisquet wrote: > From: Zongyi Zhou <zho...@os.pku.edu.cn> > > Original patch was adding an arg field in the context structure. As it > is most often only useful once, allow passing the arguments on init. > > The proper solution would be using AVOption, but this is overkill for now. > > Signed-off-by: Christophe Gisquet <christophe.gisq...@gmail.com> > --- > ffmpeg_opt.c | 5 ++++- > libavcodec/avcodec.h | 5 ++++- > libavcodec/bitstream_filter.c | 8 +++++++- > libavformat/concatdec.c | 2 +- > libavformat/tee.c | 7 ++++++- > 5 files changed, 22 insertions(+), 5 deletions(-) > > diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c > index 03e049b..b8cd35d 100644 > --- a/ffmpeg_opt.c > +++ b/ffmpeg_opt.c > @@ -1138,9 +1138,12 @@ static OutputStream *new_output_stream(OptionsContext > *o, AVFormatContext *oc, e > > MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); > while (bsf) { > + char *arg = NULL; > if (next = strchr(bsf, ',')) > *next++ = 0; > - if (!(bsfc = av_bitstream_filter_init(bsf))) { > + if (arg = strchr(bsf, '=')) > + *arg++ = 0; > + if (!(bsfc = av_bitstream_filter_init(bsf, arg))) { > av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); > exit_program(1); > } > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 3323284..03ce21f 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -5013,6 +5013,7 @@ typedef struct AVBitStreamFilter { > const uint8_t *buf, int buf_size, int keyframe); > void (*close)(AVBitStreamFilterContext *bsfc); > struct AVBitStreamFilter *next; > + int (*init)(AVBitStreamFilterContext *bsfc, const char *args); > } AVBitStreamFilter; > > /**
> @@ -5033,10 +5034,12 @@ void av_register_bitstream_filter(AVBitStreamFilter > *bsf); > * The returned context must be freed with av_bitstream_filter_close(). > * > * @param name the name of the bitstream filter > + * @param args initialization arguments for the bitstream filter > * @return a bitstream filter context if a matching filter was found > * and successfully initialized, NULL otherwise > */ > -AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); > +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name, > + const char *args); > this breaks ABI/API why is what is done in init not just done in the first packet when the args are already available ? This seems simpler and would avoid introducing a API that is possibly going to be deprecated once a AVOption or AVDictionary based one is introduced [...] -- 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