This will allow avformat_find_stream_info() get side data from the codec context. --- doc/APIchanges | 3 +++ libavformat/avformat.h | 11 +++++++++++ libavformat/utils.c | 15 +++++++++++++++ libavformat/version.h | 4 ++-- 4 files changed, 31 insertions(+), 2 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges index 3c24dc6fbc..2b33274a14 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,9 @@ libavutil: 2017-10-21 API changes, most recent first: +2019-12-30 - xxxxxxxxxx - lavf 58.36.100 - avformat.h + Add av_stream_add_coded_side_data(). + 2019-12-27 - xxxxxxxxxx - lavu 56.38.100 - eval.h Add av_expr_count_func(). diff --git a/libavformat/avformat.h b/libavformat/avformat.h index d4d9a3b06e..4dee1a272a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -2191,6 +2191,17 @@ int av_stream_add_side_data(AVStream *st, enum AVPacketSideDataType type, */ uint8_t *av_stream_new_side_data(AVStream *stream, enum AVPacketSideDataType type, int size); + +/** + * Add stream side_data from the coded_side_data of the supplied context. + * + * @param stream stream + * @param avctx the codec context that may contain coded_side_data + * @return >= 0 in case of success, a negative AVERROR code in case of + * failure + */ +int av_stream_add_coded_side_data(AVStream *stream, AVCodecContext *avctx); + /** * Get side information from stream. * diff --git a/libavformat/utils.c b/libavformat/utils.c index b472762dd1..fe92ad4a1d 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -5556,6 +5556,21 @@ uint8_t *av_stream_new_side_data(AVStream *st, enum AVPacketSideDataType type, return data; } +int av_stream_add_coded_side_data(AVStream *st, AVCodecContext *avctx) +{ + int i; + + for (i = 0; i < avctx->nb_coded_side_data; i++) { + const AVPacketSideData *sd_src = &avctx->coded_side_data[i]; + uint8_t *dst_data; + dst_data = av_stream_new_side_data(st, sd_src->type, sd_src->size); + if (!dst_data) + return AVERROR(ENOMEM); + memcpy(dst_data, sd_src->data, sd_src->size); + } + return 0; +} + int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *args) { int ret; diff --git a/libavformat/version.h b/libavformat/version.h index 213b66b45f..f72fb9478a 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,8 +32,8 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // Also please add any ticket numbers that you believe might be affected here #define LIBAVFORMAT_VERSION_MAJOR 58 -#define LIBAVFORMAT_VERSION_MINOR 35 -#define LIBAVFORMAT_VERSION_MICRO 101 +#define LIBAVFORMAT_VERSION_MINOR 36 +#define LIBAVFORMAT_VERSION_MICRO 100 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ -- 2.14.1.windows.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".