[FFmpeg-devel] [PATCH 02/20] avformat/matroskadec: Set several stream parameters earlier
Andreas Rheinhardt
andreas.rheinhardt at outlook.com
Mon Sep 4 14:27:41 EEST 2023
Don't do it in between parsing and setting extradata.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavformat/matroskadec.c | 64 +++++++++++++++++++--------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index fda77b0b89..ac3800b880 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -2654,12 +2654,44 @@ static int matroska_parse_tracks(AVFormatContext *s)
}
sti = ffstream(st);
+ if (track->flag_default)
+ st->disposition |= AV_DISPOSITION_DEFAULT;
+ if (track->flag_forced)
+ st->disposition |= AV_DISPOSITION_FORCED;
+ if (track->flag_comment)
+ st->disposition |= AV_DISPOSITION_COMMENT;
+ if (track->flag_hearingimpaired)
+ st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
+ if (track->flag_visualimpaired)
+ st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
+ if (track->flag_original.count > 0)
+ st->disposition |= track->flag_original.el.u ? AV_DISPOSITION_ORIGINAL
+ : AV_DISPOSITION_DUB;
+
if (key_id_base64) {
/* export encryption key id as base64 metadata tag */
av_dict_set(&st->metadata, "enc_key_id", key_id_base64,
AV_DICT_DONT_STRDUP_VAL);
}
+ if (strcmp(track->language, "und"))
+ av_dict_set(&st->metadata, "language", track->language, 0);
+ av_dict_set(&st->metadata, "title", track->name, 0);
+
+ if (track->time_scale < 0.01) {
+ av_log(matroska->ctx, AV_LOG_WARNING,
+ "Track TimestampScale too small %f, assuming 1.0.\n",
+ track->time_scale);
+ track->time_scale = 1.0;
+ }
+ avpriv_set_pts_info(st, 64, matroska->time_scale * track->time_scale,
+ 1000 * 1000 * 1000); /* 64 bit pts in ns */
+
+ /* convert the delay from ns to the track timebase */
+ track->codec_delay_in_track_tb = av_rescale_q(track->codec_delay,
+ (AVRational){ 1, 1000000000 },
+ st->time_base);
+
if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
track->codec_priv.size >= 40 &&
track->codec_priv.data) {
@@ -2923,40 +2955,8 @@ static int matroska_parse_tracks(AVFormatContext *s)
av_log(matroska->ctx, AV_LOG_INFO,
"Unknown/unsupported AVCodecID %s.\n", track->codec_id);
- if (track->time_scale < 0.01) {
- av_log(matroska->ctx, AV_LOG_WARNING,
- "Track TimestampScale too small %f, assuming 1.0.\n",
- track->time_scale);
- track->time_scale = 1.0;
- }
- avpriv_set_pts_info(st, 64, matroska->time_scale * track->time_scale,
- 1000 * 1000 * 1000); /* 64 bit pts in ns */
-
- /* convert the delay from ns to the track timebase */
- track->codec_delay_in_track_tb = av_rescale_q(track->codec_delay,
- (AVRational){ 1, 1000000000 },
- st->time_base);
-
st->codecpar->codec_id = codec_id;
- if (strcmp(track->language, "und"))
- av_dict_set(&st->metadata, "language", track->language, 0);
- av_dict_set(&st->metadata, "title", track->name, 0);
-
- if (track->flag_default)
- st->disposition |= AV_DISPOSITION_DEFAULT;
- if (track->flag_forced)
- st->disposition |= AV_DISPOSITION_FORCED;
- if (track->flag_comment)
- st->disposition |= AV_DISPOSITION_COMMENT;
- if (track->flag_hearingimpaired)
- st->disposition |= AV_DISPOSITION_HEARING_IMPAIRED;
- if (track->flag_visualimpaired)
- st->disposition |= AV_DISPOSITION_VISUAL_IMPAIRED;
- if (track->flag_original.count > 0)
- st->disposition |= track->flag_original.el.u ? AV_DISPOSITION_ORIGINAL
- : AV_DISPOSITION_DUB;
-
if (!st->codecpar->extradata) {
if (extradata) {
st->codecpar->extradata = extradata;
--
2.34.1
More information about the ffmpeg-devel
mailing list