avcodec/dpx: respect side data preference
If the time code side data is overridden by the packet level, we also make sure not to update `p->metadata` to a mismatched timecode.
This commit is contained in:
parent
0b7aefe698
commit
588c5c3d51
|
@ -287,19 +287,21 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p,
|
||||||
tc = av_bswap32(read32(&buf, endian));
|
tc = av_bswap32(read32(&buf, endian));
|
||||||
|
|
||||||
if (i != 0xFFFFFFFF) {
|
if (i != 0xFFFFFFFF) {
|
||||||
AVFrameSideData *tcside =
|
AVFrameSideData *tcside;
|
||||||
av_frame_new_side_data(p, AV_FRAME_DATA_S12M_TIMECODE,
|
ret = ff_frame_new_side_data(avctx, p, AV_FRAME_DATA_S12M_TIMECODE,
|
||||||
sizeof(uint32_t) * 4);
|
sizeof(uint32_t) * 4, &tcside);
|
||||||
if (!tcside)
|
if (ret < 0)
|
||||||
return AVERROR(ENOMEM);
|
return ret;
|
||||||
|
|
||||||
tc_sd = (uint32_t*)tcside->data;
|
if (tcside) {
|
||||||
tc_sd[0] = 1;
|
tc_sd = (uint32_t*)tcside->data;
|
||||||
tc_sd[1] = tc;
|
tc_sd[0] = 1;
|
||||||
|
tc_sd[1] = tc;
|
||||||
|
|
||||||
av_timecode_make_smpte_tc_string2(tcbuf, avctx->framerate,
|
av_timecode_make_smpte_tc_string2(tcbuf, avctx->framerate,
|
||||||
tc_sd[1], 0, 0);
|
tc_sd[1], 0, 0);
|
||||||
av_dict_set(&p->metadata, "timecode", tcbuf, 0);
|
av_dict_set(&p->metadata, "timecode", tcbuf, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue