History

lavc: ensure extended_data is set properly on decoding

Anton Khirnov committed 14 years ago

Commit b437cec1 parent 2bc0de31 file · +14 −0Browse files

Unified · Split

libavcodec/utils.c+14−0
@@ -1291,6 +1291,10 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi · 1290 unmodified lines
12911291 } else
12921292 ret = 0;
12931293
1294+ /* many decoders assign whole AVFrames, thus overwriting extended_data;
1295+ * make sure it's set correctly */
1296+ picture->extended_data = picture->data;
1297+
12941298 return ret;
12951299 }
12961300
@@ -1347,6 +1351,7 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 50 unmodified lines
13471351 int *got_frame_ptr,
13481352 AVPacket *avpkt)
13491353 {
1354+ int planar, channels;
13501355 int ret = 0;
13511356
13521357 *got_frame_ptr = 0;
@@ -1369,6 +1374,15 @@ int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, · 16 unmodified lines
13691374 frame->format = avctx->sample_fmt;
13701375 }
13711376 }
1377+
1378+ /* many decoders assign whole AVFrames, thus overwriting extended_data;
1379+ * make sure it's set correctly; assume decoders that actually use
1380+ * extended_data are doing it correctly */
1381+ planar = av_sample_fmt_is_planar(frame->format);
1382+ channels = av_get_channel_layout_nb_channels(frame->channel_layout);
1383+ if (!(planar && channels > AV_NUM_DATA_POINTERS))
1384+ frame->extended_data = frame->data;
1385+
13721386 return ret;
13731387 }
13741388

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