diff options
author | J. Alexander Treuman <jat@spatialrift.net> | 2006-07-18 16:28:58 +0000 |
---|---|---|
committer | J. Alexander Treuman <jat@spatialrift.net> | 2006-07-18 16:28:58 +0000 |
commit | e7566b9643aab9d1776a4db59a17ce7b3eb6b3ce (patch) | |
tree | 82bad697d6d79590954677f424fde0984ad500f8 /src/inputPlugins | |
parent | e6b0d82c2ecec02f8b1cb07dc345faf8731865ce (diff) | |
download | mpd-e7566b9643aab9d1776a4db59a17ce7b3eb6b3ce.tar.gz mpd-e7566b9643aab9d1776a4db59a17ce7b3eb6b3ce.tar.xz mpd-e7566b9643aab9d1776a4db59a17ce7b3eb6b3ce.zip |
Reindenting parse_xing, since I need to work on it and it's a mess
git-svn-id: https://svn.musicpd.org/mpd/trunk@4397 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/inputPlugins')
-rw-r--r-- | src/inputPlugins/mp3_plugin.c | 83 |
1 files changed, 41 insertions, 42 deletions
diff --git a/src/inputPlugins/mp3_plugin.c b/src/inputPlugins/mp3_plugin.c index d5ffdef8b..02c1733d9 100644 --- a/src/inputPlugins/mp3_plugin.c +++ b/src/inputPlugins/mp3_plugin.c @@ -423,53 +423,52 @@ enum { static int parse_xing(struct xing *xing, struct mad_bitptr ptr, unsigned int bitlen) { - unsigned long bits; + unsigned long bits; - if (bitlen < 16) goto fail; - bits = mad_bit_read(&ptr, 16); + if (bitlen < 16) goto fail; + bits = mad_bit_read(&ptr, 16); bitlen -= 16; - if (bits == XI_MAGIC) { - if (bitlen < 16) goto fail; - if (mad_bit_read(&ptr, 16) != NG_MAGIC) goto fail; - bitlen -= 16; - } - else if (bits != NG_MAGIC) goto fail; - - if (bitlen < 32) goto fail; - xing->flags = mad_bit_read(&ptr, 32); - bitlen -= 32; - - if (xing->flags & XING_FRAMES) { - if (bitlen < 32) goto fail; - xing->frames = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - if (xing->flags & XING_BYTES) { - if (bitlen < 32) goto fail; - xing->bytes = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - if (xing->flags & XING_TOC) { - int i; - if (bitlen < 800) goto fail; - for (i = 0; i < 100; ++i) xing->toc[i] = mad_bit_read(&ptr, 8); - bitlen -= 800; - } - - if (xing->flags & XING_SCALE) { - if (bitlen < 32) goto fail; - xing->scale = mad_bit_read(&ptr, 32); - bitlen -= 32; - } - - return 1; + if (bits == XI_MAGIC) { + if (bitlen < 16) goto fail; + if (mad_bit_read(&ptr, 16) != NG_MAGIC) goto fail; + bitlen -= 16; + } + else if (bits != NG_MAGIC) goto fail; + + if (bitlen < 32) goto fail; + xing->flags = mad_bit_read(&ptr, 32); + bitlen -= 32; + + if (xing->flags & XING_FRAMES) { + if (bitlen < 32) goto fail; + xing->frames = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + + if (xing->flags & XING_BYTES) { + if (bitlen < 32) goto fail; + xing->bytes = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + if (xing->flags & XING_TOC) { + int i; + if (bitlen < 800) goto fail; + for (i = 0; i < 100; ++i) xing->toc[i] = mad_bit_read(&ptr, 8); + bitlen -= 800; + } + + if (xing->flags & XING_SCALE) { + if (bitlen < 32) goto fail; + xing->scale = mad_bit_read(&ptr, 32); + bitlen -= 32; + } + + return 1; fail: - xing->flags = 0; - return 0; + xing->flags = 0; + return 0; } static int decodeFirstFrame(mp3DecodeData * data, DecoderControl * dc, |