Mercurial > mplayer.hg
changeset 36339:83d0141a1cdc
ad_libmad: simplify code a bit.
author | reimar |
---|---|
date | Fri, 30 Aug 2013 19:41:37 +0000 |
parents | d9d308031e9e |
children | 6198c908db85 |
files | libmpcodecs/ad_libmad.c |
diffstat | 1 files changed, 4 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpcodecs/ad_libmad.c Fri Aug 30 19:25:11 2013 +0000 +++ b/libmpcodecs/ad_libmad.c Fri Aug 30 19:41:37 2013 +0000 @@ -77,11 +77,10 @@ mad_stream_buffer (&this->stream, sh->a_in_buffer, sh->a_in_buffer_len); ret=mad_frame_decode (&this->frame, &this->stream); if (this->stream.next_frame) { - int num_bytes = - (char*)sh->a_in_buffer+sh->a_in_buffer_len - (char*)this->stream.next_frame; - memmove(sh->a_in_buffer, this->stream.next_frame, num_bytes); - mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"libmad: %d bytes processed\n",sh->a_in_buffer_len-num_bytes); - sh->a_in_buffer_len = num_bytes; + unsigned processed = this->stream.next_frame - (uint8_t *)sh->a_in_buffer; + sh->a_in_buffer_len -= processed; + memmove(sh->a_in_buffer, this->stream.next_frame, sh->a_in_buffer_len); + mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"libmad: %d bytes processed\n",processed); } if (ret == 0) return 1; // OK!!! // error! try to resync!