Author: ayoung
Date: Tue Feb  8 03:07:49 2011
New Revision: 9304

URL: http://svn.slimdevices.com/jive?rev=9304&view=rev
Log:
bug 16908: ALAC fixed at 44100/2/16 & poor error handling 
Fix parsing of special box lengths 0 and 1.

Modified:
    7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c

Modified: 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c
URL: 
http://svn.slimdevices.com/jive/7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c?rev=9304&r1=9303&r2=9304&view=diff
==============================================================================
--- 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c (original)
+++ 7.6/trunk/squeezeplay/src/squeezeplay/src/audio/mp4.c Tue Feb  8 03:07:49 
2011
@@ -205,8 +205,7 @@
 
 static int mp4_parse_container_box(struct decode_mp4 *mp4, size_t r)
 {
-       static struct mp4_parser *parser;
-       int i;
+       struct mp4_parser *parser;
 
        /* mp4 box */
        if (r < 8) {
@@ -219,28 +218,26 @@
        memcpy(mp4->box_type, mp4->ptr, 4);
        mp4_skip(mp4, 4);
 
-       mp4->box_size -= 8;
-
-       if (mp4->box_size == 1) {
-               /* extended box size */
-               mp4->box_size = mp4_get_u64(mp4);
-               mp4->box_size -= 8;
-       }
-       else if (mp4->box_size == 0) {
+       if (mp4->box_size == 0) {
                /* box extends to end of file */
                mp4->box_size = ULONG_MAX;
-       }
-
-       LOG_DEBUG(log_audio_codec, "box %.4s, size without header %d (%x)", 
mp4->box_type, mp4->box_size, mp4->box_size);
+       } else {
+               if (mp4->box_size == 1) {
+                       /* extended box size */
+                       mp4->box_size = mp4_get_u64(mp4);
+                       mp4->box_size -= 8;
+               }
+
+               mp4->box_size -= 8;
+       }
+
+       LOG_DEBUG(log_audio_codec, "box %.4s, size without header %u (%x)", 
mp4->box_type, mp4->box_size, mp4->box_size);
 
        /* find box parser */
-       i=0;
-       parser = &mp4_parsers[i++];
-       while (parser->type) {
+       for (parser = &mp4_parsers[0]; parser->type; parser++) {
                if (FOURCC_EQ(mp4->box_type, parser->type)) {
                        break;
                }
-               parser = &mp4_parsers[i++];             
        }
 
        if (parser->type) {

_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/jive-checkins

Reply via email to