History

avcodec/mpeg12dec: respect side data preference

We only need to consider side data types that may possibly come from the packet.

Niklas Haas committed 2 years ago

Commit ffb8dc71 parent ed3cc8f1 file · +19 −19Browse files

Showing the changes to libavcodec (1 of 1 file). Show all

Unified · Split

libavcodec/mpeg12dec.c+19−19
@@ -1306,20 +1306,20 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 1305 unmodified lines
13061306 }
13071307 }
13081308
1309− pan_scan = av_frame_new_side_data(s->current_picture_ptr->f,
1310− AV_FRAME_DATA_PANSCAN,
1311− sizeof(s1->pan_scan));
1312− if (!pan_scan)
1313− return AVERROR(ENOMEM);
1314− memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
1309+ ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f,
1310+ AV_FRAME_DATA_PANSCAN, sizeof(s1->pan_scan),
1311+ &pan_scan);
1312+ if (ret < 0)
1313+ return ret;
1314+ if (pan_scan)
1315+ memcpy(pan_scan->data, &s1->pan_scan, sizeof(s1->pan_scan));
13151316
13161317 if (s1->a53_buf_ref) {
1317− AVFrameSideData *sd = av_frame_new_side_data_from_buf(
1318− s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
1319− s1->a53_buf_ref);
1320− if (!sd)
1321− av_buffer_unref(&s1->a53_buf_ref);
1322− s1->a53_buf_ref = NULL;
1318+ ret = ff_frame_new_side_data_from_buf(
1319+ s->avctx, s->current_picture_ptr->f, AV_FRAME_DATA_A53_CC,
1320+ &s1->a53_buf_ref, NULL);
1321+ if (ret < 0)
1322+ return ret;
13231323 }
13241324
13251325 if (s1->has_stereo3d) {
@@ -1332,13 +1332,13 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size) · 6 unmodified lines
13321332 }
13331333
13341334 if (s1->has_afd) {
1335− AVFrameSideData *sd =
1336− av_frame_new_side_data(s->current_picture_ptr->f,
1337− AV_FRAME_DATA_AFD, 1);
1338− if (!sd)
1339− return AVERROR(ENOMEM);
1340−
1341− *sd->data = s1->afd;
1335+ AVFrameSideData *sd;
1336+ ret = ff_frame_new_side_data(s->avctx, s->current_picture_ptr->f,
1337+ AV_FRAME_DATA_AFD, 1, &sd);
1338+ if (ret < 0)
1339+ return ret;
1340+ if (sd)
1341+ *sd->data = s1->afd;
13421342 s1->has_afd = 0;
13431343 }
13441344

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t