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

Hendrik Leppkes h.leppkes at gmail.com
Wed Nov 1 19:18:26 EET 2017


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.

- Hendrik


More information about the ffmpeg-devel mailing list