--- libavformat/avformat.h | 12 ++++++++++++ libavformat/utils.c | 20 ++++++++++++++++++++ 2 files changed, 32 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index bb3a674..33f6d28 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2799,6 +2799,18 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); /** + * Add a bitstream filter to a stream. + * + * @param st output stream to add a filter to + * @param name the name of the filter to add + * @param args filter-specific argument string + * @return >0 on success; + * AVERROR code on failure + */ +int av_stream_add_bitstream_filter(AVStream *st, const char *name, + const char *args); + +/** * Apply a list of bitstream filters to a packet. * * @param codec AVCodecContext, usually from an AVStream diff --git a/libavformat/utils.c b/libavformat/utils.c index dcacf44..8f22c32 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4631,6 +4631,26 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int av_stream_add_bitstream_filter(AVStream *st, const char *name, + const char *args) +{ + AVBitStreamFilterContext *bsfc = NULL; + AVBitStreamFilterContext **dest = &st->bsfc; + while (*dest && (*dest)->next) + dest = &(*dest)->next; + + if (!(bsfc = av_bitstream_filter_init(name))) { + av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", name); + return AVERROR(EINVAL); + } + if (args && !(bsfc->args = av_strdup(args))) { + av_bitstream_filter_close(bsfc); + return AVERROR(ENOMEM); + } + *dest = bsfc; + return 1; +} + int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { -- 2.6.3 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel