[MPlayer-cvslog] r24528 - trunk/libmpcodecs/ad_hwac3.c

Ulion ulion2002 at gmail.com
Sun Sep 16 05:13:45 CEST 2007


2007/9/16, reimar <subversion at mplayerhq.hu>:
> Author: reimar
> Date: Sat Sep 15 18:30:39 2007
> New Revision: 24528
>
> Log:
> Handle swab when input length is odd (treat it as if there was an additional
> 0 byte)
>
>
> Modified:
>    trunk/libmpcodecs/ad_hwac3.c
>
> Modified: trunk/libmpcodecs/ad_hwac3.c
> ==============================================================================
> --- trunk/libmpcodecs/ad_hwac3.c        (original)
> +++ trunk/libmpcodecs/ad_hwac3.c        Sat Sep 15 18:30:39 2007
> @@ -168,6 +168,11 @@ static int decode_audio(sh_audio_t *sh_a
>      memcpy(buf + 8, sh_audio->a_in_buffer, len);
>  #else
>      swab(sh_audio->a_in_buffer, buf + 8, len);
> +    if (len & 1) {
> +      buf[8+len-1] = 0;
> +      buf[8+len] = sh_audio->a_in_buffer[len-1];
> +      len++;
> +    }
>  #endif
>      memset(buf + 8 + len, 0, 6144 - 8 - len);
>
> @@ -361,8 +366,11 @@ static int decode_audio_dts(unsigned cha
>    memcpy(&buf[8], indata_ptr, fsize);
>  #else
>    swab(indata_ptr, &buf[8], fsize);
> -  if (fsize & 1)
> -    buf[8+fsize-1] = indata_ptr[fsize-1];
> +  if (fsize & 1) {
> +    buf[8+fsize-1] = 0;
> +    buf[8+fsize] = indata_ptr[fsize-1];
> +    fsize++;
> +  }
>  #endif
>    memset(&buf[fsize + 8], 0, nr_samples * 2 * 2 - (fsize + 8));
>

Should we also fix the number of bits field in the header if odd?


-- 
Ulion



More information about the MPlayer-cvslog mailing list