/* stores information after we found a header. Copyright (C) 2000 Martin Vogt This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation. For more information look at the file COPYRIGHT in this package */ #include "mpegAudioHeader.h" #define DEBUG_HEADER(x) //#define DEBUG_HEADER(x) x #include using namespace std; static const int frequencies[3][3]= { {44100,48000,32000}, // MPEG 1 {22050,24000,16000}, // MPEG 2 {11025,12000,8000} // MPEG 2.5 }; static int translate[3][2][16] = { { { 2,0,0,2,2,2,3,3,3,3,3,3,3,3,3,2 } , { 2,0,0,0,0,0,0,2,2,2,3,3,3,3,3,2 } } , { { 2,0,0,2,2,2,2,2,2,2,2,2,2,2,2,2 } , { 2,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2 } } , { { 2,1,1,2,2,2,3,3,3,3,3,3,3,3,3,2 } , { 2,1,1,1,1,1,1,2,2,2,3,3,3,3,3,2 } } }; static int sblims[5] = { 8 , 12 , 27, 30 , 30 }; static const int bitrate[2][3][15]= { // MPEG 1 {{0,32,64,96,128,160,192,224,256,288,320,352,384,416,448}, {0,32,48,56,64,80,96,112,128,160,192,224,256,320,384}, {0,32,40,48,56,64,80,96,112,128,160,192,224,256,320}}, // MPEG 2 {{0,32,48,56,64,80,96,112,128,144,160,176,192,224,256}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}, {0,8,16,24,32,40,48,56,64,80,96,112,128,144,160}} }; MpegAudioHeader::MpegAudioHeader() { } MpegAudioHeader::~MpegAudioHeader() { } int MpegAudioHeader::getChannelbitrate() { cout << "getChannelbitrate not implemented"<>1)&3); // we catch the layer==4 error later, for now go on with parsing version=(int)(((c>>3)&1)^1); if ((version==0) && lmpeg25) { DEBUG_HEADER(cout << "wrong lsf/mpeg25 combination"<>1; padding=(c&1); c>>=1; frequency=(int)(c&3); c>>=2; bitrateindex=(int)c; if(bitrateindex>=15) { DEBUG_HEADER(cout << "bitrateindex error"<>4; extendedmode=c&3; mode=(int)(c>>2); // Making information inputstereo= (mode==_MODE_SINGLE)?0:1; // // frequency can be 0,1 or 2 but the mask above allows 3 as well // check now. if (frequency > 2) { DEBUG_HEADER(cout << "frequency value out of range"<>1; if(mode==_MODE_SINGLE)stereobound=0; if(mode==_MODE_JOINT)stereobound=(extendedmode+1)<<2; break; case 1: subbandnumber=MAXSUBBAND; stereobound=subbandnumber; tableindex=0; if(mode==_MODE_SINGLE)stereobound=0; if(mode==_MODE_JOINT)stereobound=(extendedmode+1)<<2; break; default: DEBUG_HEADER(cout <<"unknown layer"<protection=protection; dest->layer=layer; dest->version=version; dest->padding=padding; dest->frequency=frequency; dest->frequencyHz=frequencyHz; dest->bitrateindex=bitrateindex; dest->extendedmode=extendedmode; dest->mode=mode; dest->inputstereo=inputstereo; dest->channelbitrate=channelbitrate; dest->tableindex=tableindex; dest->subbandnumber=subbandnumber; dest->stereobound=stereobound; dest->framesize=framesize; dest->layer3slots=layer3slots; dest->lmpeg25=lmpeg25; } void MpegAudioHeader::print(const char* name) { cout << "MpegAudioHeader [START]:"<