--- libavformat/avformat.h | 8 ++++++++ libavformat/utils.c | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h index f3c8260..20759e3 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2758,6 +2758,14 @@ int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, int avformat_queue_attached_pictures(AVFormatContext *s); /** + * Add a bitstream filter to a stream. + * + * @return >0 on success; + * AVERROR code on failure + */ +int av_add_bitstream_filter(AVStream *st, const char *name, const char *args); + +/** * Apply a list of bitstream filters to a packet. * * @return >=0 on success; diff --git a/libavformat/utils.c b/libavformat/utils.c index d4f8f12..d233dfd 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4597,6 +4597,25 @@ uint8_t *ff_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int av_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(AVFormatContext *s, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { -- 2.6.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel