---
libavformat/avformat.h | 11 +++++++++++
libavformat/utils.c | 5 +++++
2 files changed, 16 insertions(+)
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index cd53420..8f730de 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -819,6 +819,17 @@ typedef struct AVStream {
int event_flags;
#define AVSTREAM_EVENT_FLAG_METADATA_UPDATED 0x0001 ///< The call resulted in
updated metadata.
+ /*
+ * Codec parameters associated with this stream. Allocated and freed by
+ * libavformat in avformat_new_stream() and avformat_free_context()
+ * respectively.
+ *
+ * - demuxing: filled by libavformat on stream creation or in
+ * avformat_find_stream_info()
+ * - muxing: filled by the caller before avformat_write_header()
+ */
+ AVCodecParameters *codecpar;
+
/*****************************************************************
* All fields below this line are not part of the public API. They
* may not be used outside of libavformat and can be changed and
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 18499af..f6611f0 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2463,6 +2463,7 @@ static void free_stream(AVStream **pst)
av_freep(&st->internal);
av_dict_free(&st->metadata);
+ avcodec_parameters_free(&st->codecpar);
av_freep(&st->probe_data.buf);
av_free(st->index_entries);
av_free(st->codec->extradata);
@@ -2573,6 +2574,10 @@ AVStream *avformat_new_stream(AVFormatContext *s, const
AVCodec *c)
st->cur_dts = AV_NOPTS_VALUE;
}
+ st->codecpar = avcodec_parameters_alloc();
+ if (!st->codecpar)
+ goto fail;
+
st->index = s->nb_streams;
st->start_time = AV_NOPTS_VALUE;
st->duration = AV_NOPTS_VALUE;
--
2.0.0
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel