/* Copyright (c) MediaArea.net SARL. All Rights Reserved. * * Use of this source code is governed by a BSD-style license that can * be found in the License.html file in the root of the source tree. */ //--------------------------------------------------------------------------- // Pre-compilation #include "MediaInfo/PreComp.h" #ifdef __BORLANDC__ #pragma hdrstop #endif //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Setup.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #if defined(MEDIAINFO_APE_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Ape.h" using namespace std; using namespace ZenLib; //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- int32u Ape_SamplesPerFrame(int16u Version, int16u CompressionLevel) { if (Version>=3950) return 73728*4; else if (Version>=3900) return 73728; else if (Version>=3800 && CompressionLevel==4000) return 73728; else return 9216; } //--------------------------------------------------------------------------- const char* Ape_Codec_Settings(int16u Setting) { switch (Setting) { case 1000 : return "Fast"; case 2000 : return "Normal"; case 3000 : return "High"; case 4000 : return "Extra-high"; case 5000 : return "Insane"; default : return ""; } } //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Ape::File_Ape() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; } //*************************************************************************** // Streams management //*************************************************************************** //--------------------------------------------------------------------------- void File_Ape::Streams_Finish() { //Filling int64u CompressedSize=File_Size-TagsSize; float32 CompressionRatio=((float32)UncompressedSize)/CompressedSize; int64u BitRate=Duration?(CompressedSize*8*1000/Duration):0; Fill(Stream_Audio, 0, Audio_Compression_Ratio, CompressionRatio); Fill(Stream_Audio, 0, Audio_BitRate, BitRate); File__Tags_Helper::Streams_Finish(); } //*************************************************************************** // Buffer //*************************************************************************** //--------------------------------------------------------------------------- bool File_Ape::FileHeader_Begin() { if (!File__Tags_Helper::FileHeader_Begin()) return false; //Testing if (Buffer_Size