* raah, corrected mpeg2-layer3 playback (and streaming). (that my last
[vlc.git] / modules / packetizer / mpegaudio.c
index a7148f4..1f998a8 100644 (file)
@@ -2,7 +2,7 @@
  * mpegaudio.c
  *****************************************************************************
  * Copyright (C) 2001, 2002 VideoLAN
- * $Id: mpegaudio.c,v 1.1 2002/12/14 21:32:41 fenrir Exp $
+ * $Id: mpegaudio.c,v 1.3 2003/02/18 00:51:40 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Eric Petit <titer@videolan.org>
@@ -260,10 +260,13 @@ static void PacketizeThread( packetizer_t *p_pack )
             switch( i_layer )
             {
                 case 0:
-                    i_framelength = ( ( i_version ? 6000 : 12000 ) *
-                                    i_bitrate / i_samplerate + i_padding ) * 4;
+                    i_framelength = ( 12000 * i_bitrate /
+                                      i_samplerate + i_padding ) * 4;
                     break;
                  case 1:
+                    i_framelength = 144000 * i_bitrate /
+                                      i_samplerate + i_padding;
+                    break;
                  case 2:
                     i_framelength = ( i_version ? 72000 : 144000 ) *
                                     i_bitrate / i_samplerate + i_padding;
@@ -280,8 +283,10 @@ static void PacketizeThread( packetizer_t *p_pack )
                     i_samplesperframe = 1152;
                     break;
                 case 2:
-                    i_samplesperframe = i_version ? 1152 : 576;
+                    i_samplesperframe = i_version ? 576 : 1152;
                     break;
+                default:
+                    i_samplesperframe = 0;
             }
             break;
         }