Exemple #1
0
void ES_AAC::ReadStreamMuxConfig(cBitstream *bs)
{
  int AudioMuxVersion = bs->readBits(1);
  m_AudioMuxVersion_A = 0;
  if (AudioMuxVersion)                       // audioMuxVersion
    m_AudioMuxVersion_A = bs->readBits(1);

  if(m_AudioMuxVersion_A)
    return;

  if (AudioMuxVersion)
    LATMGetValue(bs);                      // taraFullness

  bs->skipBits(1);                         // allStreamSameTimeFraming = 1
  bs->skipBits(6);                         // numSubFrames = 0
  bs->skipBits(4);                         // numPrograms = 0

  // for each program (which there is only on in DVB)
  bs->skipBits(3);                         // numLayer = 0

  // for each layer (which there is only on in DVB)
  if (!AudioMuxVersion)
    ReadAudioSpecificConfig(bs);
  else
    return;

  // these are not needed... perhaps
  m_FrameLengthType = bs->readBits(3);
  switch (m_FrameLengthType)
  {
    case 0:
      bs->readBits(8);
      break;
    case 1:
      bs->readBits(9);
      break;
    case 3:
    case 4:
    case 5:
      bs->readBits(6);                 // celp_table_index
      break;
    case 6:
    case 7:
      bs->readBits(1);                 // hvxc_table_index
      break;
  }

  if (bs->readBits(1))
  {                   // other data?
    int esc;
    do
    {
      esc = bs->readBits(1);
      bs->skipBits(8);
    } while (esc);
  }

  if (bs->readBits(1))                   // crc present?
    bs->skipBits(8);                     // config_crc
  m_Configured = true;
}
void ParserLatm::readStreamMuxConfig(cBitStream* bs) {
    int AudioMuxVersion = bs->GetBits(1);
    int AudioMuxVersion_A = 0;

    if(AudioMuxVersion) {                      // audioMuxVersion
        AudioMuxVersion_A = bs->GetBits(1);
    }

    if(AudioMuxVersion_A) {
        return;
    }

    if(AudioMuxVersion) {
        LATMGetValue(bs);    // taraFullness
    }

    bs->SkipBits(1);                         // allStreamSameTimeFraming = 1
    bs->SkipBits(6);                         // numSubFrames = 0
    bs->SkipBits(4);                         // numPrograms = 0

    // for each program (which there is only on in DVB)
    bs->SkipBits(3);                         // numLayer = 0

    // for each layer (which there is only on in DVB)
    if(!AudioMuxVersion) {
        readAudioSpecificConfig(bs);
    }
    else {
        return;
    }

    // these are not needed... perhaps
    int framelength = bs->GetBits(3);

    switch(framelength) {
        case 0:
            bs->GetBits(8);
            break;

        case 1:
            bs->GetBits(9);
            break;

        case 3:
        case 4:
        case 5:
            bs->GetBits(6);                 // celp_table_index
            break;

        case 6:
        case 7:
            bs->GetBits(1);                 // hvxc_table_index
            break;
    }

    if(bs->GetBits(1)) {
        // other data?
        if(AudioMuxVersion) {
            LATMGetValue(bs);              // other_data_bits
        }
        else {
            int esc;

            do {
                esc = bs->GetBits(1);
                bs->SkipBits(8);
            }
            while(esc);
        }
    }

    if(bs->GetBits(1)) {                  // crc present?
        bs->SkipBits(8);    // config_crc
    }
}