diff mbox series

[FFmpeg-devel,10/10] avformat/segment: Use ff_stream_encode_params_copy()

Message ID HE1PR0301MB215459720108174E9CD627678F4D9@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit a74428921f8bfb33cbe0340bfd810b6945e432d2
Headers show
Series [FFmpeg-devel,01/10] fate/filter-video: Remove SAMPLES depedency from refcmp tests | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 15, 2021, 8:16 p.m. UTC
It is simpler and more complete (e.g. it copies the id).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
I wonder whether we should use ff_stream_encode_params_copy() in the
other muxers with submuxers, too.

 libavformat/segment.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/segment.c b/libavformat/segment.c
index 5265ecaebb..cd72e8b701 100644
--- a/libavformat/segment.c
+++ b/libavformat/segment.c
@@ -167,8 +167,10 @@  static int segment_mux_init(AVFormatContext *s)
 
         if (!(st = avformat_new_stream(oc, NULL)))
             return AVERROR(ENOMEM);
+        ret = ff_stream_encode_params_copy(st, ist);
+        if (ret < 0)
+            return ret;
         opar = st->codecpar;
-        avcodec_parameters_copy(opar, ipar);
         if (!oc->oformat->codec_tag ||
             av_codec_get_id (oc->oformat->codec_tag, ipar->codec_tag) == opar->codec_id ||
             av_codec_get_tag(oc->oformat->codec_tag, ipar->codec_id) <= 0) {
@@ -176,17 +178,12 @@  static int segment_mux_init(AVFormatContext *s)
         } else {
             opar->codec_tag = 0;
         }
-        st->sample_aspect_ratio = ist->sample_aspect_ratio;
-        st->time_base           = ist->time_base;
-        st->avg_frame_rate      = ist->avg_frame_rate;
-        st->disposition         = ist->disposition;
 #if FF_API_LAVF_AVCTX
 FF_DISABLE_DEPRECATION_WARNINGS
         if (ipar->codec_tag == MKTAG('t','m','c','d'))
             st->codec->time_base = ist->codec->time_base;
 FF_ENABLE_DEPRECATION_WARNINGS
 #endif
-        av_dict_copy(&st->metadata, ist->metadata, 0);
     }
 
     return 0;