This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new af739541bf avformat/mov: factorize out tmcd track parsing
af739541bf is described below
commit af739541bf0b73d55ad56ab4d513b80743e35a6f
Author: James Almer <[email protected]>
AuthorDate: Sun May 17 12:27:59 2026 -0300
Commit: James Almer <[email protected]>
CommitDate: Sun May 17 12:27:59 2026 -0300
avformat/mov: factorize out tmcd track parsing
Signed-off-by: James Almer <[email protected]>
---
libavformat/mov.c | 107 ++++++++++++++++++++++++++++++------------------------
1 file changed, 59 insertions(+), 48 deletions(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 93e419113d..e4e8036a4a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -10878,6 +10878,62 @@ static int mov_parse_heif_items(AVFormatContext *s)
return 0;
}
+static int mov_parse_tmcd_streams(AVFormatContext *s)
+{
+ int err;
+
+ for (int i = 0; i < s->nb_streams; i++) {
+ AVStreamGroup *stg;
+ const AVDictionaryEntry *tcr;
+ AVStream *st = s->streams[i];
+
+ if (st->codecpar->codec_tag != MKTAG('t','m','c','d'))
+ continue;
+
+ stg = avformat_stream_group_create(s, AV_STREAM_GROUP_PARAMS_TREF,
NULL);
+ if (!stg)
+ return AVERROR(ENOMEM);
+
+ stg->id = st->id;
+ tcr = av_dict_get(st->metadata, "timecode", NULL, 0);
+
+ for (int j = 0; j < s->nb_streams; j++) {
+ AVStream *st2 = s->streams[j];
+ MOVStreamContext *sc2 = st2->priv_data;
+ MovTref *tag = mov_find_tref_tag(sc2, MKTAG('t','m','c','d'));
+
+ if (!tag)
+ continue;
+
+ for (int k = 0; k < tag->nb_id; k++) {
+ if (tag->id[k] != st->id)
+ continue;
+
+ err = avformat_stream_group_add_stream(stg, st2);
+ if (err < 0)
+ return err;
+
+ if (tcr)
+ av_dict_set(&st2->metadata, "timecode", tcr->value,
AV_DICT_DONT_OVERWRITE);
+ }
+ }
+
+ if (!stg->nb_streams) {
+ ff_remove_stream_group(s, stg);
+ continue;
+ }
+
+ err = avformat_stream_group_add_stream(stg, st);
+ if (err < 0)
+ return err;
+
+ stg->params.tref->metadata_index = stg->nb_streams - 1;
+ }
+ export_orphan_timecode(s);
+
+ return 0;
+}
+
static AVStream *mov_find_reference_track(AVFormatContext *s, AVStream *st,
uint32_t *tref_id, int nb_tref_id,
int first_index)
{
@@ -11041,54 +11097,9 @@ static int mov_read_header(AVFormatContext *s)
}
/* copy timecode metadata from tmcd tracks to the related video streams */
- for (i = 0; i < s->nb_streams; i++) {
- AVStreamGroup *stg;
- const AVDictionaryEntry *tcr;
- AVStream *st = s->streams[i];
-
- if (st->codecpar->codec_tag != MKTAG('t','m','c','d'))
- continue;
-
- stg = avformat_stream_group_create(s, AV_STREAM_GROUP_PARAMS_TREF,
NULL);
- if (!stg)
- return AVERROR(ENOMEM);
-
- stg->id = st->id;
- tcr = av_dict_get(st->metadata, "timecode", NULL, 0);
-
- for (int j = 0; j < s->nb_streams; j++) {
- AVStream *st2 = s->streams[j];
- MOVStreamContext *sc2 = st2->priv_data;
- MovTref *tag = mov_find_tref_tag(sc2, MKTAG('t','m','c','d'));
-
- if (!tag)
- continue;
-
- for (int k = 0; k < tag->nb_id; k++) {
- if (tag->id[k] != st->id)
- continue;
-
- err = avformat_stream_group_add_stream(stg, st2);
- if (err < 0)
- return err;
-
- if (tcr)
- av_dict_set(&st2->metadata, "timecode", tcr->value,
AV_DICT_DONT_OVERWRITE);
- }
- }
-
- if (!stg->nb_streams) {
- ff_remove_stream_group(s, stg);
- continue;
- }
-
- err = avformat_stream_group_add_stream(stg, st);
- if (err < 0)
- return err;
-
- stg->params.tref->metadata_index = stg->nb_streams - 1;
- }
- export_orphan_timecode(s);
+ err = mov_parse_tmcd_streams(s);
+ if (err < 0)
+ return err;
/* Create LCEVC stream groups. */
err = mov_parse_lcevc_streams(s);
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]