[FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list

2015-11-25 Thread Rodger Combs
---
 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


Re: [FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list

2015-11-19 Thread Michael Niedermayer
On Wed, Nov 18, 2015 at 05:28:21PM -0600, Rodger Combs wrote:
> ---
>  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);

does this work with muxers and demuxers ?
if it works with just one kind then that should be documented
otherwise patch should e ok

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list

2015-11-18 Thread Rodger Combs
---
 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

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 5/6] lavf: add API to append a bsf to a stream's list

2015-10-07 Thread Rodger Combs
---
 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