summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2024-02-19 12:49:11 +0100
committerAnton Khirnov <anton@khirnov.net>2024-03-04 14:03:17 +0100
commit853a8fa97be470b6a98c12c2f756eafe64ef5be6 (patch)
tree0fecc9380c8a17327841dc4428d566b4df24b6dc
parent1cab0193ddb5924ab8a342ce86ba00348a4ef79e (diff)
avcodec/mpeg12dec: use ff_frame_new_side_data
For consistency, even though this cannot be overriden at the packet level.
-rw-r--r--libavcodec/mpeg12dec.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c
index 3a2f17e508..aa116336dd 100644
--- a/libavcodec/mpeg12dec.c
+++ b/libavcodec/mpeg12dec.c
@@ -2531,15 +2531,17 @@ static int mpeg_decode_frame(AVCodecContext *avctx, AVFrame *picture,
if (s->timecode_frame_start != -1 && *got_output) {
char tcbuf[AV_TIMECODE_STR_SIZE];
- AVFrameSideData *tcside = av_frame_new_side_data(picture,
- AV_FRAME_DATA_GOP_TIMECODE,
- sizeof(int64_t));
- if (!tcside)
- return AVERROR(ENOMEM);
- memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t));
+ AVFrameSideData *tcside;
+ ret = ff_frame_new_side_data(avctx, picture, AV_FRAME_DATA_GOP_TIMECODE,
+ sizeof(int64_t), &tcside);
+ if (ret < 0)
+ return ret;
+ if (tcside) {
+ memcpy(tcside->data, &s->timecode_frame_start, sizeof(int64_t));
- av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
- av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
+ av_timecode_make_mpeg_tc_string(tcbuf, s->timecode_frame_start);
+ av_dict_set(&picture->metadata, "timecode", tcbuf, 0);
+ }
s->timecode_frame_start = -1;
}