diff options
author | Gerard Sole <g.sole.ca@gmail.com> | 2021-12-15 20:00:31 +0100 |
---|---|---|
committer | Nicolas George <george@nsup.org> | 2021-12-22 12:05:41 +0100 |
commit | 18ad360648cd185b0ffbb444eedcbf5732774408 (patch) | |
tree | 169164ad073b7b6cee2785a58d920208704a1973 /libavformat | |
parent | 2ac8bcec6374da529e08a684d587488287b8ed7f (diff) |
libavformat: add side_data copy in concat demuxer
Adds support for concat demuxer to copy the side data information
from the input file to the resulting file. It will behave like the
metadata copy, where the metadata of the first file is kept in the
the output file.
Extract the current code that already performs the stream side_data
copy into a separate method and reuse the method in the concat demuxer.
Signed-off-by: Gerard Sole <g.sole.ca@gmail.com>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/concatdec.c | 1 | ||||
-rw-r--r-- | libavformat/internal.h | 9 | ||||
-rw-r--r-- | libavformat/utils.c | 9 |
3 files changed, 19 insertions, 0 deletions
diff --git a/libavformat/concatdec.c b/libavformat/concatdec.c index 8d80e536d1..0603c6e254 100644 --- a/libavformat/concatdec.c +++ b/libavformat/concatdec.c @@ -191,6 +191,7 @@ static int copy_stream_props(AVStream *st, AVStream *source_st) avpriv_set_pts_info(st, 64, source_st->time_base.num, source_st->time_base.den); av_dict_copy(&st->metadata, source_st->metadata, 0); + ff_stream_side_data_copy(st, source_st); return 0; } diff --git a/libavformat/internal.h b/libavformat/internal.h index 92eeb82550..2ba795d669 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -842,6 +842,15 @@ int ff_stream_add_bitstream_filter(AVStream *st, const char *name, const char *a int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src); /** + * Copy side data from source to destination stream + * + * @param dst pointer to destination AVStream + * @param src pointer to source AVStream + * @return >=0 on success, AVERROR code on error + */ +int ff_stream_side_data_copy(AVStream *dst, const AVStream *src); + +/** * Wrap ffurl_move() and log if error happens. * * @param url_src source path diff --git a/libavformat/utils.c b/libavformat/utils.c index b5a4a09ae8..332ba534d2 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -605,6 +605,15 @@ int ff_stream_encode_params_copy(AVStream *dst, const AVStream *src) if (ret < 0) return ret; + ret = ff_stream_side_data_copy(dst, src); + if (ret < 0) + return ret; + + return 0; +} + +int ff_stream_side_data_copy(AVStream *dst, const AVStream *src) +{ /* Free existing side data*/ for (int i = 0; i < dst->nb_side_data; i++) av_free(dst->side_data[i].data); |