diff options
author | Pierre-Anthony Lemieux <pal@palemieux.com> | 2022-10-02 09:27:53 -0700 |
---|---|---|
committer | Zane van Iperen <zane@zanevaniperen.com> | 2022-11-03 21:16:03 +1000 |
commit | 94922f6caba8f1739d4aa0517d8df6e93cf19b8a (patch) | |
tree | fb3c47521e3b3385c1e4e029c7ecd9e46c64c2a1 /libavformat/imfdec.c | |
parent | 5ccd4d306054cec839e9078203a3b3892a3372a2 (diff) | |
download | ffmpeg-94922f6caba8f1739d4aa0517d8df6e93cf19b8a.tar.gz |
avformat/imfdec: use CPL start timecode if available
The IMF CPL contains an optional timecode start address. This patch reads the
latter, if present, into the context's timecode metadata parameter.
This addresses https://trac.ffmpeg.org/ticket/9842.
Diffstat (limited to 'libavformat/imfdec.c')
-rw-r--r-- | libavformat/imfdec.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c index 4e60dcc4ba..03de9ce151 100644 --- a/libavformat/imfdec.c +++ b/libavformat/imfdec.c @@ -627,6 +627,8 @@ static int imf_read_header(AVFormatContext *s) IMFContext *c = s->priv_data; char *asset_map_path; char *tmp_str; + AVDictionaryEntry* tcr; + char tc_buf[AV_TIMECODE_STR_SIZE]; int ret = 0; c->interrupt_callback = &s->interrupt_callback; @@ -646,6 +648,15 @@ static int imf_read_header(AVFormatContext *s) if ((ret = ff_imf_parse_cpl(s->pb, &c->cpl)) < 0) return ret; + tcr = av_dict_get(s->metadata, "timecode", NULL, 0); + if (!tcr && c->cpl->tc) { + ret = av_dict_set(&s->metadata, "timecode", + av_timecode_make_string(c->cpl->tc, tc_buf, 0), 0); + if (ret) + return ret; + av_log(s, AV_LOG_INFO, "Setting timecode to IMF CPL timecode %s\n", tc_buf); + } + av_log(s, AV_LOG_DEBUG, "parsed IMF CPL: " AV_PRI_URN_UUID "\n", |