diff options
author | Niklas Haas <git@haasn.dev> | 2024-02-17 21:52:23 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2024-03-08 07:37:56 +0100 |
commit | ffb8dc7be6d837b1c8cfeeb7df15f822f81906a2 (patch) | |
tree | 8729b5c8dcd8fb49da2701d9f804b3ef040541f0 /libavcodec | |
parent | ed3cc8fc6594224aeec34ba6fc5536d116a505dc (diff) | |
download | ffmpeg-ffb8dc7be6d837b1c8cfeeb7df15f822f81906a2.tar.gz |
avcodec/mpeg12dec: respect side data preference
We only need to consider side data types that may possibly come from the
packet.
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/mpeg12dec.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/libavcodec/mpeg12dec.c b/libavcodec/mpeg12dec.c index d07eed8744..3a2f17e508 100644 --- a/libavcodec/mpeg12dec.c +++ b/libavcodec/mpeg12dec.c @@ -1306,20 +1306,20 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) } } - pan_scan = av_frame_new_side_data(s->current_picture_ptr->f, - AV_FRAME_DATA_PANSCAN, - sizeof(s1->pan_scan)); - if (!pan_scan) - return AVERROR(ENOMEM); - memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan)); + ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + AV_FRAME_DATA_PANSCAN, sizeof(s1->pan_scan), + &pan_scan); + if (ret < 0) + return ret; + if (pan_scan) + memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan)); if (s1->a53_buf_ref) { - AVFrameSideData *sd = av_frame_new_side_data_from_buf( - s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC, - s1->a53_buf_ref); - if (!sd) - av_buffer_unref(&s1->a53_buf_ref); - s1->a53_buf_ref = NULL; + ret = ff_frame_new_side_data_from_buf( + s->avctx, s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC, + &s1->a53_buf_ref, NULL); + if (ret < 0) + return ret; } if (s1->has_stereo3d) { @@ -1332,13 +1332,13 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) } if (s1->has_afd) { - AVFrameSideData *sd = - av_frame_new_side_data(s->current_picture_ptr->f, - AV_FRAME_DATA_AFD, 1); - if (!sd) - return AVERROR(ENOMEM); - - *sd->data = s1->afd; + AVFrameSideData *sd; + ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f, + AV_FRAME_DATA_AFD, 1, &sd); + if (ret < 0) + return ret; + if (sd) + *sd->data = s1->afd; s1->has_afd = 0; } |