/* 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_FLAC_YES) //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- #include "MediaInfo/Audio/File_Flac.h" #include "MediaInfo/Tag/File_VorbisCom.h" #include "ThirdParty/base64/base64.h" //--------------------------------------------------------------------------- namespace MediaInfoLib { //*************************************************************************** // Infos //*************************************************************************** //--------------------------------------------------------------------------- extern const char* Id3v2_PictureType(int8u Type); //In Tag/File_Id3v2.cpp extern std::string ExtensibleWave_ChannelMask (int32u ChannelMask); //In Multiple/File_Riff_Elements.cpp extern std::string ExtensibleWave_ChannelMask2 (int32u ChannelMask); //In Multiple/File_Riff_Elements.cpp extern std::string ExtensibleWave_ChannelMask_ChannelLayout(int32u ChannelMask); //In Multiple/File_Riff_Elements.cpp //*************************************************************************** // Constructor/Destructor //*************************************************************************** //--------------------------------------------------------------------------- File_Flac::File_Flac() :File__Analyze(), File__Tags_Helper() { //File__Tags_Helper Base=this; //In NoFileHeader=false; VorbisHeader=false; //Temp IsAudioFrames=false; } //*************************************************************************** // Buffer - File header //*************************************************************************** //--------------------------------------------------------------------------- bool File_Flac::FileHeader_Begin() { if (NoFileHeader) return true; if (NoFileHeader || !File__Tags_Helper::FileHeader_Begin()) return false; //Element_Size if (Buffer_Size4) Skip_XX(Element_Size-4, "(Application specific)"); } //--------------------------------------------------------------------------- void File_Flac::VORBIS_COMMENT() { //Parsing #if defined(MEDIAINFO_VORBISCOM_YES) File_VorbisCom VorbisCom; VorbisCom.StreamKind_Specific=Stream_Audio; Open_Buffer_Init(&VorbisCom); Open_Buffer_Continue(&VorbisCom); File__Analyze::Finish(&VorbisCom); //Specific case: bit depth if (!VorbisCom.Retrieve(Stream_Audio, 0, Audio_BitDepth).empty() && VorbisCom.Retrieve(Stream_Audio, 0, Audio_BitDepth).To_int64u()Element_Size) return; //There is a problem //Filling Fill(Stream_General, 0, General_Cover, "Yes"); Fill(Stream_General, 0, General_Cover_Description, Description); Fill(Stream_General, 0, General_Cover_Type, Id3v2_PictureType((int8u)PictureType)); Fill(Stream_General, 0, General_Cover_Mime, MimeType); #if MEDIAINFO_ADVANCED if (MediaInfoLib::Config.Flags1_Get(Flags_Cover_Data_base64)) { std::string Data_Raw((const char*)(Buffer+(size_t)(Buffer_Offset+Element_Offset)), Data_Size); std::string Data_Base64(Base64::encode(Data_Raw)); Fill(Stream_General, 0, General_Cover_Data, Data_Base64); } #endif //MEDIAINFO_ADVANCED Skip_XX(Data_Size, "Data"); if (Element_Offset