Mercurial > mplayer.hg
changeset 24508:4f9b7524f65d
Handle swab when input length is odd (treat it as if there was an additional
0 byte)
author | reimar |
---|---|
date | Sat, 15 Sep 2007 16:30:39 +0000 |
parents | e28f9913f48a |
children | 767a9fd651c7 |
files | libmpcodecs/ad_hwac3.c |
diffstat | 1 files changed, 10 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_hwac3.c Sat Sep 15 13:25:56 2007 +0000 +++ b/libmpcodecs/ad_hwac3.c Sat Sep 15 16:30:39 2007 +0000 @@ -168,6 +168,11 @@ 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 @@ 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));