@@ -2827,6 +2827,7 @@ static int set_side_data(HEVCContext *s)
if (s->sei.timecode.present) {
uint32_t *tc_sd;
char tcbuf[AV_TIMECODE_STR_SIZE];
+ uint32_t *s12m_sd;
AVFrameSideData *tcside = av_frame_new_side_data(out, AV_FRAME_DATA_S12M_TIMECODE,
sizeof(uint32_t) * 4);
if (!tcside)
@@ -2834,6 +2835,12 @@ static int set_side_data(HEVCContext *s)
tc_sd = (uint32_t*)tcside->data;
tc_sd[0] = s->sei.timecode.num_clock_ts;
+ if (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_S12M_TC) {
+ s12m_sd = ff_add_s12m_timecode_side_data(s->avctx);
+ if (!s12m_sd)
+ return AVERROR(ENOMEM);
+ s12m_sd[0] = tc_sd[0];
+ }
for (int i = 0; i < tc_sd[0]; i++) {
int drop = s->sei.timecode.cnt_dropped_flag[i];
@@ -2843,6 +2850,9 @@ static int set_side_data(HEVCContext *s)
int ff = s->sei.timecode.n_frames[i];
tc_sd[i + 1] = av_timecode_get_smpte(s->avctx->framerate, drop, hh, mm, ss, ff);
+ if (s->avctx->export_side_data & AV_CODEC_EXPORT_DATA_S12M_TC) {
+ s12m_sd[i + 1] = tc_sd[i + 1];
+ }
av_timecode_make_smpte_tc_string(tcbuf, tc_sd[i + 1], 0);
av_dict_set(&out->metadata, "timecode", tcbuf, 0);
}