[FFmpeg-devel] [PATCH]lavc/pcm-dvd: Do not use an incompatible pointer on big-endian.

Carl Eugen Hoyos ceffmpeg at gmail.com
Wed Nov 1 19:33:09 EET 2017


2017-11-01 18:18 GMT+01:00 Hendrik Leppkes <h.leppkes at gmail.com>:
> On Wed, Nov 1, 2017 at 5:13 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
>> Hi!
>>
>> Attached patch silences a gcc warning, tested with Fever.vob
>>
>>
>> @@ -163,10 +162,12 @@ static void *pcm_dvd_decode_samples(AVCodecContext *avctx, const uint8_t *src,
>>     switch (avctx->bits_per_coded_sample) {
>>     case 16: {
>> #if HAVE_BIGENDIAN
>> +        int8_t *dst16 = dst;
>>         bytestream2_get_buffer(&gb, dst16, blocks * s->block_size);
>> -        dst16 += blocks * s->block_size / 2;
>> +        dst16 += blocks * s->block_size;
>> #else
>>         int samples = blocks * avctx->channels;
>> +        int16_t *dst16 = dst;
>>         do {
>>             *dst16++ = bytestream2_get_be16u(&gb);
>>         } while (--samples);
>
> This results in quite misleading code. dst16 is named like that
> because its a 16-bit pointer, using the same pointer with different
> types based on this ifdef seems error-prone in the future.

Agree, new patch attached.

Thank you, Carl Eugen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-pcm-bluray-Do-not-use-incompatible-pointers-on-.patch
Type: text/x-patch
Size: 1781 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20171101/a6890b80/attachment.bin>


More information about the ffmpeg-devel mailing list