---
 libavformat/internal.h | 11 +++++++++++
 libavformat/utils.c    | 19 +++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/libavformat/internal.h b/libavformat/internal.h
index 5ed548e..dcd2971 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -467,6 +467,17 @@ enum AVChromaLocation 
ff_choose_chroma_location(AVFormatContext *s, AVStream *st
 int ff_generate_avci_extradata(AVStream *st);
 
 /**
+ * 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 ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char 
*args);
+
+/**
  * Wrap errno on rename() error.
  *
  * @param oldpath source path
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f751e2a..0fcf01b 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4643,6 +4643,25 @@ 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_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

Reply via email to