[FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list
Rodger Combs
rodger.combs at gmail.com
Thu Nov 19 00:28:21 CET 2015
---
libavformat/avformat.h | 9 +++++++++
libavformat/utils.c | 20 ++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index 6e9ffe2..cedcb8f 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -2776,6 +2776,15 @@ 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_stream_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 3ed7935..26311fe 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4631,6 +4631,26 @@ uint8_t *ff_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(AVFormatContext *s, AVPacket *pkt,
AVBitStreamFilterContext *bsfc)
{
--
2.6.3
More information about the ffmpeg-devel
mailing list