avcodec/h264_slice: respect side data preference
If the time code side data is overridden by the packet level, we also make sure not to update `out->metadata` to a mismatched timecode.
This commit is contained in:
parent
2c2d3d5acb
commit
eec01ef65f
@ -1252,13 +1252,13 @@ static int h264_export_frame_props(H264Context *h)
|
|||||||
if (h->sei.picture_timing.timecode_cnt > 0) {
|
if (h->sei.picture_timing.timecode_cnt > 0) {
|
||||||
uint32_t *tc_sd;
|
uint32_t *tc_sd;
|
||||||
char tcbuf[AV_TIMECODE_STR_SIZE];
|
char tcbuf[AV_TIMECODE_STR_SIZE];
|
||||||
|
AVFrameSideData *tcside;
|
||||||
|
ret = ff_frame_new_side_data(h->avctx, out, AV_FRAME_DATA_S12M_TIMECODE,
|
||||||
|
sizeof(uint32_t)*4, &tcside);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
AVFrameSideData *tcside = av_frame_new_side_data(out,
|
if (tcside) {
|
||||||
AV_FRAME_DATA_S12M_TIMECODE,
|
|
||||||
sizeof(uint32_t)*4);
|
|
||||||
if (!tcside)
|
|
||||||
return AVERROR(ENOMEM);
|
|
||||||
|
|
||||||
tc_sd = (uint32_t*)tcside->data;
|
tc_sd = (uint32_t*)tcside->data;
|
||||||
tc_sd[0] = h->sei.picture_timing.timecode_cnt;
|
tc_sd[0] = h->sei.picture_timing.timecode_cnt;
|
||||||
|
|
||||||
@ -1273,6 +1273,7 @@ static int h264_export_frame_props(H264Context *h)
|
|||||||
av_timecode_make_smpte_tc_string2(tcbuf, h->avctx->framerate, tc_sd[i + 1], 0, 0);
|
av_timecode_make_smpte_tc_string2(tcbuf, h->avctx->framerate, tc_sd[i + 1], 0, 0);
|
||||||
av_dict_set(&out->metadata, "timecode", tcbuf, 0);
|
av_dict_set(&out->metadata, "timecode", tcbuf, 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
h->sei.picture_timing.timecode_cnt = 0;
|
h->sei.picture_timing.timecode_cnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user