diff options
author | Rodger Combs <rodger.combs@gmail.com> | 2015-10-07 21:10:08 -0500 |
---|---|---|
committer | Rodger Combs <rodger.combs@gmail.com> | 2015-12-28 08:40:37 -0600 |
commit | 822e80fde39f8992daeab6d51312f27188021d9b (patch) | |
tree | 97fc325a97273beac4948996ae50e9e46146ab7e /libavformat/utils.c | |
parent | 1f9139b07b8a896b62c1f28f3d04acac33978c0d (diff) | |
download | ffmpeg-822e80fde39f8992daeab6d51312f27188021d9b.tar.gz |
lavf: add internal API to append a bsf to a stream's list
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 7e101a4fd3..95acbf3251 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4651,6 +4651,28 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args) +{ + AVBitStreamFilterContext *bsfc = NULL; + AVBitStreamFilterContext **dest = &st->internal->bsfc; + while (*dest && (*dest)->next) + dest = &(*dest)->next; + + if (!(bsfc = av_bitstream_filter_init(name))) { + av_log(NULL, AV_LOG_ERROR, "Unknown bitstream filter '%s'\n", name); + return AVERROR(EINVAL); + } + if (args && !(bsfc->args = av_strdup(args))) { + av_bitstream_filter_close(bsfc); + return AVERROR(ENOMEM); + } + av_log(st->codec, AV_LOG_VERBOSE, + "Automatically inserted bitstream filter '%s'; args='%s'\n", + name, args ? args : ""); + *dest = bsfc; + return 1; +} + int av_apply_bitstream_filters(AVCodecContext *codec, AVPacket *pkt, AVBitStreamFilterContext *bsfc) { |