Logo Search packages:      
Sourcecode: libjlayer-java version File versions  Download package

int javazoom::jl::decoder::Header::calculate_framesize (  )  [inline]

Calculate Frame size. Calculates framesize in bytes excluding header size.

Definition at line 470 of file Header.java.

References MPEG1, and MPEG2_LSF.

Referenced by read_header().

      {

       if (h_layer == 1)
       {
         framesize = (12 * bitrates[h_version][0][h_bitrate_index]) /
                     frequencies[h_version][h_sample_frequency];
         if (h_padding_bit != 0 ) framesize++;
         framesize <<= 2;           // one slot is 4 bytes long
         nSlots = 0;
       }
       else
       {
         framesize = (144 * bitrates[h_version][h_layer - 1][h_bitrate_index]) /
                     frequencies[h_version][h_sample_frequency];
         if (h_version == MPEG2_LSF || h_version == MPEG25_LSF) framesize >>= 1;    // SZD
         if (h_padding_bit != 0) framesize++;
         // Layer III slots
         if (h_layer == 3)
         {
           if (h_version == MPEG1)
           {
                   nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ? 17 : 32) // side info size
                                                        -  ((h_protection_bit!=0) ? 0 : 2)                   // CRC size
                                                        - 4;                                                             // header size
           }
           else
             {  // MPEG-2 LSF, SZD: MPEG-2.5 LSF
              nSlots = framesize - ((h_mode == SINGLE_CHANNEL) ?  9 : 17) // side info size
                                                  -  ((h_protection_bit!=0) ? 0 : 2)                   // CRC size
                                                        - 4;                                                             // header size
           }
         }
         else
         {
             nSlots = 0;
         }
       }
       framesize -= 4;             // subtract header size
       return framesize;
      }


Generated by  Doxygen 1.6.0   Back to index