├── foo_cad_plus ├── Plugin.rc ├── taglib │ ├── taglib_config.h │ ├── flac │ │ ├── flacmetadatablock.cpp │ │ ├── flacmetadatablock.h │ │ ├── flacunknownmetadatablock.cpp │ │ ├── flacunknownmetadatablock.h │ │ └── flacproperties.h │ ├── taglib_export.h │ ├── mpeg │ │ ├── id3v2 │ │ │ ├── id3v2footer.cpp │ │ │ ├── id3v2extendedheader.cpp │ │ │ ├── id3v2synchdata.cpp │ │ │ ├── id3v2synchdata.h │ │ │ ├── id3v2footer.h │ │ │ ├── frames │ │ │ │ ├── unknownframe.cpp │ │ │ │ ├── unknownframe.h │ │ │ │ ├── privateframe.h │ │ │ │ ├── privateframe.cpp │ │ │ │ ├── popularimeterframe.h │ │ │ │ ├── popularimeterframe.cpp │ │ │ │ ├── uniquefileidentifierframe.h │ │ │ │ └── uniquefileidentifierframe.cpp │ │ │ └── id3v2extendedheader.h │ │ ├── id3v1 │ │ │ └── id3v1genres.h │ │ ├── xingheader.cpp │ │ ├── xingheader.h │ │ └── mpegproperties.h │ ├── audioproperties.cpp │ ├── toolkit │ │ ├── tdebug.h │ │ ├── tdebuglistener.cpp │ │ ├── tdebuglistener.h │ │ ├── tdebug.cpp │ │ ├── tbytevectorlist.h │ │ ├── tbytevectorlist.cpp │ │ ├── trefcounter.cpp │ │ ├── tstringlist.cpp │ │ ├── tstringlist.h │ │ ├── trefcounter.h │ │ └── tiostream.cpp │ ├── mp4 │ │ ├── mp4properties.h │ │ ├── mp4coverart.h │ │ ├── mp4coverart.cpp │ │ ├── mp4item.h │ │ ├── mp4file.cpp │ │ ├── mp4atom.h │ │ ├── mp4file.h │ │ └── mp4item.cpp │ ├── asf │ │ ├── asfproperties.h │ │ └── asfproperties.cpp │ ├── ogg │ │ ├── speex │ │ │ ├── speexproperties.h │ │ │ └── speexfile.cpp │ │ ├── vorbis │ │ │ ├── vorbisproperties.h │ │ │ └── vorbisfile.cpp │ │ └── oggfile.h │ ├── tagunion.h │ ├── ape │ │ └── apeproperties.h │ ├── audioproperties.h │ └── mpc │ │ └── mpcproperties.h ├── FindCover.h ├── PlusMsg.h ├── foo_cad_plus.props ├── PlusCover.h ├── Rainmeter │ └── PluginNowPlaying │ │ ├── StdAfx.cpp │ │ ├── StdAfx.h │ │ └── Cover.h ├── FindCover.cpp ├── cad_sdk.h └── Plugin.h ├── README.md └── foo_cad_plus.sln /foo_cad_plus/Plugin.rc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/RangerCD/foo-cad-plus/HEAD/foo_cad_plus/Plugin.rc -------------------------------------------------------------------------------- /foo_cad_plus/taglib/taglib_config.h: -------------------------------------------------------------------------------- 1 | /* taglib_config.h. Generated by cmake from taglib_config.h.cmake */ 2 | 3 | #define TAGLIB_WITH_ASF 1 4 | #define TAGLIB_WITH_MP4 1 5 | -------------------------------------------------------------------------------- /foo_cad_plus/FindCover.h: -------------------------------------------------------------------------------- 1 | #ifndef FOOCAD_FINDCOVER_H 2 | #define FOOCAD_FINDCOVER_H 3 | 4 | #include "Cover.h" 5 | 6 | class FindCover 7 | : public CCover 8 | { 9 | public: 10 | static bool GetEmbedded(const TagLib::FileRef& fr, std::wstring& target); 11 | }; 12 | 13 | #endif -------------------------------------------------------------------------------- /foo_cad_plus/PlusMsg.h: -------------------------------------------------------------------------------- 1 | #ifndef FOOCAD_PLUSMSG_H 2 | #define FOOCAD_PLUSMSG_H 3 | 4 | #include 5 | 6 | enum PlusMsg 7 | { 8 | PlusMsg_SetAttribute = WM_USER + 128, 9 | PlusMsg_GetAttribute = WM_USER + 129, 10 | 11 | PlusMsg_User = WM_USER + 255 12 | }; 13 | 14 | enum PlusAttr 15 | { 16 | PlusAttr_CoverNotRequired = 0x0000, 17 | PlusAttr_CoverRequired = 0x0001 18 | }; 19 | 20 | #endif -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | *foo_cad_plus* is a foobar2000 plugin based on *foo_cad*. 2 | 3 | > *foo_cad* is a foobar2000 plugin to add support for [Rainmeter](http://rainmeter.net/) and [CD Art Display](http://cdartdisplay.com/) skins. To download foo_cad, follow the [installation instructions](http://poiru.github.com/foo-cad). 4 | > 5 | > To build foo_cad, get the foobar2000 SDK and place the root `foo_cad` directory in the `foobar2000` directory (alongside `SDK`). Then, open `foo_cad\foo_cad.sln` with Visual Studio 2010. 6 | 7 | In order to add support for [SAO Utils](http://www.gpbeta.com/post/develop/sao-utils/), foo_cad_plus provides more interfaces.

8 | 9 | Thanks
10 | >Rainmeter/PluginNowPlaying - https://github.com/rainmeter/rainmeter
11 | >taglib - https://github.com/taglib/taglib 12 | -------------------------------------------------------------------------------- /foo_cad_plus/foo_cad_plus.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(ProgramFiles)\foobar2000\foobar2000.exe 5 | $(ProgramFiles)\foobar2000\ 6 | WindowsLocalDebugger 7 | 8 | 9 | $(ProgramFiles)\foobar2000\foobar2000.exe 10 | $(ProgramFiles)\foobar2000\ 11 | WindowsLocalDebugger 12 | 13 | 14 | -------------------------------------------------------------------------------- /foo_cad_plus/PlusCover.h: -------------------------------------------------------------------------------- 1 | #ifndef FOOCAD_PLUSCOVER_H 2 | #define FOOCAD_PLUSCOVER_H 3 | 4 | #include 5 | 6 | class PlusCover 7 | { 8 | public: 9 | PlusCover(); 10 | ~PlusCover(); 11 | 12 | #if defined(_WIN64) 13 | unsigned long long m_hCryptProv; 14 | #else 15 | unsigned long m_hCryptProv; 16 | #endif 17 | 18 | std::wstring m_wstrTempDir; 19 | 20 | std::wstring GetCover(const std::wstring & FilePath); 21 | 22 | private: 23 | bool SearchCacheFile(const std::wstring & CacheName, std::wstring & CoverPath); 24 | bool GenCover(const std::wstring & FilePath, std::wstring & CoverPath); 25 | bool SearchCover(const std::wstring & FilePath, std::wstring & CoverPath); 26 | 27 | bool GetCacheName(const std::wstring & FilePath, std::wstring & CacheName); 28 | 29 | void ClearCache(bool bClearAll = false); 30 | 31 | void CreateCrypt(); 32 | void ReleaseCrypt(); 33 | }; 34 | 35 | #endif -------------------------------------------------------------------------------- /foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010-2011 Birunthan Mohanathas (www.poiru.net) 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #include "StdAfx.h" 20 | -------------------------------------------------------------------------------- /foo_cad_plus/FindCover.cpp: -------------------------------------------------------------------------------- 1 | #include "FindCover.h" 2 | 3 | #include 4 | #include 5 | 6 | using namespace std; 7 | 8 | bool FindCover::GetEmbedded(const TagLib::FileRef & fr, std::wstring & target) 9 | { 10 | if (CCover::GetEmbedded(fr, target)) 11 | { 12 | char buffer[10]; 13 | 14 | fstream fs(target, ios::in | ios::binary); 15 | 16 | fs.read(buffer, 10); 17 | 18 | fs.close(); 19 | 20 | wstring OldPath = target; 21 | 22 | if (!memcmp(&buffer[0], "\xff\xd8", 2)) 23 | { 24 | target += L".jpg"; 25 | } 26 | else if (!memcmp(&buffer[1], "PNG", 3)) 27 | { 28 | target += L".png"; 29 | } 30 | else if (!memcmp(&buffer[0], "BM", 2)) 31 | { 32 | target += L".bmp"; 33 | } 34 | else if (!memcmp(&buffer[0], "GIF", 3)) 35 | { 36 | target += L".gif"; 37 | } 38 | else 39 | return true; 40 | 41 | if (_wrename(OldPath.c_str(), target.c_str())) 42 | target = OldPath; 43 | 44 | return true; 45 | } 46 | return false; 47 | } 48 | -------------------------------------------------------------------------------- /foo_cad_plus/cad_sdk.h: -------------------------------------------------------------------------------- 1 | #ifndef CADSDK_H_ 2 | #define CADSDK_H_ 3 | 4 | enum CadMessage 5 | { 6 | CM_PLAY = 100, 7 | CM_PLAYPAUSE = 101, 8 | CM_PAUSE = 102, 9 | CM_STOP = 103, 10 | CM_NEXT = 104, 11 | CM_PREVIOUS = 105, 12 | CM_SETVOLUME = 108, 13 | CM_GETVOLUME = 109, 14 | CM_GETCURRENTTRACK = 110, 15 | CM_GETDURATION = 113, 16 | CM_SETPOSITION = 114, 17 | CM_REGISTER = 120, 18 | CM_GETPOSITION = 122, 19 | CM_SHOWWINDOW = 124, 20 | CM_GETSTATE = 125, 21 | CM_SETREPEAT = 128, 22 | PM_SHUTDOWN = 129, 23 | CM_GETREPEAT = 130, 24 | CM_CLOSE = 131, 25 | CM_GETSHUFFLE = 140, 26 | CM_SETSHUFFLE = 141, 27 | CM_SETRATING = 639, 28 | CM_GETLYRICS = 801 29 | }; 30 | 31 | enum PlayerMessage 32 | { 33 | PM_VOLUMECHANGED = 108, 34 | PM_TRACKCHANGED = 123, 35 | PM_STATECHANGED = 126, 36 | PM_REPEATCHANGED = 128, 37 | PM_SHUFFLECHANGED = 140, 38 | PM_RATINGCHANGED = 639, 39 | PM_REGISTER = 700, 40 | PM_TRACKDATA = 701, 41 | PM_LYRICSDATA = 702 42 | }; 43 | 44 | enum PlayerState 45 | { 46 | PS_STOPPED, 47 | PS_PLAYING, 48 | PS_PAUSED 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /foo_cad_plus/Rainmeter/PluginNowPlaying/StdAfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2010-2011 Birunthan Mohanathas (www.poiru.net) 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef __STDAFX_H__ 20 | #define __STDAFX_H__ 21 | 22 | // WinAPI 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | // STL 30 | #include 31 | #include 32 | 33 | // Runtime 34 | #include 35 | 36 | //Not needed 37 | //// Rainmeter's exported functions 38 | //#include "../../Library/Export.h" 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /foo_cad_plus/Rainmeter/PluginNowPlaying/Cover.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 Birunthan Mohanathas (www.poiru.net) 3 | 4 | This program is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU General Public License 6 | as published by the Free Software Foundation; either version 2 7 | of the License, or (at your option) any later version. 8 | 9 | This program is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU General Public License for more details. 13 | 14 | You should have received a copy of the GNU General Public License 15 | along with this program; if not, write to the Free Software 16 | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 | */ 18 | 19 | #ifndef __COVER_H__ 20 | #define __COVER_H__ 21 | 22 | // TagLib 23 | #include "fileref.h" 24 | #include "apefile.h" 25 | #include "apetag.h" 26 | #include "asffile.h" 27 | #include "attachedpictureframe.h" 28 | #include "commentsframe.h" 29 | #include "flacfile.h" 30 | #include "id3v1genres.h" 31 | #include "id3v2tag.h" 32 | #include "mpcfile.h" 33 | #include "mpegfile.h" 34 | #include "mp4file.h" 35 | #include "tag.h" 36 | #include "taglib.h" 37 | #include "textidentificationframe.h" 38 | #include "tstring.h" 39 | #include "vorbisfile.h" 40 | 41 | class CCover 42 | { 43 | public: 44 | static bool GetCached(std::wstring& path); 45 | static bool GetLocal(std::wstring filename, const std::wstring& folder, std::wstring& target); 46 | static bool GetEmbedded(const TagLib::FileRef& fr, const std::wstring& target); 47 | static std::wstring GetFileFolder(const std::wstring& file); 48 | }; 49 | 50 | #endif -------------------------------------------------------------------------------- /foo_cad_plus/Plugin.h: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2012 Birunthan Mohanathas 3 | 2015 RangerCD 4 | 5 | This program is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU Lesser General Public License as published 7 | by the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This program is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU Lesser General Public License 16 | along with this program. If not, see . 17 | */ 18 | 19 | #ifndef FOOCAD_PLUGIN_H_ 20 | #define FOOCAD_PLUGIN_H_ 21 | 22 | #include "../../SDK/foobar2000.h" 23 | #include "PlusCover.h" 24 | 25 | class foo_cad : 26 | public initquit, 27 | public play_callback 28 | { 29 | public: 30 | foo_cad(); 31 | ~foo_cad(); 32 | 33 | void on_init(); 34 | void on_quit(); 35 | 36 | void on_playback_starting(play_control::t_track_command command, bool paused); 37 | void on_playback_stop(play_control::t_stop_reason reason); 38 | void on_playback_pause(bool state); 39 | void on_playback_new_track(metadb_handle_ptr track); 40 | void on_playback_edited(metadb_handle_ptr track) { on_playback_new_track(track); } 41 | void on_playback_dynamic_info_track(const file_info& info); 42 | 43 | // Not implemented 44 | void on_playback_time(double time) {} 45 | void on_playback_seek(double time) {} 46 | void on_playback_dynamic_info(file_info const& info) {} 47 | void on_volume_change(float p_new_val) {} 48 | 49 | private: 50 | void register_cad(HWND cad); 51 | static LRESULT CALLBACK window_proc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); 52 | 53 | HWND m_window; 54 | HWND m_cad_window; 55 | 56 | //Plus 57 | std::wstring m_strFilePath; 58 | PlusCover * m_pCover; 59 | 60 | bool m_bCoverRequired; 61 | }; 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/flac/flacmetadatablock.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2010 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include "flacmetadatablock.h" 29 | 30 | using namespace TagLib; 31 | 32 | class FLAC::MetadataBlock::MetadataBlockPrivate 33 | { 34 | public: 35 | MetadataBlockPrivate() {} 36 | 37 | }; 38 | 39 | FLAC::MetadataBlock::MetadataBlock() 40 | { 41 | d = 0; 42 | } 43 | 44 | FLAC::MetadataBlock::~MetadataBlock() 45 | { 46 | } 47 | 48 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/taglib_export.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_EXPORT_H 27 | #define TAGLIB_EXPORT_H 28 | 29 | #if defined(TAGLIB_STATIC) 30 | #define TAGLIB_EXPORT 31 | #elif (defined(_WIN32) || defined(_WIN64)) 32 | #ifdef MAKE_TAGLIB_LIB 33 | #define TAGLIB_EXPORT __declspec(dllexport) 34 | #else 35 | #define TAGLIB_EXPORT 36 | #endif 37 | #elif defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 1) 38 | #define TAGLIB_EXPORT __attribute__ ((visibility("default"))) 39 | #else 40 | #define TAGLIB_EXPORT 41 | #endif 42 | 43 | #endif 44 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2footer.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "id3v2footer.h" 27 | #include "id3v2header.h" 28 | 29 | using namespace TagLib; 30 | using namespace ID3v2; 31 | 32 | class Footer::FooterPrivate 33 | { 34 | public: 35 | static const uint size = 10; 36 | }; 37 | 38 | Footer::Footer() 39 | { 40 | 41 | } 42 | 43 | Footer::~Footer() 44 | { 45 | 46 | } 47 | 48 | TagLib::uint Footer::size() 49 | { 50 | return FooterPrivate::size; 51 | } 52 | 53 | ByteVector Footer::render(const Header *header) const 54 | { 55 | ByteVector headerData = header->render(); 56 | headerData[0] = '3'; 57 | headerData[1] = 'D'; 58 | headerData[2] = 'I'; 59 | return headerData; 60 | } 61 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/audioproperties.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "audioproperties.h" 27 | 28 | using namespace TagLib; 29 | 30 | class AudioProperties::AudioPropertiesPrivate 31 | { 32 | 33 | }; 34 | 35 | //////////////////////////////////////////////////////////////////////////////// 36 | // public methods 37 | //////////////////////////////////////////////////////////////////////////////// 38 | 39 | AudioProperties::~AudioProperties() 40 | { 41 | 42 | } 43 | 44 | //////////////////////////////////////////////////////////////////////////////// 45 | // protected methods 46 | //////////////////////////////////////////////////////////////////////////////// 47 | 48 | AudioProperties::AudioProperties(ReadStyle) 49 | { 50 | 51 | } 52 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tdebug.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_DEBUG_H 27 | #define TAGLIB_DEBUG_H 28 | 29 | namespace TagLib { 30 | 31 | class String; 32 | class ByteVector; 33 | 34 | #ifndef DO_NOT_DOCUMENT 35 | 36 | /*! 37 | * A simple function that outputs the debug messages to the listener. 38 | * The default listener redirects the messages to \a stderr when NDEBUG is 39 | * not defined. 40 | * 41 | * \warning Do not use this outside of TagLib, it could lead to undefined 42 | * symbols in your build if TagLib is built with NDEBUG defined and your 43 | * application is not. 44 | * 45 | * \internal 46 | */ 47 | void debug(const String &s); 48 | 49 | /*! 50 | * For debugging binary data. 51 | * 52 | * \warning Do not use this outside of TagLib, it could lead to undefined 53 | * symbols in your build if TagLib is built with NDEBUG defined and your 54 | * application is not. 55 | * 56 | * \internal 57 | */ 58 | void debugData(const ByteVector &v); 59 | } 60 | 61 | #endif 62 | #endif 63 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4properties.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MP4PROPERTIES_H 27 | #define TAGLIB_MP4PROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | #include "audioproperties.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace MP4 { 35 | 36 | class Atoms; 37 | class File; 38 | 39 | //! An implementation of MP4 audio properties 40 | class TAGLIB_EXPORT Properties : public AudioProperties 41 | { 42 | public: 43 | enum Codec { 44 | Unknown = 0, 45 | AAC, 46 | ALAC 47 | }; 48 | 49 | Properties(File *file, Atoms *atoms, ReadStyle style = Average); 50 | virtual ~Properties(); 51 | 52 | virtual int length() const; 53 | virtual int bitrate() const; 54 | virtual int sampleRate() const; 55 | virtual int channels() const; 56 | virtual int bitsPerSample() const; 57 | bool isEncrypted() const; 58 | 59 | //! Audio codec used in the MP4 file 60 | Codec codec() const; 61 | 62 | private: 63 | class PropertiesPrivate; 64 | PropertiesPrivate *d; 65 | }; 66 | 67 | } 68 | 69 | } 70 | 71 | #endif 72 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4coverart.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2009 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MP4COVERART_H 27 | #define TAGLIB_MP4COVERART_H 28 | 29 | #include "tlist.h" 30 | #include "tbytevector.h" 31 | #include "taglib_export.h" 32 | #include "mp4atom.h" 33 | 34 | namespace TagLib { 35 | 36 | namespace MP4 { 37 | 38 | class TAGLIB_EXPORT CoverArt 39 | { 40 | public: 41 | /*! 42 | * This describes the image type. 43 | */ 44 | enum Format { 45 | JPEG = TypeJPEG, 46 | PNG = TypePNG, 47 | BMP = TypeBMP, 48 | GIF = TypeGIF, 49 | Unknown = TypeImplicit, 50 | }; 51 | 52 | CoverArt(Format format, const ByteVector &data); 53 | ~CoverArt(); 54 | 55 | CoverArt(const CoverArt &item); 56 | CoverArt &operator=(const CoverArt &item); 57 | 58 | //! Format of the image 59 | Format format() const; 60 | 61 | //! The image data 62 | ByteVector data() const; 63 | 64 | private: 65 | class CoverArtPrivate; 66 | CoverArtPrivate *d; 67 | }; 68 | 69 | typedef List CoverArtList; 70 | 71 | } 72 | 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/flac/flacmetadatablock.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2010 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_FLACMETADATABLOCK_H 27 | #define TAGLIB_FLACMETADATABLOCK_H 28 | 29 | #include "tlist.h" 30 | #include "tbytevector.h" 31 | #include "taglib_export.h" 32 | 33 | namespace TagLib { 34 | 35 | namespace FLAC { 36 | 37 | class TAGLIB_EXPORT MetadataBlock 38 | { 39 | public: 40 | MetadataBlock(); 41 | virtual ~MetadataBlock(); 42 | 43 | enum BlockType { 44 | StreamInfo = 0, 45 | Padding, 46 | Application, 47 | SeekTable, 48 | VorbisComment, 49 | CueSheet, 50 | Picture 51 | }; 52 | 53 | /*! 54 | * Returns the FLAC metadata block type. 55 | */ 56 | virtual int code() const = 0; 57 | 58 | /*! 59 | * Render the content of the block. 60 | */ 61 | virtual ByteVector render() const = 0; 62 | 63 | private: 64 | MetadataBlock(const MetadataBlock &item); 65 | MetadataBlock &operator=(const MetadataBlock &item); 66 | 67 | class MetadataBlockPrivate; 68 | MetadataBlockPrivate *d; 69 | }; 70 | 71 | } 72 | 73 | } 74 | 75 | #endif 76 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4coverart.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2009 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include "trefcounter.h" 29 | #include "mp4coverart.h" 30 | 31 | using namespace TagLib; 32 | 33 | class MP4::CoverArt::CoverArtPrivate : public RefCounter 34 | { 35 | public: 36 | CoverArtPrivate() : RefCounter(), format(MP4::CoverArt::JPEG) {} 37 | 38 | Format format; 39 | ByteVector data; 40 | }; 41 | 42 | MP4::CoverArt::CoverArt(Format format, const ByteVector &data) 43 | { 44 | d = new CoverArtPrivate; 45 | d->format = format; 46 | d->data = data; 47 | } 48 | 49 | MP4::CoverArt::CoverArt(const CoverArt &item) : d(item.d) 50 | { 51 | d->ref(); 52 | } 53 | 54 | MP4::CoverArt & 55 | MP4::CoverArt::operator=(const CoverArt &item) 56 | { 57 | if(d->deref()) { 58 | delete d; 59 | } 60 | d = item.d; 61 | d->ref(); 62 | return *this; 63 | } 64 | 65 | MP4::CoverArt::~CoverArt() 66 | { 67 | if(d->deref()) { 68 | delete d; 69 | } 70 | } 71 | 72 | MP4::CoverArt::Format 73 | MP4::CoverArt::format() const 74 | { 75 | return d->format; 76 | } 77 | 78 | ByteVector 79 | MP4::CoverArt::data() const 80 | { 81 | return d->data; 82 | } 83 | 84 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/flac/flacunknownmetadatablock.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2010 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include "flacunknownmetadatablock.h" 30 | 31 | using namespace TagLib; 32 | 33 | class FLAC::UnknownMetadataBlock::UnknownMetadataBlockPrivate 34 | { 35 | public: 36 | UnknownMetadataBlockPrivate() : code(0) {} 37 | 38 | int code; 39 | ByteVector data; 40 | }; 41 | 42 | FLAC::UnknownMetadataBlock::UnknownMetadataBlock(int code, const ByteVector &data) 43 | { 44 | d = new UnknownMetadataBlockPrivate; 45 | d->code = code; 46 | //debug(String(data.toHex())); 47 | d->data = data; 48 | } 49 | 50 | FLAC::UnknownMetadataBlock::~UnknownMetadataBlock() 51 | { 52 | delete d; 53 | } 54 | 55 | int FLAC::UnknownMetadataBlock::code() const 56 | { 57 | return d->code; 58 | } 59 | 60 | void FLAC::UnknownMetadataBlock::setCode(int code) 61 | { 62 | d->code = code; 63 | } 64 | 65 | ByteVector FLAC::UnknownMetadataBlock::data() const 66 | { 67 | return d->data; 68 | } 69 | 70 | void FLAC::UnknownMetadataBlock::setData(const ByteVector &data) 71 | { 72 | d->data = data; 73 | } 74 | 75 | ByteVector FLAC::UnknownMetadataBlock::render() const 76 | { 77 | return d->data; 78 | } 79 | 80 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2extendedheader.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "id3v2extendedheader.h" 27 | #include "id3v2synchdata.h" 28 | 29 | using namespace TagLib; 30 | using namespace ID3v2; 31 | 32 | class ExtendedHeader::ExtendedHeaderPrivate 33 | { 34 | public: 35 | ExtendedHeaderPrivate() : size(0) {} 36 | 37 | uint size; 38 | }; 39 | 40 | //////////////////////////////////////////////////////////////////////////////// 41 | // public methods 42 | //////////////////////////////////////////////////////////////////////////////// 43 | 44 | ExtendedHeader::ExtendedHeader() 45 | { 46 | d = new ExtendedHeaderPrivate(); 47 | } 48 | 49 | ExtendedHeader::~ExtendedHeader() 50 | { 51 | delete d; 52 | } 53 | 54 | TagLib::uint ExtendedHeader::size() const 55 | { 56 | return d->size; 57 | } 58 | 59 | void ExtendedHeader::setData(const ByteVector &data) 60 | { 61 | parse(data); 62 | } 63 | 64 | //////////////////////////////////////////////////////////////////////////////// 65 | // protected members 66 | //////////////////////////////////////////////////////////////////////////////// 67 | 68 | void ExtendedHeader::parse(const ByteVector &data) 69 | { 70 | d->size = SynchData::toUInt(data.mid(0, 4)); // (structure 3.2 "Extended header size") 71 | } 72 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/asf/asfproperties.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2005-2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_ASFPROPERTIES_H 27 | #define TAGLIB_ASFPROPERTIES_H 28 | 29 | #include "audioproperties.h" 30 | #include "tstring.h" 31 | #include "taglib_export.h" 32 | 33 | namespace TagLib { 34 | 35 | namespace ASF { 36 | 37 | //! An implementation of ASF audio properties 38 | class TAGLIB_EXPORT Properties : public AudioProperties 39 | { 40 | public: 41 | 42 | /*! 43 | * Create an instance of ASF::Properties. 44 | */ 45 | Properties(); 46 | 47 | /*! 48 | * Destroys this ASF::Properties instance. 49 | */ 50 | virtual ~Properties(); 51 | 52 | // Reimplementations. 53 | virtual int length() const; 54 | virtual int bitrate() const; 55 | virtual int sampleRate() const; 56 | virtual int channels() const; 57 | bool isEncrypted() const; 58 | 59 | #ifndef DO_NOT_DOCUMENT 60 | void setLength(int value); 61 | void setBitrate(int value); 62 | void setSampleRate(int value); 63 | void setChannels(int value); 64 | void setEncrypted(bool value); 65 | #endif 66 | 67 | private: 68 | class PropertiesPrivate; 69 | PropertiesPrivate *d; 70 | }; 71 | 72 | } 73 | 74 | } 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v1/id3v1genres.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_ID3V1GENRE_H 27 | #define TAGLIB_ID3V1GENRE_H 28 | 29 | #include "tmap.h" 30 | #include "tstringlist.h" 31 | #include "taglib_export.h" 32 | 33 | namespace TagLib { 34 | namespace ID3v1 { 35 | 36 | typedef Map GenreMap; 37 | 38 | /*! 39 | * Returns the list of canonical ID3v1 genre names in the order that they 40 | * are listed in the standard. 41 | */ 42 | StringList TAGLIB_EXPORT genreList(); 43 | 44 | /*! 45 | * A "reverse mapping" that goes from the canonical ID3v1 genre name to the 46 | * respective genre number. genreMap()["Rock"] == 47 | */ 48 | GenreMap TAGLIB_EXPORT genreMap(); 49 | 50 | /*! 51 | * Returns the name of the genre at \a index in the ID3v1 genre list. If 52 | * \a index is out of range -- less than zero or greater than 146 -- a null 53 | * string will be returned. 54 | */ 55 | String TAGLIB_EXPORT genre(int index); 56 | 57 | /*! 58 | * Returns the genre index for the (case sensitive) genre \a name. If the 59 | * genre is not in the list 255 (which signifies an unknown genre in ID3v1) 60 | * will be returned. 61 | */ 62 | int TAGLIB_EXPORT genreIndex(const String &name); 63 | } 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tdebuglistener.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2013 by Tsuda Kageyu 3 | email : tsuda.kageyu@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "tdebuglistener.h" 27 | 28 | #include 29 | #include 30 | 31 | #ifdef _WIN32 32 | # include 33 | #endif 34 | 35 | using namespace TagLib; 36 | 37 | namespace 38 | { 39 | class DefaultListener : public DebugListener 40 | { 41 | public: 42 | virtual void printMessage(const String &msg) 43 | { 44 | #ifdef _WIN32 45 | 46 | const wstring wstr = msg.toWString(); 47 | const int len = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, NULL, 0, NULL, NULL); 48 | if(len != 0) { 49 | std::vector buf(len); 50 | WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, &buf[0], len, NULL, NULL); 51 | 52 | std::cerr << std::string(&buf[0]); 53 | } 54 | 55 | #else 56 | 57 | std::cerr << msg; 58 | 59 | #endif 60 | } 61 | }; 62 | 63 | DefaultListener defaultListener; 64 | } 65 | 66 | namespace TagLib 67 | { 68 | DebugListener *debugListener = &defaultListener; 69 | 70 | DebugListener::DebugListener() 71 | { 72 | } 73 | 74 | DebugListener::~DebugListener() 75 | { 76 | } 77 | 78 | void setDebugListener(DebugListener *listener) 79 | { 80 | if(listener) 81 | debugListener = listener; 82 | else 83 | debugListener = &defaultListener; 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/flac/flacunknownmetadatablock.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2010 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_FLACUNKNOWNMETADATABLOCK_H 27 | #define TAGLIB_FLACUNKNOWNMETADATABLOCK_H 28 | 29 | #include "tlist.h" 30 | #include "tbytevector.h" 31 | #include "taglib_export.h" 32 | #include "flacmetadatablock.h" 33 | 34 | namespace TagLib { 35 | 36 | namespace FLAC { 37 | 38 | class TAGLIB_EXPORT UnknownMetadataBlock : public MetadataBlock 39 | { 40 | public: 41 | UnknownMetadataBlock(int blockType, const ByteVector &data); 42 | ~UnknownMetadataBlock(); 43 | 44 | /*! 45 | * Returns the FLAC metadata block type. 46 | */ 47 | int code() const; 48 | 49 | /*! 50 | * Sets the FLAC metadata block type. 51 | */ 52 | void setCode(int code); 53 | 54 | /*! 55 | * Returns the FLAC metadata block type. 56 | */ 57 | ByteVector data() const; 58 | 59 | /*! 60 | * Sets the FLAC metadata block type. 61 | */ 62 | void setData(const ByteVector &data); 63 | 64 | /*! 65 | * Render the content of the block. 66 | */ 67 | ByteVector render() const; 68 | 69 | private: 70 | UnknownMetadataBlock(const MetadataBlock &item); 71 | UnknownMetadataBlock &operator=(const MetadataBlock &item); 72 | 73 | class UnknownMetadataBlockPrivate; 74 | UnknownMetadataBlockPrivate *d; 75 | }; 76 | 77 | } 78 | 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4item.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MP4ITEM_H 27 | #define TAGLIB_MP4ITEM_H 28 | 29 | #include "tstringlist.h" 30 | #include "mp4coverart.h" 31 | #include "taglib_export.h" 32 | 33 | namespace TagLib { 34 | 35 | namespace MP4 { 36 | 37 | class TAGLIB_EXPORT Item 38 | { 39 | public: 40 | struct IntPair { 41 | int first, second; 42 | }; 43 | 44 | Item(); 45 | Item(const Item &item); 46 | Item &operator=(const Item &item); 47 | ~Item(); 48 | 49 | Item(int value); 50 | Item(uchar value); 51 | Item(uint value); 52 | Item(long long value); 53 | Item(bool value); 54 | Item(int first, int second); 55 | Item(const StringList &value); 56 | Item(const ByteVectorList &value); 57 | Item(const CoverArtList &value); 58 | 59 | void setAtomDataType(AtomDataType type); 60 | AtomDataType atomDataType() const; 61 | 62 | int toInt() const; 63 | uchar toByte() const; 64 | uint toUInt() const; 65 | long long toLongLong() const; 66 | bool toBool() const; 67 | IntPair toIntPair() const; 68 | StringList toStringList() const; 69 | ByteVectorList toByteVectorList() const; 70 | CoverArtList toCoverArtList() const; 71 | 72 | bool isValid() const; 73 | 74 | private: 75 | class ItemPrivate; 76 | ItemPrivate *d; 77 | }; 78 | 79 | } 80 | 81 | } 82 | 83 | #endif 84 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2synchdata.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | 28 | #include "id3v2synchdata.h" 29 | 30 | using namespace TagLib; 31 | using namespace ID3v2; 32 | 33 | TagLib::uint SynchData::toUInt(const ByteVector &data) 34 | { 35 | uint sum = 0; 36 | bool notSynchSafe = false; 37 | int last = data.size() > 4 ? 3 : data.size() - 1; 38 | 39 | for(int i = 0; i <= last; i++) { 40 | if(data[i] & 0x80) { 41 | notSynchSafe = true; 42 | break; 43 | } 44 | 45 | sum |= (data[i] & 0x7f) << ((last - i) * 7); 46 | } 47 | 48 | if(notSynchSafe) { 49 | // Invalid data; assume this was created by some buggy software that just 50 | // put normal integers here rather than syncsafe ones, and try it that 51 | // way. 52 | if(data.size() >= 4) { 53 | sum = data.toUInt(0, true); 54 | } 55 | else { 56 | ByteVector tmp(data); 57 | tmp.resize(4); 58 | sum = tmp.toUInt(0, true); 59 | } 60 | } 61 | 62 | return sum; 63 | } 64 | 65 | ByteVector SynchData::fromUInt(uint value) 66 | { 67 | ByteVector v(4, 0); 68 | 69 | for(int i = 0; i < 4; i++) 70 | v[i] = uchar(value >> ((3 - i) * 7) & 0x7f); 71 | 72 | return v; 73 | } 74 | 75 | ByteVector SynchData::decode(const ByteVector &data) 76 | { 77 | ByteVector result = data; 78 | 79 | ByteVector pattern(2, char(0)); 80 | pattern[0] = '\xFF'; 81 | pattern[1] = '\x00'; 82 | 83 | return result.replace(pattern, '\xFF'); 84 | } 85 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2synchdata.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_ID3V2SYNCHDATA_H 27 | #define TAGLIB_ID3V2SYNCHDATA_H 28 | 29 | #include "tbytevector.h" 30 | #include "taglib.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace ID3v2 { 35 | 36 | //! A few functions for ID3v2 synch safe integer conversion 37 | 38 | /*! 39 | * In the ID3v2.4 standard most integer values are encoded as "synch safe" 40 | * integers which are encoded in such a way that they will not give false 41 | * MPEG syncs and confuse MPEG decoders. This namespace provides some 42 | * methods for converting to and from these values to ByteVectors for 43 | * things rendering and parsing ID3v2 data. 44 | */ 45 | 46 | namespace SynchData 47 | { 48 | /*! 49 | * This returns the unsigned integer value of \a data where \a data is a 50 | * ByteVector that contains a \e synchsafe integer (Structure, 51 | * 6.2). The default \a length of 52 | * 4 is used if another value is not specified. 53 | */ 54 | TAGLIB_EXPORT uint toUInt(const ByteVector &data); 55 | 56 | /*! 57 | * Returns a 4 byte (32 bit) synchsafe integer based on \a value. 58 | */ 59 | TAGLIB_EXPORT ByteVector fromUInt(uint value); 60 | 61 | /*! 62 | * Convert the data from unsynchronized data to its original format. 63 | */ 64 | TAGLIB_EXPORT ByteVector decode(const ByteVector &input); 65 | } 66 | 67 | } 68 | } 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2footer.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_ID3V2FOOTER_H 27 | #define TAGLIB_ID3V2FOOTER_H 28 | 29 | #include "taglib_export.h" 30 | #include "tbytevector.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace ID3v2 { 35 | 36 | class Header; 37 | 38 | //! ID3v2 footer implementation 39 | 40 | /*! 41 | * Per the ID3v2 specification, the tag's footer is just a copy of the 42 | * information in the header. As such there is no API for reading the 43 | * data from the header, it can just as easily be done from the header. 44 | * 45 | * In fact, at this point, TagLib does not even parse the footer since 46 | * it is not useful internally. However, if the flag to include a footer 47 | * has been set in the ID3v2::Tag, TagLib will render a footer. 48 | */ 49 | 50 | class TAGLIB_EXPORT Footer 51 | { 52 | public: 53 | /*! 54 | * Constructs an empty ID3v2 footer. 55 | */ 56 | Footer(); 57 | /*! 58 | * Destroys the footer. 59 | */ 60 | virtual ~Footer(); 61 | 62 | /*! 63 | * Returns the size of the footer. Presently this is always 10 bytes. 64 | */ 65 | static uint size(); 66 | 67 | /*! 68 | * Renders the footer based on the data in \a header. 69 | */ 70 | ByteVector render(const Header *header) const; 71 | 72 | private: 73 | Footer(const Footer &); 74 | Footer &operator=(const Footer &); 75 | 76 | class FooterPrivate; 77 | FooterPrivate *d; 78 | }; 79 | 80 | } 81 | } 82 | #endif 83 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tdebuglistener.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2013 by Tsuda Kageyu 3 | email : tsuda.kageyu@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_DEBUGLISTENER_H 27 | #define TAGLIB_DEBUGLISTENER_H 28 | 29 | #include "taglib_export.h" 30 | #include "tstring.h" 31 | 32 | namespace TagLib 33 | { 34 | //! An abstraction for the listener to the debug messages. 35 | 36 | /*! 37 | * This class enables you to handle the debug messages in your preferred 38 | * way by subclassing this class, reimplementing printMessage() and setting 39 | * your reimplementation as the default with setDebugListener(). 40 | * 41 | * \see setDebugListener() 42 | */ 43 | class TAGLIB_EXPORT DebugListener 44 | { 45 | public: 46 | DebugListener(); 47 | virtual ~DebugListener(); 48 | 49 | /*! 50 | * When overridden in a derived class, redirects \a msg to your preferred 51 | * channel such as stderr, Windows debugger or so forth. 52 | */ 53 | virtual void printMessage(const String &msg) = 0; 54 | 55 | private: 56 | // Noncopyable 57 | DebugListener(const DebugListener &); 58 | DebugListener &operator=(const DebugListener &); 59 | }; 60 | 61 | /*! 62 | * Sets the listener that decides how the debug messages are redirected. 63 | * If the parameter \a listener is null, the previous listener is released 64 | * and default stderr listener is restored. 65 | * 66 | * \note The caller is responsible for deleting the previous listener 67 | * as needed after it is released. 68 | * 69 | * \see DebugListener 70 | */ 71 | TAGLIB_EXPORT void setDebugListener(DebugListener *listener); 72 | } 73 | 74 | #endif 75 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/unknownframe.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "unknownframe.h" 27 | 28 | using namespace TagLib; 29 | using namespace ID3v2; 30 | 31 | class UnknownFrame::UnknownFramePrivate 32 | { 33 | public: 34 | ByteVector fieldData; 35 | }; 36 | 37 | //////////////////////////////////////////////////////////////////////////////// 38 | // public members 39 | //////////////////////////////////////////////////////////////////////////////// 40 | 41 | UnknownFrame::UnknownFrame(const ByteVector &data) : Frame(data) 42 | { 43 | d = new UnknownFramePrivate; 44 | setData(data); 45 | } 46 | 47 | UnknownFrame::~UnknownFrame() 48 | { 49 | delete d; 50 | } 51 | 52 | String UnknownFrame::toString() const 53 | { 54 | return String::null; 55 | } 56 | 57 | ByteVector UnknownFrame::data() const 58 | { 59 | return d->fieldData; 60 | } 61 | 62 | //////////////////////////////////////////////////////////////////////////////// 63 | // protected members 64 | //////////////////////////////////////////////////////////////////////////////// 65 | 66 | void UnknownFrame::parseFields(const ByteVector &data) 67 | { 68 | d->fieldData = data; 69 | } 70 | 71 | ByteVector UnknownFrame::renderFields() const 72 | { 73 | return d->fieldData; 74 | } 75 | 76 | //////////////////////////////////////////////////////////////////////////////// 77 | // private members 78 | //////////////////////////////////////////////////////////////////////////////// 79 | 80 | UnknownFrame::UnknownFrame(const ByteVector &data, Header *h) : Frame(h) 81 | { 82 | d = new UnknownFramePrivate; 83 | parseFields(fieldData(data)); 84 | } 85 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/unknownframe.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_UNKNOWNFRAME_H 27 | #define TAGLIB_UNKNOWNFRAME_H 28 | 29 | #include "id3v2frame.h" 30 | #include "taglib_export.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace ID3v2 { 35 | 36 | //! A frame type \e unknown to TagLib. 37 | 38 | /*! 39 | * This class represents a frame type not known (or more often simply 40 | * unimplemented) in TagLib. This is here provide a basic API for 41 | * manipulating the binary data of unknown frames and to provide a means 42 | * of rendering such \e unknown frames. 43 | * 44 | * Please note that a cleaner way of handling frame types that TagLib 45 | * does not understand is to subclass ID3v2::Frame and ID3v2::FrameFactory 46 | * to have your frame type supported through the standard ID3v2 mechanism. 47 | */ 48 | 49 | class TAGLIB_EXPORT UnknownFrame : public Frame 50 | { 51 | friend class FrameFactory; 52 | 53 | public: 54 | UnknownFrame(const ByteVector &data); 55 | virtual ~UnknownFrame(); 56 | 57 | virtual String toString() const; 58 | 59 | /*! 60 | * Returns the field data (everything but the header) for this frame. 61 | */ 62 | ByteVector data() const; 63 | 64 | protected: 65 | virtual void parseFields(const ByteVector &data); 66 | virtual ByteVector renderFields() const; 67 | 68 | private: 69 | UnknownFrame(const ByteVector &data, Header *h); 70 | UnknownFrame(const UnknownFrame &); 71 | UnknownFrame &operator=(const UnknownFrame &); 72 | 73 | class UnknownFramePrivate; 74 | UnknownFramePrivate *d; 75 | }; 76 | 77 | } 78 | } 79 | #endif 80 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tdebug.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "tdebug.h" 31 | #include "tstring.h" 32 | #include "tdebuglistener.h" 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | using namespace TagLib; 39 | 40 | namespace 41 | { 42 | String format(const char *fmt, ...) 43 | { 44 | va_list args; 45 | va_start(args, fmt); 46 | 47 | char buf[256]; 48 | 49 | #if defined(HAVE_SNPRINTF) 50 | 51 | vsnprintf(buf, sizeof(buf), fmt, args); 52 | 53 | #elif defined(HAVE_SPRINTF_S) 54 | 55 | vsprintf_s(buf, fmt, args); 56 | 57 | #else 58 | 59 | // Be careful. May cause a buffer overflow. 60 | vsprintf(buf, fmt, args); 61 | 62 | #endif 63 | 64 | va_end(args); 65 | 66 | return String(buf); 67 | } 68 | } 69 | 70 | namespace TagLib 71 | { 72 | // The instance is defined in tdebuglistener.cpp. 73 | extern DebugListener *debugListener; 74 | 75 | void debug(const String &s) 76 | { 77 | #if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) 78 | 79 | debugListener->printMessage("TagLib: " + s + "\n"); 80 | 81 | #endif 82 | } 83 | 84 | void debugData(const ByteVector &v) 85 | { 86 | #if !defined(NDEBUG) || defined(TRACE_IN_RELEASE) 87 | 88 | for(size_t i = 0; i < v.size(); ++i) 89 | { 90 | std::string bits = std::bitset<8>(v[i]).to_string(); 91 | String msg = format("*** [%d] - char '%c' - int %d, 0x%02x, 0b%s\n", 92 | i, v[i], v[i], v[i], bits.c_str()); 93 | 94 | debugListener->printMessage(msg); 95 | } 96 | 97 | #endif 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ogg/speex/speexproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2006 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | 5 | copyright : (C) 2002 - 2008 by Scott Wheeler 6 | email : wheeler@kde.org 7 | (original Vorbis implementation) 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * This library is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU Lesser General Public License version * 13 | * 2.1 as published by the Free Software Foundation. * 14 | * * 15 | * This library is distributed in the hope that it will be useful, but * 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 18 | * Lesser General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU Lesser General Public * 21 | * License along with this library; if not, write to the Free Software * 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 23 | * 02110-1301 USA * 24 | * * 25 | * Alternatively, this file is available under the Mozilla Public * 26 | * License Version 1.1. You may obtain a copy of the License at * 27 | * http://www.mozilla.org/MPL/ * 28 | ***************************************************************************/ 29 | 30 | #ifndef TAGLIB_SPEEXPROPERTIES_H 31 | #define TAGLIB_SPEEXPROPERTIES_H 32 | 33 | #include "audioproperties.h" 34 | 35 | namespace TagLib { 36 | 37 | namespace Ogg { 38 | 39 | namespace Speex { 40 | 41 | class File; 42 | 43 | //! An implementation of audio property reading for Ogg Speex 44 | 45 | /*! 46 | * This reads the data from an Ogg Speex stream found in the AudioProperties 47 | * API. 48 | */ 49 | 50 | class TAGLIB_EXPORT Properties : public AudioProperties 51 | { 52 | public: 53 | /*! 54 | * Create an instance of Speex::Properties with the data read from the 55 | * Speex::File \a file. 56 | */ 57 | Properties(File *file, ReadStyle style = Average); 58 | 59 | /*! 60 | * Destroys this Speex::Properties instance. 61 | */ 62 | virtual ~Properties(); 63 | 64 | // Reimplementations. 65 | 66 | virtual int length() const; 67 | virtual int bitrate() const; 68 | virtual int sampleRate() const; 69 | virtual int channels() const; 70 | 71 | /*! 72 | * Returns the Speex version, currently "0" (as specified by the spec). 73 | */ 74 | int speexVersion() const; 75 | 76 | private: 77 | Properties(const Properties &); 78 | Properties &operator=(const Properties &); 79 | 80 | void read(); 81 | 82 | class PropertiesPrivate; 83 | PropertiesPrivate *d; 84 | }; 85 | } 86 | } 87 | } 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/tagunion.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_TAGUNION_H 27 | #define TAGLIB_TAGUNION_H 28 | 29 | #include "tag.h" 30 | 31 | #ifndef DO_NOT_DOCUMENT 32 | 33 | namespace TagLib { 34 | 35 | /*! 36 | * \internal 37 | */ 38 | 39 | class TagUnion : public Tag 40 | { 41 | public: 42 | 43 | enum AccessType { Read, Write }; 44 | 45 | /*! 46 | * Creates a TagLib::Tag that is the union of \a first, \a second, and 47 | * \a third. The TagUnion takes ownership of these tags and will handle 48 | * their deletion. 49 | */ 50 | TagUnion(Tag *first = 0, Tag *second = 0, Tag *third = 0); 51 | 52 | virtual ~TagUnion(); 53 | 54 | Tag *operator[](int index) const; 55 | Tag *tag(int index) const; 56 | 57 | void set(int index, Tag *tag); 58 | 59 | virtual String title() const; 60 | virtual String artist() const; 61 | virtual String album() const; 62 | virtual String comment() const; 63 | virtual String genre() const; 64 | virtual uint year() const; 65 | virtual uint track() const; 66 | 67 | virtual void setTitle(const String &s); 68 | virtual void setArtist(const String &s); 69 | virtual void setAlbum(const String &s); 70 | virtual void setComment(const String &s); 71 | virtual void setGenre(const String &s); 72 | virtual void setYear(uint i); 73 | virtual void setTrack(uint i); 74 | virtual bool isEmpty() const; 75 | 76 | template T *access(int index, bool create) 77 | { 78 | if(!create || tag(index)) 79 | return static_cast(tag(index)); 80 | 81 | set(index, new T); 82 | return static_cast(tag(index)); 83 | } 84 | 85 | private: 86 | TagUnion(const Tag &); 87 | TagUnion &operator=(const Tag &); 88 | 89 | class TagUnionPrivate; 90 | TagUnionPrivate *d; 91 | }; 92 | } 93 | 94 | #endif 95 | #endif 96 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ape/apeproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2010 by Alex Novichkov 3 | email : novichko@atnet.ru 4 | 5 | copyright : (C) 2006 by Lukáš Lalinský 6 | email : lalinsky@gmail.com 7 | (original WavPack implementation) 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * This library is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU Lesser General Public License version * 13 | * 2.1 as published by the Free Software Foundation. * 14 | * * 15 | * This library is distributed in the hope that it will be useful, but * 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 18 | * Lesser General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU Lesser General Public * 21 | * License along with this library; if not, write to the Free Software * 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 23 | * 02110-1301 USA * 24 | * * 25 | * Alternatively, this file is available under the Mozilla Public * 26 | * License Version 1.1. You may obtain a copy of the License at * 27 | * http://www.mozilla.org/MPL/ * 28 | ***************************************************************************/ 29 | 30 | #ifndef TAGLIB_APEPROPERTIES_H 31 | #define TAGLIB_APEPROPERTIES_H 32 | 33 | #include "taglib_export.h" 34 | #include "audioproperties.h" 35 | 36 | namespace TagLib { 37 | 38 | namespace APE { 39 | 40 | class File; 41 | 42 | //! An implementation of audio property reading for APE 43 | 44 | /*! 45 | * This reads the data from an APE stream found in the AudioProperties 46 | * API. 47 | */ 48 | 49 | class TAGLIB_EXPORT Properties : public AudioProperties 50 | { 51 | public: 52 | /*! 53 | * Create an instance of APE::Properties with the data read from the 54 | * ByteVector \a data. 55 | */ 56 | Properties(File *f, ReadStyle style = Average); 57 | 58 | /*! 59 | * Destroys this APE::Properties instance. 60 | */ 61 | virtual ~Properties(); 62 | 63 | // Reimplementations. 64 | 65 | virtual int length() const; 66 | virtual int bitrate() const; 67 | virtual int sampleRate() const; 68 | virtual int channels() const; 69 | 70 | /*! 71 | * Returns number of bits per sample. 72 | */ 73 | int bitsPerSample() const; 74 | uint sampleFrames() const; 75 | 76 | /*! 77 | * Returns APE version. 78 | */ 79 | int version() const; 80 | 81 | private: 82 | Properties(const Properties &); 83 | Properties &operator=(const Properties &); 84 | 85 | void read(); 86 | 87 | long findDescriptor(); 88 | long findID3v2(); 89 | 90 | void analyzeCurrent(); 91 | void analyzeOld(); 92 | 93 | class PropertiesPrivate; 94 | PropertiesPrivate *d; 95 | }; 96 | } 97 | } 98 | 99 | #endif 100 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/asf/asfproperties.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2005-2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include "asfproperties.h" 29 | 30 | using namespace TagLib; 31 | 32 | class ASF::Properties::PropertiesPrivate 33 | { 34 | public: 35 | PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0), encrypted(false) {} 36 | int length; 37 | int bitrate; 38 | int sampleRate; 39 | int channels; 40 | bool encrypted; 41 | }; 42 | 43 | //////////////////////////////////////////////////////////////////////////////// 44 | // public members 45 | //////////////////////////////////////////////////////////////////////////////// 46 | 47 | ASF::Properties::Properties() : AudioProperties(AudioProperties::Average) 48 | { 49 | d = new PropertiesPrivate; 50 | } 51 | 52 | ASF::Properties::~Properties() 53 | { 54 | if(d) 55 | delete d; 56 | } 57 | 58 | int ASF::Properties::length() const 59 | { 60 | return d->length; 61 | } 62 | 63 | int ASF::Properties::bitrate() const 64 | { 65 | return d->bitrate; 66 | } 67 | 68 | int ASF::Properties::sampleRate() const 69 | { 70 | return d->sampleRate; 71 | } 72 | 73 | int ASF::Properties::channels() const 74 | { 75 | return d->channels; 76 | } 77 | 78 | bool ASF::Properties::isEncrypted() const 79 | { 80 | return d->encrypted; 81 | } 82 | 83 | //////////////////////////////////////////////////////////////////////////////// 84 | // private members 85 | //////////////////////////////////////////////////////////////////////////////// 86 | 87 | void ASF::Properties::setLength(int length) 88 | { 89 | d->length = length; 90 | } 91 | 92 | void ASF::Properties::setBitrate(int length) 93 | { 94 | d->bitrate = length; 95 | } 96 | 97 | void ASF::Properties::setSampleRate(int length) 98 | { 99 | d->sampleRate = length; 100 | } 101 | 102 | void ASF::Properties::setChannels(int length) 103 | { 104 | d->channels = length; 105 | } 106 | 107 | void ASF::Properties::setEncrypted(bool encrypted) 108 | { 109 | d->encrypted = encrypted; 110 | } 111 | 112 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tbytevectorlist.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_BYTEVECTORLIST_H 27 | #define TAGLIB_BYTEVECTORLIST_H 28 | 29 | #include "taglib_export.h" 30 | #include "tbytevector.h" 31 | #include "tlist.h" 32 | 33 | namespace TagLib { 34 | 35 | //! A list of ByteVectors 36 | 37 | /*! 38 | * A List specialization with some handy features useful for ByteVectors. 39 | */ 40 | 41 | class TAGLIB_EXPORT ByteVectorList : public List 42 | { 43 | public: 44 | 45 | /*! 46 | * Construct an empty ByteVectorList. 47 | */ 48 | ByteVectorList(); 49 | 50 | /*! 51 | * Destroys this ByteVectorList instance. 52 | */ 53 | virtual ~ByteVectorList(); 54 | 55 | /*! 56 | * Make a shallow, implicitly shared, copy of \a l. Because this is 57 | * implicitly shared, this method is lightweight and suitable for 58 | * pass-by-value usage. 59 | */ 60 | ByteVectorList(const ByteVectorList &l); 61 | 62 | /*! 63 | * Convert the ByteVectorList to a ByteVector separated by \a separator. By 64 | * default a space is used. 65 | */ 66 | ByteVector toByteVector(const ByteVector &separator = " ") const; 67 | 68 | /*! 69 | * Splits the ByteVector \a v into several strings at \a pattern. This will 70 | * not include the pattern in the returned ByteVectors. 71 | */ 72 | static ByteVectorList split(const ByteVector &v, const ByteVector &pattern, 73 | int byteAlign = 1); 74 | /*! 75 | * Splits the ByteVector \a v into several strings at \a pattern. This will 76 | * not include the pattern in the returned ByteVectors. \a max is the 77 | * maximum number of entries that will be separated. If \a max for instance 78 | * is 2 then a maximum of 1 match will be found and the vector will be split 79 | * on that match. 80 | */ 81 | // BIC: merge with the function above 82 | static ByteVectorList split(const ByteVector &v, const ByteVector &pattern, 83 | int byteAlign, int max); 84 | private: 85 | class ByteVectorListPrivate; 86 | ByteVectorListPrivate *d; 87 | }; 88 | 89 | } 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tbytevectorlist.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "tbytevectorlist.h" 27 | 28 | using namespace TagLib; 29 | 30 | class ByteVectorListPrivate 31 | { 32 | 33 | }; 34 | 35 | //////////////////////////////////////////////////////////////////////////////// 36 | // static members 37 | //////////////////////////////////////////////////////////////////////////////// 38 | 39 | ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &pattern, 40 | int byteAlign) 41 | { 42 | return split(v, pattern, byteAlign, 0); 43 | } 44 | 45 | ByteVectorList ByteVectorList::split(const ByteVector &v, const ByteVector &pattern, 46 | int byteAlign, int max) 47 | { 48 | ByteVectorList l; 49 | 50 | uint previousOffset = 0; 51 | for(int offset = v.find(pattern, 0, byteAlign); 52 | offset != -1 && (max == 0 || max > int(l.size()) + 1); 53 | offset = v.find(pattern, offset + pattern.size(), byteAlign)) 54 | { 55 | if(offset - previousOffset >= 1) 56 | l.append(v.mid(previousOffset, offset - previousOffset)); 57 | else 58 | l.append(ByteVector::null); 59 | 60 | previousOffset = offset + pattern.size(); 61 | } 62 | 63 | if(previousOffset < v.size()) 64 | l.append(v.mid(previousOffset, v.size() - previousOffset)); 65 | 66 | return l; 67 | } 68 | 69 | //////////////////////////////////////////////////////////////////////////////// 70 | // public members 71 | //////////////////////////////////////////////////////////////////////////////// 72 | 73 | ByteVectorList::ByteVectorList() : List() 74 | { 75 | 76 | } 77 | 78 | ByteVectorList::ByteVectorList(const ByteVectorList &l) : List(l) 79 | { 80 | 81 | } 82 | 83 | ByteVectorList::~ByteVectorList() 84 | { 85 | 86 | } 87 | 88 | ByteVector ByteVectorList::toByteVector(const ByteVector &separator) const 89 | { 90 | ByteVector v; 91 | 92 | ConstIterator it = begin(); 93 | 94 | while(it != end()) { 95 | v.append(*it); 96 | it++; 97 | if(it != end()) 98 | v.append(separator); 99 | } 100 | 101 | return v; 102 | } 103 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/xingheader.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2003 by Ismael Orenstein 3 | email : orenstein@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "xingheader.h" 31 | 32 | using namespace TagLib; 33 | 34 | class MPEG::XingHeader::XingHeaderPrivate 35 | { 36 | public: 37 | XingHeaderPrivate() : 38 | frames(0), 39 | size(0), 40 | valid(false) 41 | {} 42 | 43 | uint frames; 44 | uint size; 45 | bool valid; 46 | }; 47 | 48 | MPEG::XingHeader::XingHeader(const ByteVector &data) 49 | { 50 | d = new XingHeaderPrivate; 51 | parse(data); 52 | } 53 | 54 | MPEG::XingHeader::~XingHeader() 55 | { 56 | delete d; 57 | } 58 | 59 | bool MPEG::XingHeader::isValid() const 60 | { 61 | return d->valid; 62 | } 63 | 64 | TagLib::uint MPEG::XingHeader::totalFrames() const 65 | { 66 | return d->frames; 67 | } 68 | 69 | TagLib::uint MPEG::XingHeader::totalSize() const 70 | { 71 | return d->size; 72 | } 73 | 74 | int MPEG::XingHeader::xingHeaderOffset(TagLib::MPEG::Header::Version v, 75 | TagLib::MPEG::Header::ChannelMode c) 76 | { 77 | if(v == MPEG::Header::Version1) { 78 | if(c == MPEG::Header::SingleChannel) 79 | return 0x15; 80 | else 81 | return 0x24; 82 | } 83 | else { 84 | if(c == MPEG::Header::SingleChannel) 85 | return 0x0D; 86 | else 87 | return 0x15; 88 | } 89 | } 90 | 91 | void MPEG::XingHeader::parse(const ByteVector &data) 92 | { 93 | // Check to see if a valid Xing header is available. 94 | 95 | if(!data.startsWith("Xing") && !data.startsWith("Info")) 96 | return; 97 | 98 | // If the XingHeader doesn't contain the number of frames and the total stream 99 | // info it's invalid. 100 | 101 | if(!(data[7] & 0x01)) { 102 | debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total number of frames."); 103 | return; 104 | } 105 | 106 | if(!(data[7] & 0x02)) { 107 | debug("MPEG::XingHeader::parse() -- Xing header doesn't contain the total stream size."); 108 | return; 109 | } 110 | 111 | d->frames = data.toUInt(8U); 112 | d->size = data.toUInt(12U); 113 | 114 | d->valid = true; 115 | } 116 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/id3v2extendedheader.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_ID3V2EXTENDEDHEADER_H 27 | #define TAGLIB_ID3V2EXTENDEDHEADER_H 28 | 29 | #include "taglib_export.h" 30 | #include "tbytevector.h" 31 | #include "taglib.h" 32 | 33 | namespace TagLib { 34 | 35 | namespace ID3v2 { 36 | 37 | //! ID3v2 extended header implementation 38 | 39 | /*! 40 | * This class implements ID3v2 extended headers. It attempts to follow, 41 | * both semantically and programatically, the structure specified in 42 | * the ID3v2 standard. The API is based on the properties of ID3v2 extended 43 | * headers specified there. If any of the terms used in this documentation 44 | * are unclear please check the specification in the linked section. 45 | * (Structure, 3.2) 46 | */ 47 | 48 | class TAGLIB_EXPORT ExtendedHeader 49 | { 50 | public: 51 | /*! 52 | * Constructs an empty ID3v2 extended header. 53 | */ 54 | ExtendedHeader(); 55 | 56 | /*! 57 | * Destroys the extended header. 58 | */ 59 | virtual ~ExtendedHeader(); 60 | 61 | /*! 62 | * Returns the size of the extended header. This is variable for the 63 | * extended header. 64 | */ 65 | uint size() const; 66 | 67 | /*! 68 | * Sets the data that will be used as the extended header. Since the 69 | * length is not known before the extended header has been parsed, this 70 | * should just be a pointer to the first byte of the extended header. It 71 | * will determine the length internally and make that available through 72 | * size(). 73 | */ 74 | void setData(const ByteVector &data); 75 | 76 | protected: 77 | /*! 78 | * Called by setData() to parse the extended header data. It makes this 79 | * information available through the public API. 80 | */ 81 | void parse(const ByteVector &data); 82 | 83 | private: 84 | ExtendedHeader(const ExtendedHeader &); 85 | ExtendedHeader &operator=(const ExtendedHeader &); 86 | 87 | class ExtendedHeaderPrivate; 88 | ExtendedHeaderPrivate *d; 89 | }; 90 | 91 | } 92 | } 93 | #endif 94 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/flac/flacproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2003 by Allan Sandfeld Jensen 3 | email : kde@carewolf.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_FLACPROPERTIES_H 27 | #define TAGLIB_FLACPROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | #include "audioproperties.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace FLAC { 35 | 36 | class File; 37 | 38 | //! An implementation of audio property reading for FLAC 39 | 40 | /*! 41 | * This reads the data from an FLAC stream found in the AudioProperties 42 | * API. 43 | */ 44 | 45 | class TAGLIB_EXPORT Properties : public AudioProperties 46 | { 47 | public: 48 | /*! 49 | * Create an instance of FLAC::Properties with the data read from the 50 | * ByteVector \a data. 51 | */ 52 | // BIC: switch to const reference 53 | Properties(ByteVector data, long streamLength, ReadStyle style = Average); 54 | 55 | /*! 56 | * Create an instance of FLAC::Properties with the data read from the 57 | * FLAC::File \a file. 58 | */ 59 | // BIC: remove 60 | Properties(File *file, ReadStyle style = Average); 61 | 62 | /*! 63 | * Destroys this FLAC::Properties instance. 64 | */ 65 | virtual ~Properties(); 66 | 67 | // Reimplementations. 68 | 69 | virtual int length() const; 70 | virtual int bitrate() const; 71 | virtual int sampleRate() const; 72 | virtual int channels() const; 73 | 74 | /*! 75 | * Returns the sample width as read from the FLAC identification 76 | * header. 77 | */ 78 | int sampleWidth() const; 79 | 80 | /*! 81 | * Return the number of sample frames 82 | */ 83 | unsigned long long sampleFrames() const; 84 | 85 | /*! 86 | * Returns the MD5 signature of the uncompressed audio stream as read 87 | * from the stream info header header. 88 | */ 89 | ByteVector signature() const; 90 | 91 | private: 92 | Properties(const Properties &); 93 | Properties &operator=(const Properties &); 94 | 95 | void read(); 96 | 97 | class PropertiesPrivate; 98 | PropertiesPrivate *d; 99 | }; 100 | } 101 | } 102 | 103 | #endif 104 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/trefcounter.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2013 by Tsuda Kageyu 3 | email : tsuda.kageyu@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifdef HAVE_CONFIG_H 27 | #include 28 | #endif 29 | 30 | #include "trefcounter.h" 31 | 32 | #if defined(HAVE_STD_ATOMIC) 33 | # include 34 | # define ATOMIC_INT std::atomic 35 | # define ATOMIC_INC(x) x.fetch_add(1) 36 | # define ATOMIC_DEC(x) (x.fetch_sub(1) - 1) 37 | #elif defined(HAVE_BOOST_ATOMIC) 38 | # include 39 | # define ATOMIC_INT boost::atomic 40 | # define ATOMIC_INC(x) x.fetch_add(1) 41 | # define ATOMIC_DEC(x) (x.fetch_sub(1) - 1) 42 | #elif defined(HAVE_GCC_ATOMIC) 43 | # define ATOMIC_INT int 44 | # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) 45 | # define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1) 46 | #elif defined(HAVE_WIN_ATOMIC) 47 | # if !defined(NOMINMAX) 48 | # define NOMINMAX 49 | # endif 50 | # include 51 | # define ATOMIC_INT long 52 | # define ATOMIC_INC(x) InterlockedIncrement(&x) 53 | # define ATOMIC_DEC(x) InterlockedDecrement(&x) 54 | #elif defined(HAVE_MAC_ATOMIC) 55 | # include 56 | # define ATOMIC_INT int32_t 57 | # define ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x) 58 | # define ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x) 59 | #elif defined(HAVE_IA64_ATOMIC) 60 | # include 61 | # define ATOMIC_INT int 62 | # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) 63 | # define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1) 64 | #else 65 | # define ATOMIC_INT int 66 | # define ATOMIC_INC(x) (++x) 67 | # define ATOMIC_DEC(x) (--x) 68 | #endif 69 | 70 | namespace TagLib 71 | { 72 | class RefCounter::RefCounterPrivate 73 | { 74 | public: 75 | RefCounterPrivate() : refCount(1) {} 76 | 77 | void ref() { ATOMIC_INC(refCount); } 78 | bool deref() { return (ATOMIC_DEC(refCount) == 0); } 79 | int count() const { return refCount; } 80 | 81 | volatile ATOMIC_INT refCount; 82 | }; 83 | 84 | RefCounter::RefCounter() 85 | : d(new RefCounterPrivate()) 86 | { 87 | } 88 | 89 | RefCounter::~RefCounter() 90 | { 91 | delete d; 92 | } 93 | 94 | void RefCounter::ref() 95 | { 96 | d->ref(); 97 | } 98 | 99 | bool RefCounter::deref() 100 | { 101 | return d->deref(); 102 | } 103 | 104 | int RefCounter::count() const 105 | { 106 | return d->count(); 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/privateframe.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2008 by Serkan Kalyoncu 3 | copyright : (C) 2008 by Scott Wheeler 4 | email : wheeler@kde.org 5 | ***************************************************************************/ 6 | 7 | /*************************************************************************** 8 | * This library is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU Lesser General Public License version * 10 | * 2.1 as published by the Free Software Foundation. * 11 | * * 12 | * This library is distributed in the hope that it will be useful, but * 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 15 | * Lesser General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU Lesser General Public * 18 | * License along with this library; if not, write to the Free Software * 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 20 | * 02110-1301 USA * 21 | * * 22 | * Alternatively, this file is available under the Mozilla Public * 23 | * License Version 1.1. You may obtain a copy of the License at * 24 | * http://www.mozilla.org/MPL/ * 25 | ***************************************************************************/ 26 | 27 | #ifndef TAGLIB_PRIVATEFRAME_H 28 | #define TAGLIB_PRIVATEFRAME_H 29 | 30 | #include "id3v2frame.h" 31 | #include "taglib_export.h" 32 | 33 | namespace TagLib { 34 | 35 | namespace ID3v2 { 36 | 37 | //! An implementation of ID3v2 privateframe 38 | 39 | class TAGLIB_EXPORT PrivateFrame : public Frame 40 | { 41 | friend class FrameFactory; 42 | 43 | public: 44 | /*! 45 | * Construct an empty private frame. 46 | */ 47 | PrivateFrame(); 48 | 49 | /*! 50 | * Construct a private frame based on the data in \a data. 51 | * 52 | * \note This is the constructor used when parsing the frame from a file. 53 | */ 54 | explicit PrivateFrame(const ByteVector &data); 55 | 56 | /*! 57 | * Destroys this private frame instance. 58 | */ 59 | virtual ~PrivateFrame(); 60 | 61 | /*! 62 | * Returns the text of this private frame, currently just the owner. 63 | * 64 | * \see text() 65 | */ 66 | virtual String toString() const; 67 | 68 | /*! 69 | * \return The owner of the private frame. 70 | * \note This should contain an email address or link to a website. 71 | */ 72 | String owner() const; 73 | 74 | /*! 75 | * 76 | */ 77 | ByteVector data() const; 78 | 79 | /*! 80 | * Sets the owner of the frame to \a s. 81 | * \note This should contain an email address or link to a website. 82 | */ 83 | void setOwner(const String &s); 84 | 85 | /*! 86 | * 87 | */ 88 | void setData(const ByteVector &v); 89 | 90 | protected: 91 | // Reimplementations. 92 | 93 | virtual void parseFields(const ByteVector &data); 94 | virtual ByteVector renderFields() const; 95 | 96 | private: 97 | /*! 98 | * The constructor used by the FrameFactory. 99 | */ 100 | PrivateFrame(const ByteVector &data, Header *h); 101 | 102 | PrivateFrame(const PrivateFrame &); 103 | PrivateFrame &operator=(const PrivateFrame &); 104 | 105 | class PrivateFramePrivate; 106 | PrivateFramePrivate *d; 107 | }; 108 | 109 | } 110 | } 111 | #endif 112 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/xingheader.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2003 by Ismael Orenstein 3 | email : orenstein@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_XINGHEADER_H 27 | #define TAGLIB_XINGHEADER_H 28 | 29 | #include "mpegheader.h" 30 | #include "taglib_export.h" 31 | 32 | namespace TagLib { 33 | 34 | class ByteVector; 35 | 36 | namespace MPEG { 37 | 38 | //! An implementation of the Xing VBR headers 39 | 40 | /*! 41 | * This is a minimalistic implementation of the Xing VBR headers. Xing 42 | * headers are often added to VBR (variable bit rate) MP3 streams to make it 43 | * easy to compute the length and quality of a VBR stream. Our implementation 44 | * is only concerned with the total size of the stream (so that we can 45 | * calculate the total playing time and the average bitrate). It uses 46 | * this text 47 | * and the XMMS sources as references. 48 | */ 49 | 50 | class TAGLIB_EXPORT XingHeader 51 | { 52 | public: 53 | /*! 54 | * Parses a Xing header based on \a data. The data must be at least 16 55 | * bytes long (anything longer than this is discarded). 56 | */ 57 | XingHeader(const ByteVector &data); 58 | 59 | /*! 60 | * Destroy this XingHeader instance. 61 | */ 62 | virtual ~XingHeader(); 63 | 64 | /*! 65 | * Returns true if the data was parsed properly and if there is a valid 66 | * Xing header present. 67 | */ 68 | bool isValid() const; 69 | 70 | /*! 71 | * Returns the total number of frames. 72 | */ 73 | uint totalFrames() const; 74 | 75 | /*! 76 | * Returns the total size of stream in bytes. 77 | */ 78 | uint totalSize() const; 79 | 80 | /*! 81 | * Returns the offset for the start of this Xing header, given the 82 | * version and channels of the frame 83 | */ 84 | // BIC: rename to offset() 85 | static int xingHeaderOffset(TagLib::MPEG::Header::Version v, 86 | TagLib::MPEG::Header::ChannelMode c); 87 | 88 | private: 89 | XingHeader(const XingHeader &); 90 | XingHeader &operator=(const XingHeader &); 91 | 92 | void parse(const ByteVector &data); 93 | 94 | class XingHeaderPrivate; 95 | XingHeaderPrivate *d; 96 | }; 97 | } 98 | } 99 | 100 | #endif 101 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/mpegproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MPEGPROPERTIES_H 27 | #define TAGLIB_MPEGPROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | #include "audioproperties.h" 31 | 32 | #include "mpegheader.h" 33 | 34 | namespace TagLib { 35 | 36 | namespace MPEG { 37 | 38 | class File; 39 | class XingHeader; 40 | 41 | //! An implementation of audio property reading for MP3 42 | 43 | /*! 44 | * This reads the data from an MPEG Layer III stream found in the 45 | * AudioProperties API. 46 | */ 47 | 48 | class TAGLIB_EXPORT Properties : public AudioProperties 49 | { 50 | public: 51 | /*! 52 | * Create an instance of MPEG::Properties with the data read from the 53 | * MPEG::File \a file. 54 | */ 55 | Properties(File *file, ReadStyle style = Average); 56 | 57 | /*! 58 | * Destroys this MPEG Properties instance. 59 | */ 60 | virtual ~Properties(); 61 | 62 | // Reimplementations. 63 | 64 | virtual int length() const; 65 | virtual int bitrate() const; 66 | virtual int sampleRate() const; 67 | virtual int channels() const; 68 | 69 | /*! 70 | * Returns a pointer to the XingHeader if one exists or null if no 71 | * XingHeader was found. 72 | */ 73 | 74 | const XingHeader *xingHeader() const; 75 | 76 | /*! 77 | * Returns the MPEG Version of the file. 78 | */ 79 | Header::Version version() const; 80 | 81 | /*! 82 | * Returns the layer version. This will be between the values 1-3. 83 | */ 84 | int layer() const; 85 | 86 | /*! 87 | * Returns true if the MPEG protection bit is enabled. 88 | */ 89 | bool protectionEnabled() const; 90 | 91 | /*! 92 | * Returns the channel mode for this frame. 93 | */ 94 | Header::ChannelMode channelMode() const; 95 | 96 | /*! 97 | * Returns true if the copyrighted bit is set. 98 | */ 99 | bool isCopyrighted() const; 100 | 101 | /*! 102 | * Returns true if the "original" bit is set. 103 | */ 104 | bool isOriginal() const; 105 | 106 | private: 107 | Properties(const Properties &); 108 | Properties &operator=(const Properties &); 109 | 110 | void read(); 111 | 112 | class PropertiesPrivate; 113 | PropertiesPrivate *d; 114 | }; 115 | } 116 | } 117 | 118 | #endif 119 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tstringlist.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "tstringlist.h" 27 | 28 | using namespace TagLib; 29 | 30 | class StringListPrivate 31 | { 32 | 33 | }; 34 | 35 | //////////////////////////////////////////////////////////////////////////////// 36 | // static members 37 | //////////////////////////////////////////////////////////////////////////////// 38 | 39 | StringList StringList::split(const String &s, const String &pattern) 40 | { 41 | StringList l; 42 | 43 | int previousOffset = 0; 44 | for(int offset = s.find(pattern); offset != -1; offset = s.find(pattern, offset + 1)) { 45 | l.append(s.substr(previousOffset, offset - previousOffset)); 46 | previousOffset = offset + 1; 47 | } 48 | 49 | l.append(s.substr(previousOffset, s.size() - previousOffset)); 50 | 51 | return l; 52 | } 53 | 54 | //////////////////////////////////////////////////////////////////////////////// 55 | // public members 56 | //////////////////////////////////////////////////////////////////////////////// 57 | 58 | StringList::StringList() : List() 59 | { 60 | 61 | } 62 | 63 | StringList::StringList(const StringList &l) : List(l) 64 | { 65 | 66 | } 67 | 68 | StringList::StringList(const String &s) : List() 69 | { 70 | append(s); 71 | } 72 | 73 | StringList::StringList(const ByteVectorList &bl, String::Type t) : List() 74 | { 75 | ByteVectorList::ConstIterator i = bl.begin(); 76 | for(;i != bl.end(); i++) { 77 | append(String(*i, t)); 78 | } 79 | } 80 | 81 | StringList::~StringList() 82 | { 83 | 84 | } 85 | 86 | String StringList::toString(const String &separator) const 87 | { 88 | String s; 89 | 90 | ConstIterator it = begin(); 91 | ConstIterator itEnd = end(); 92 | 93 | while(it != itEnd) { 94 | s += *it; 95 | it++; 96 | if(it != itEnd) 97 | s += separator; 98 | } 99 | 100 | return s; 101 | } 102 | 103 | StringList &StringList::append(const String &s) 104 | { 105 | List::append(s); 106 | return *this; 107 | } 108 | 109 | StringList &StringList::append(const StringList &l) 110 | { 111 | List::append(l); 112 | return *this; 113 | } 114 | 115 | //////////////////////////////////////////////////////////////////////////////// 116 | // related functions 117 | //////////////////////////////////////////////////////////////////////////////// 118 | 119 | std::ostream &operator<<(std::ostream &s, const StringList &l) 120 | { 121 | s << l.toString(); 122 | return s; 123 | } 124 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tstringlist.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_STRINGLIST_H 27 | #define TAGLIB_STRINGLIST_H 28 | 29 | #include "tstring.h" 30 | #include "tlist.h" 31 | #include "tbytevectorlist.h" 32 | #include "taglib_export.h" 33 | 34 | #include 35 | 36 | namespace TagLib { 37 | 38 | //! A list of strings 39 | 40 | /*! 41 | * This is a spcialization of the List class with some members convention for 42 | * string operations. 43 | */ 44 | 45 | class TAGLIB_EXPORT StringList : public List 46 | { 47 | public: 48 | 49 | /*! 50 | * Constructs an empty StringList. 51 | */ 52 | StringList(); 53 | 54 | /*! 55 | * Make a shallow, implicitly shared, copy of \a l. Because this is 56 | * implicitly shared, this method is lightweight and suitable for 57 | * pass-by-value usage. 58 | */ 59 | StringList(const StringList &l); 60 | 61 | /*! 62 | * Constructs a StringList with \a s as a member. 63 | */ 64 | StringList(const String &s); 65 | 66 | /*! 67 | * Makes a deep copy of the data in \a vl. 68 | * 69 | * \note This should only be used with the 8-bit codecs Latin1 and UTF8, when 70 | * used with other codecs it will simply print a warning and exit. 71 | */ 72 | StringList(const ByteVectorList &vl, String::Type t = String::Latin1); 73 | 74 | /*! 75 | * Destroys this StringList instance. 76 | */ 77 | virtual ~StringList(); 78 | 79 | /*! 80 | * Concatenate the list of strings into one string separated by \a separator. 81 | */ 82 | String toString(const String &separator = " ") const; 83 | 84 | /*! 85 | * Appends \a s to the end of the list and returns a reference to the 86 | * list. 87 | */ 88 | StringList &append(const String &s); 89 | 90 | /*! 91 | * Appends all of the values in \a l to the end of the list and returns a 92 | * reference to the list. 93 | */ 94 | StringList &append(const StringList &l); 95 | 96 | /*! 97 | * Splits the String \a s into several strings at \a pattern. This will not include 98 | * the pattern in the returned strings. 99 | */ 100 | static StringList split(const String &s, const String &pattern); 101 | 102 | private: 103 | class StringListPrivate; 104 | StringListPrivate *d; 105 | }; 106 | 107 | } 108 | 109 | /*! 110 | * \related TagLib::StringList 111 | * Send the StringList to an output stream. 112 | */ 113 | std::ostream &operator<<(std::ostream &s, const TagLib::StringList &l); 114 | 115 | #endif 116 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/privateframe.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2008 by Serkan Kalyoncu 3 | copyright : (C) 2008 by Scott Wheeler 4 | email : wheeler@kde.org 5 | ***************************************************************************/ 6 | 7 | /*************************************************************************** 8 | * This library is free software; you can redistribute it and/or modify * 9 | * it under the terms of the GNU Lesser General Public License version * 10 | * 2.1 as published by the Free Software Foundation. * 11 | * * 12 | * This library is distributed in the hope that it will be useful, but * 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 15 | * Lesser General Public License for more details. * 16 | * * 17 | * You should have received a copy of the GNU Lesser General Public * 18 | * License along with this library; if not, write to the Free Software * 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 20 | * 02110-1301 USA * 21 | * * 22 | * Alternatively, this file is available under the Mozilla Public * 23 | * License Version 1.1. You may obtain a copy of the License at * 24 | * http://www.mozilla.org/MPL/ * 25 | ***************************************************************************/ 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | #include "privateframe.h" 32 | 33 | using namespace TagLib; 34 | using namespace ID3v2; 35 | 36 | 37 | class PrivateFrame::PrivateFramePrivate 38 | { 39 | public: 40 | ByteVector data; 41 | String owner; 42 | }; 43 | 44 | //////////////////////////////////////////////////////////////////////////////// 45 | // public members 46 | //////////////////////////////////////////////////////////////////////////////// 47 | 48 | PrivateFrame::PrivateFrame() : Frame("PRIV") 49 | { 50 | d = new PrivateFramePrivate; 51 | } 52 | 53 | PrivateFrame::PrivateFrame(const ByteVector &data) : Frame(data) 54 | { 55 | d = new PrivateFramePrivate; 56 | setData(data); 57 | } 58 | 59 | PrivateFrame::~PrivateFrame() 60 | { 61 | delete d; 62 | } 63 | 64 | String PrivateFrame::toString() const 65 | { 66 | return d->owner; 67 | } 68 | 69 | String PrivateFrame::owner() const 70 | { 71 | return d->owner; 72 | } 73 | 74 | ByteVector PrivateFrame::data() const 75 | { 76 | return d->data; 77 | } 78 | 79 | void PrivateFrame::setOwner(const String &s) 80 | { 81 | d->owner = s; 82 | } 83 | 84 | void PrivateFrame::setData(const ByteVector & data) 85 | { 86 | d->data = data; 87 | } 88 | 89 | //////////////////////////////////////////////////////////////////////////////// 90 | // protected members 91 | //////////////////////////////////////////////////////////////////////////////// 92 | 93 | void PrivateFrame::parseFields(const ByteVector &data) 94 | { 95 | if(data.size() < 2) { 96 | debug("A private frame must contain at least 2 bytes."); 97 | return; 98 | } 99 | 100 | // Owner identifier is assumed to be Latin1 101 | 102 | const int byteAlign = 1; 103 | const int endOfOwner = data.find(textDelimiter(String::Latin1), 0, byteAlign); 104 | 105 | d->owner = String(data.mid(0, endOfOwner)); 106 | d->data = data.mid(endOfOwner + 1); 107 | } 108 | 109 | ByteVector PrivateFrame::renderFields() const 110 | { 111 | ByteVector v; 112 | 113 | v.append(d->owner.data(String::Latin1)); 114 | v.append(textDelimiter(String::Latin1)); 115 | v.append(d->data); 116 | 117 | return v; 118 | } 119 | 120 | //////////////////////////////////////////////////////////////////////////////// 121 | // private members 122 | //////////////////////////////////////////////////////////////////////////////// 123 | 124 | PrivateFrame::PrivateFrame(const ByteVector &data, Header *h) : Frame(h) 125 | { 126 | d = new PrivateFramePrivate(); 127 | parseFields(fieldData(data)); 128 | } 129 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/trefcounter.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2013 by Tsuda Kageyu 3 | email : tsuda.kageyu@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_REFCOUNTER_H 27 | #define TAGLIB_REFCOUNTER_H 28 | 29 | #include "taglib_export.h" 30 | #include "taglib.h" 31 | 32 | #ifdef __APPLE__ 33 | # include 34 | # define TAGLIB_ATOMIC_MAC 35 | #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) 36 | # define NOMINMAX 37 | # include 38 | # define TAGLIB_ATOMIC_WIN 39 | #elif defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 401) \ 40 | && (defined(__i386__) || defined(__i486__) || defined(__i586__) || \ 41 | defined(__i686__) || defined(__x86_64) || defined(__ia64)) \ 42 | && !defined(__INTEL_COMPILER) 43 | # define TAGLIB_ATOMIC_GCC 44 | #elif defined(__ia64) && defined(__INTEL_COMPILER) 45 | # include 46 | # define TAGLIB_ATOMIC_GCC 47 | #endif 48 | 49 | #ifndef DO_NOT_DOCUMENT // Tell Doxygen to skip this class. 50 | /*! 51 | * \internal 52 | * This is just used as a base class for shared classes in TagLib. 53 | * 54 | * \warning This is not part of the TagLib public API! 55 | */ 56 | namespace TagLib 57 | { 58 | 59 | class TAGLIB_EXPORT RefCounter 60 | { 61 | public: 62 | RefCounter(); 63 | virtual ~RefCounter(); 64 | 65 | void ref(); 66 | bool deref(); 67 | int count() const; 68 | 69 | private: 70 | class RefCounterPrivate; 71 | RefCounterPrivate *d; 72 | }; 73 | 74 | // BIC this old class is needed by tlist.tcc and tmap.tcc 75 | class RefCounterOld 76 | { 77 | public: 78 | RefCounterOld() : refCount(1) {} 79 | 80 | #ifdef TAGLIB_ATOMIC_MAC 81 | void ref() { OSAtomicIncrement32Barrier(const_cast(&refCount)); } 82 | bool deref() { return ! OSAtomicDecrement32Barrier(const_cast(&refCount)); } 83 | int32_t count() { return refCount; } 84 | private: 85 | volatile int32_t refCount; 86 | #elif defined(TAGLIB_ATOMIC_WIN) 87 | void ref() { InterlockedIncrement(&refCount); } 88 | bool deref() { return ! InterlockedDecrement(&refCount); } 89 | long count() { return refCount; } 90 | private: 91 | volatile long refCount; 92 | #elif defined(TAGLIB_ATOMIC_GCC) 93 | void ref() { __sync_add_and_fetch(&refCount, 1); } 94 | bool deref() { return ! __sync_sub_and_fetch(&refCount, 1); } 95 | int count() { return refCount; } 96 | private: 97 | volatile int refCount; 98 | #else 99 | void ref() { refCount++; } 100 | bool deref() { return ! --refCount; } 101 | int count() { return refCount; } 102 | private: 103 | uint refCount; 104 | #endif 105 | }; 106 | 107 | } 108 | 109 | #endif // DO_NOT_DOCUMENT 110 | #endif 111 | 112 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/popularimeterframe.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2008 by Lukas Lalinsky 3 | email : lalinsky@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_POPULARIMETERFRAME_H 27 | #define TAGLIB_POPULARIMETERFRAME_H 28 | 29 | #include "id3v2frame.h" 30 | #include "taglib_export.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace ID3v2 { 35 | 36 | //! An implementation of ID3v2 "popularimeter" 37 | 38 | /*! 39 | * This implements the ID3v2 popularimeter (POPM frame). It concists of 40 | * an email, a rating and an optional counter. 41 | */ 42 | 43 | class TAGLIB_EXPORT PopularimeterFrame : public Frame 44 | { 45 | friend class FrameFactory; 46 | 47 | public: 48 | /*! 49 | * Construct an empty popularimeter frame. 50 | */ 51 | explicit PopularimeterFrame(); 52 | 53 | /*! 54 | * Construct a popularimeter based on the data in \a data. 55 | */ 56 | explicit PopularimeterFrame(const ByteVector &data); 57 | 58 | /*! 59 | * Destroys this PopularimeterFrame instance. 60 | */ 61 | virtual ~PopularimeterFrame(); 62 | 63 | /*! 64 | * Returns the text of this popularimeter. 65 | * 66 | * \see text() 67 | */ 68 | virtual String toString() const; 69 | 70 | /*! 71 | * Returns the email. 72 | * 73 | * \see setEmail() 74 | */ 75 | String email() const; 76 | 77 | /*! 78 | * Set the email. 79 | * 80 | * \see email() 81 | */ 82 | void setEmail(const String &email); 83 | 84 | /*! 85 | * Returns the rating. 86 | * 87 | * \see setRating() 88 | */ 89 | int rating() const; 90 | 91 | /*! 92 | * Set the rating. 93 | * 94 | * \see rating() 95 | */ 96 | void setRating(int rating); 97 | 98 | /*! 99 | * Returns the counter. 100 | * 101 | * \see setCounter() 102 | */ 103 | uint counter() const; 104 | 105 | /*! 106 | * Set the counter. 107 | * 108 | * \see counter() 109 | */ 110 | void setCounter(uint counter); 111 | 112 | protected: 113 | // Reimplementations. 114 | 115 | virtual void parseFields(const ByteVector &data); 116 | virtual ByteVector renderFields() const; 117 | 118 | private: 119 | /*! 120 | * The constructor used by the FrameFactory. 121 | */ 122 | PopularimeterFrame(const ByteVector &data, Header *h); 123 | PopularimeterFrame(const PopularimeterFrame &); 124 | PopularimeterFrame &operator=(const PopularimeterFrame &); 125 | 126 | class PopularimeterFramePrivate; 127 | PopularimeterFramePrivate *d; 128 | }; 129 | 130 | } 131 | } 132 | #endif 133 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/audioproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_AUDIOPROPERTIES_H 27 | #define TAGLIB_AUDIOPROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | 31 | namespace TagLib { 32 | 33 | //! A simple, abstract interface to common audio properties 34 | 35 | /*! 36 | * The values here are common to most audio formats. For more specific, codec 37 | * dependant values, please see see the subclasses APIs. This is meant to 38 | * compliment the TagLib::File and TagLib::Tag APIs in providing a simple 39 | * interface that is sufficient for most applications. 40 | */ 41 | 42 | class TAGLIB_EXPORT AudioProperties 43 | { 44 | public: 45 | 46 | /*! 47 | * Reading audio properties from a file can sometimes be very time consuming 48 | * and for the most accurate results can often involve reading the entire 49 | * file. Because in many situations speed is critical or the accuracy of the 50 | * values is not particularly important this allows the level of desired 51 | * accuracy to be set. 52 | */ 53 | enum ReadStyle { 54 | //! Read as little of the file as possible 55 | Fast, 56 | //! Read more of the file and make better values guesses 57 | Average, 58 | //! Read as much of the file as needed to report accurate values 59 | Accurate 60 | }; 61 | 62 | /*! 63 | * Destroys this AudioProperties instance. 64 | */ 65 | virtual ~AudioProperties(); 66 | 67 | /*! 68 | * Returns the length of the file in seconds. 69 | */ 70 | virtual int length() const = 0; 71 | 72 | /*! 73 | * Returns the most appropriate bit rate for the file in kb/s. For constant 74 | * bitrate formats this is simply the bitrate of the file. For variable 75 | * bitrate formats this is either the average or nominal bitrate. 76 | */ 77 | virtual int bitrate() const = 0; 78 | 79 | /*! 80 | * Returns the sample rate in Hz. 81 | */ 82 | virtual int sampleRate() const = 0; 83 | 84 | /*! 85 | * Returns the number of audio channels. 86 | */ 87 | virtual int channels() const = 0; 88 | 89 | protected: 90 | 91 | /*! 92 | * Construct an audio properties instance. This is protected as this class 93 | * should not be instantiated directly, but should be instantiated via its 94 | * subclasses and can be fetched from the FileRef or File APIs. 95 | * 96 | * \see ReadStyle 97 | */ 98 | AudioProperties(ReadStyle style); 99 | 100 | private: 101 | AudioProperties(const AudioProperties &); 102 | AudioProperties &operator=(const AudioProperties &); 103 | 104 | class AudioPropertiesPrivate; 105 | AudioPropertiesPrivate *d; 106 | }; 107 | 108 | } 109 | 110 | #endif 111 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ogg/vorbis/vorbisproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_VORBISPROPERTIES_H 27 | #define TAGLIB_VORBISPROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | #include "audioproperties.h" 31 | 32 | namespace TagLib { 33 | 34 | /* 35 | * This is just to make this appear to be in the Ogg namespace in the 36 | * documentation. The typedef below will make this work with the current code. 37 | * In the next BIC version of TagLib this will be really moved into the Ogg 38 | * namespace. 39 | */ 40 | 41 | #ifdef DOXYGEN 42 | namespace Ogg { 43 | #endif 44 | 45 | namespace Vorbis { 46 | 47 | class File; 48 | 49 | //! An implementation of audio property reading for Ogg Vorbis 50 | 51 | /*! 52 | * This reads the data from an Ogg Vorbis stream found in the AudioProperties 53 | * API. 54 | */ 55 | 56 | class TAGLIB_EXPORT Properties : public AudioProperties 57 | { 58 | public: 59 | /*! 60 | * Create an instance of Vorbis::Properties with the data read from the 61 | * Vorbis::File \a file. 62 | */ 63 | Properties(File *file, ReadStyle style = Average); 64 | 65 | /*! 66 | * Destroys this VorbisProperties instance. 67 | */ 68 | virtual ~Properties(); 69 | 70 | // Reimplementations. 71 | 72 | virtual int length() const; 73 | virtual int bitrate() const; 74 | virtual int sampleRate() const; 75 | virtual int channels() const; 76 | 77 | /*! 78 | * Returns the Vorbis version, currently "0" (as specified by the spec). 79 | */ 80 | int vorbisVersion() const; 81 | 82 | /*! 83 | * Returns the maximum bitrate as read from the Vorbis identification 84 | * header. 85 | */ 86 | int bitrateMaximum() const; 87 | 88 | /*! 89 | * Returns the nominal bitrate as read from the Vorbis identification 90 | * header. 91 | */ 92 | int bitrateNominal() const; 93 | 94 | /*! 95 | * Returns the minimum bitrate as read from the Vorbis identification 96 | * header. 97 | */ 98 | int bitrateMinimum() const; 99 | 100 | private: 101 | Properties(const Properties &); 102 | Properties &operator=(const Properties &); 103 | 104 | void read(); 105 | 106 | class PropertiesPrivate; 107 | PropertiesPrivate *d; 108 | }; 109 | } 110 | 111 | /* 112 | * To keep compatibility with the current version put Vorbis in the Ogg namespace 113 | * only in the docs and provide a typedef to make it work. In the next BIC 114 | * version this will be removed and it will only exist in the Ogg namespace. 115 | */ 116 | 117 | #ifdef DOXYGEN 118 | } 119 | #else 120 | namespace Ogg { namespace Vorbis { typedef TagLib::AudioProperties AudioProperties; } } 121 | #endif 122 | 123 | } 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /foo_cad_plus.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 17 3 | VisualStudioVersion = 17.2.32630.192 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foo_cad_plus", "foo_cad_plus\foo_cad_plus.vcxproj", "{CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}" 6 | EndProject 7 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_component_client", "..\foobar2000_component_client\foobar2000_component_client.vcxproj", "{71AD2674-065B-48F5-B8B0-E1F9D3892081}" 8 | EndProject 9 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_SDK", "..\SDK\foobar2000_SDK.vcxproj", "{E8091321-D79D-4575-86EF-064EA1A4A20D}" 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pfc", "..\..\pfc\pfc.vcxproj", "{EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "foobar2000_sdk_helpers", "..\helpers\foobar2000_sdk_helpers.vcxproj", "{EE47764E-A202-4F85-A767-ABDAB4AFF35F}" 14 | EndProject 15 | Global 16 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 17 | Debug|Win32 = Debug|Win32 18 | Debug|x64 = Debug|x64 19 | Release|Win32 = Release|Win32 20 | Release|x64 = Release|x64 21 | EndGlobalSection 22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 23 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|Win32.ActiveCfg = Debug|Win32 24 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|Win32.Build.0 = Debug|Win32 25 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|x64.ActiveCfg = Debug|x64 26 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Debug|x64.Build.0 = Debug|x64 27 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|Win32.ActiveCfg = Release|Win32 28 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|Win32.Build.0 = Release|Win32 29 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|x64.ActiveCfg = Release|x64 30 | {CC272D9D-8B6A-43D0-AA2E-9F46B0D07C38}.Release|x64.Build.0 = Release|x64 31 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|Win32.Build.0 = Debug|Win32 33 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|x64.ActiveCfg = Debug|x64 34 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Debug|x64.Build.0 = Debug|x64 35 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|Win32.ActiveCfg = Release|Win32 36 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|Win32.Build.0 = Release|Win32 37 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|x64.ActiveCfg = Release|x64 38 | {71AD2674-065B-48F5-B8B0-E1F9D3892081}.Release|x64.Build.0 = Release|x64 39 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|Win32.ActiveCfg = Debug|Win32 40 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|Win32.Build.0 = Debug|Win32 41 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|x64.ActiveCfg = Debug|x64 42 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Debug|x64.Build.0 = Debug|x64 43 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|Win32.ActiveCfg = Release|Win32 44 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|Win32.Build.0 = Release|Win32 45 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|x64.ActiveCfg = Release|x64 46 | {E8091321-D79D-4575-86EF-064EA1A4A20D}.Release|x64.Build.0 = Release|x64 47 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|Win32.ActiveCfg = Debug|Win32 48 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|Win32.Build.0 = Debug|Win32 49 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|x64.ActiveCfg = Debug|x64 50 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Debug|x64.Build.0 = Debug|x64 51 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|Win32.ActiveCfg = Release|Win32 52 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|Win32.Build.0 = Release|Win32 53 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|x64.ActiveCfg = Release|x64 54 | {EBFFFB4E-261D-44D3-B89C-957B31A0BF9C}.Release|x64.Build.0 = Release|x64 55 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|Win32.ActiveCfg = Debug|Win32 56 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|Win32.Build.0 = Debug|Win32 57 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|x64.ActiveCfg = Debug|x64 58 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Debug|x64.Build.0 = Debug|x64 59 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|Win32.ActiveCfg = Release|Win32 60 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|Win32.Build.0 = Release|Win32 61 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|x64.ActiveCfg = Release|x64 62 | {EE47764E-A202-4F85-A767-ABDAB4AFF35F}.Release|x64.Build.0 = Release|x64 63 | EndGlobalSection 64 | GlobalSection(SolutionProperties) = preSolution 65 | HideSolutionNode = FALSE 66 | EndGlobalSection 67 | GlobalSection(ExtensibilityGlobals) = postSolution 68 | SolutionGuid = {3637B1A8-40D9-4653-AB1B-B03EE7722C59} 69 | EndGlobalSection 70 | EndGlobal 71 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ogg/speex/speexfile.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2006 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | 5 | copyright : (C) 2002 - 2008 by Scott Wheeler 6 | email : wheeler@kde.org 7 | (original Vorbis implementation) 8 | ***************************************************************************/ 9 | 10 | /*************************************************************************** 11 | * This library is free software; you can redistribute it and/or modify * 12 | * it under the terms of the GNU Lesser General Public License version * 13 | * 2.1 as published by the Free Software Foundation. * 14 | * * 15 | * This library is distributed in the hope that it will be useful, but * 16 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 18 | * Lesser General Public License for more details. * 19 | * * 20 | * You should have received a copy of the GNU Lesser General Public * 21 | * License along with this library; if not, write to the Free Software * 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 23 | * 02110-1301 USA * 24 | * * 25 | * Alternatively, this file is available under the Mozilla Public * 26 | * License Version 1.1. You may obtain a copy of the License at * 27 | * http://www.mozilla.org/MPL/ * 28 | ***************************************************************************/ 29 | 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | #include "speexfile.h" 37 | 38 | using namespace TagLib; 39 | using namespace TagLib::Ogg; 40 | 41 | class Speex::File::FilePrivate 42 | { 43 | public: 44 | FilePrivate() : 45 | comment(0), 46 | properties(0) {} 47 | 48 | ~FilePrivate() 49 | { 50 | delete comment; 51 | delete properties; 52 | } 53 | 54 | Ogg::XiphComment *comment; 55 | Properties *properties; 56 | }; 57 | 58 | //////////////////////////////////////////////////////////////////////////////// 59 | // public members 60 | //////////////////////////////////////////////////////////////////////////////// 61 | 62 | Speex::File::File(FileName file, bool readProperties, 63 | Properties::ReadStyle propertiesStyle) : Ogg::File(file) 64 | { 65 | d = new FilePrivate; 66 | if(isOpen()) 67 | read(readProperties, propertiesStyle); 68 | } 69 | 70 | Speex::File::File(IOStream *stream, bool readProperties, 71 | Properties::ReadStyle propertiesStyle) : Ogg::File(stream) 72 | { 73 | d = new FilePrivate; 74 | if(isOpen()) 75 | read(readProperties, propertiesStyle); 76 | } 77 | 78 | Speex::File::~File() 79 | { 80 | delete d; 81 | } 82 | 83 | Ogg::XiphComment *Speex::File::tag() const 84 | { 85 | return d->comment; 86 | } 87 | 88 | PropertyMap Speex::File::properties() const 89 | { 90 | return d->comment->properties(); 91 | } 92 | 93 | PropertyMap Speex::File::setProperties(const PropertyMap &properties) 94 | { 95 | return d->comment->setProperties(properties); 96 | } 97 | 98 | Speex::Properties *Speex::File::audioProperties() const 99 | { 100 | return d->properties; 101 | } 102 | 103 | bool Speex::File::save() 104 | { 105 | if(!d->comment) 106 | d->comment = new Ogg::XiphComment; 107 | 108 | setPacket(1, d->comment->render()); 109 | 110 | return Ogg::File::save(); 111 | } 112 | 113 | //////////////////////////////////////////////////////////////////////////////// 114 | // private members 115 | //////////////////////////////////////////////////////////////////////////////// 116 | 117 | void Speex::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) 118 | { 119 | ByteVector speexHeaderData = packet(0); 120 | 121 | if(!speexHeaderData.startsWith("Speex ")) { 122 | debug("Speex::File::read() -- invalid Speex identification header"); 123 | return; 124 | } 125 | 126 | ByteVector commentHeaderData = packet(1); 127 | 128 | d->comment = new Ogg::XiphComment(commentHeaderData); 129 | 130 | if(readProperties) 131 | d->properties = new Properties(this, propertiesStyle); 132 | } 133 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpc/mpcproperties.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2004 by Allan Sandfeld Jensen 3 | email : kde@carewolf.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MPCPROPERTIES_H 27 | #define TAGLIB_MPCPROPERTIES_H 28 | 29 | #include "taglib_export.h" 30 | #include "audioproperties.h" 31 | 32 | namespace TagLib { 33 | 34 | namespace MPC { 35 | 36 | class File; 37 | 38 | static const uint HeaderSize = 8*7; 39 | 40 | //! An implementation of audio property reading for MPC 41 | 42 | /*! 43 | * This reads the data from an MPC stream found in the AudioProperties 44 | * API. 45 | */ 46 | 47 | class TAGLIB_EXPORT Properties : public AudioProperties 48 | { 49 | public: 50 | /*! 51 | * Create an instance of MPC::Properties with the data read from the 52 | * ByteVector \a data. 53 | * 54 | * This constructor is deprecated. It only works for MPC version up to 7. 55 | */ 56 | Properties(const ByteVector &data, long streamLength, ReadStyle style = Average); 57 | 58 | /*! 59 | * Create an instance of MPC::Properties with the data read directly 60 | * from a MPC::File. 61 | */ 62 | Properties(File *file, long streamLength, ReadStyle style = Average); 63 | 64 | /*! 65 | * Destroys this MPC::Properties instance. 66 | */ 67 | virtual ~Properties(); 68 | 69 | // Reimplementations. 70 | 71 | virtual int length() const; 72 | virtual int bitrate() const; 73 | virtual int sampleRate() const; 74 | virtual int channels() const; 75 | 76 | /*! 77 | * Returns the version of the bitstream (SV4-SV8) 78 | */ 79 | int mpcVersion() const; 80 | uint totalFrames() const; 81 | uint sampleFrames() const; 82 | 83 | /*! 84 | * Returns the track gain as an integer value, 85 | * to convert to dB: trackGain in dB = 64.82 - (trackGain / 256) 86 | */ 87 | int trackGain() const; 88 | 89 | /*! 90 | * Returns the track peak as an integer value, 91 | * to convert to dB: trackPeak in dB = trackPeak / 256 92 | * to convert to floating [-1..1]: trackPeak = 10^(trackPeak / 256 / 20)/32768 93 | */ 94 | int trackPeak() const; 95 | 96 | /*! 97 | * Returns the album gain as an integer value, 98 | * to convert to dB: albumGain in dB = 64.82 - (albumGain / 256) 99 | */ 100 | int albumGain() const; 101 | 102 | /*! 103 | * Returns the album peak as an integer value, 104 | * to convert to dB: albumPeak in dB = albumPeak / 256 105 | * to convert to floating [-1..1]: albumPeak = 10^(albumPeak / 256 / 20)/32768 106 | */ 107 | int albumPeak() const; 108 | 109 | private: 110 | Properties(const Properties &); 111 | Properties &operator=(const Properties &); 112 | 113 | void readSV7(const ByteVector &data); 114 | void readSV8(File *file); 115 | 116 | class PropertiesPrivate; 117 | PropertiesPrivate *d; 118 | }; 119 | } 120 | } 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/popularimeterframe.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2008 by Lukas Lalinsky 3 | email : lalinsky@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | 28 | #include "popularimeterframe.h" 29 | 30 | using namespace TagLib; 31 | using namespace ID3v2; 32 | 33 | class PopularimeterFrame::PopularimeterFramePrivate 34 | { 35 | public: 36 | PopularimeterFramePrivate() : rating(0), counter(0) {} 37 | String email; 38 | int rating; 39 | TagLib::uint counter; 40 | }; 41 | 42 | //////////////////////////////////////////////////////////////////////////////// 43 | // public members 44 | //////////////////////////////////////////////////////////////////////////////// 45 | 46 | PopularimeterFrame::PopularimeterFrame() : Frame("POPM") 47 | { 48 | d = new PopularimeterFramePrivate; 49 | } 50 | 51 | PopularimeterFrame::PopularimeterFrame(const ByteVector &data) : Frame(data) 52 | { 53 | d = new PopularimeterFramePrivate; 54 | setData(data); 55 | } 56 | 57 | PopularimeterFrame::~PopularimeterFrame() 58 | { 59 | delete d; 60 | } 61 | 62 | String PopularimeterFrame::toString() const 63 | { 64 | return d->email + " rating=" + String::number(d->rating) + " counter=" + String::number(d->counter); 65 | } 66 | 67 | String PopularimeterFrame::email() const 68 | { 69 | return d->email; 70 | } 71 | 72 | void PopularimeterFrame::setEmail(const String &s) 73 | { 74 | d->email = s; 75 | } 76 | 77 | int PopularimeterFrame::rating() const 78 | { 79 | return d->rating; 80 | } 81 | 82 | void PopularimeterFrame::setRating(int s) 83 | { 84 | d->rating = s; 85 | } 86 | 87 | TagLib::uint PopularimeterFrame::counter() const 88 | { 89 | return d->counter; 90 | } 91 | 92 | void PopularimeterFrame::setCounter(TagLib::uint s) 93 | { 94 | d->counter = s; 95 | } 96 | 97 | //////////////////////////////////////////////////////////////////////////////// 98 | // protected members 99 | //////////////////////////////////////////////////////////////////////////////// 100 | 101 | void PopularimeterFrame::parseFields(const ByteVector &data) 102 | { 103 | int pos = 0, size = int(data.size()); 104 | 105 | d->email = readStringField(data, String::Latin1, &pos); 106 | 107 | d->rating = 0; 108 | d->counter = 0; 109 | if(pos < size) { 110 | d->rating = (unsigned char)(data[pos++]); 111 | if(pos < size) { 112 | d->counter = data.toUInt(static_cast(pos)); 113 | } 114 | } 115 | } 116 | 117 | ByteVector PopularimeterFrame::renderFields() const 118 | { 119 | ByteVector data; 120 | 121 | data.append(d->email.data(String::Latin1)); 122 | data.append(textDelimiter(String::Latin1)); 123 | data.append(char(d->rating)); 124 | data.append(ByteVector::fromUInt(d->counter)); 125 | 126 | return data; 127 | } 128 | 129 | //////////////////////////////////////////////////////////////////////////////// 130 | // private members 131 | //////////////////////////////////////////////////////////////////////////////// 132 | 133 | PopularimeterFrame::PopularimeterFrame(const ByteVector &data, Header *h) : Frame(h) 134 | { 135 | d = new PopularimeterFramePrivate; 136 | parseFields(fieldData(data)); 137 | } 138 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ogg/vorbis/vorbisfile.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include "vorbisfile.h" 33 | 34 | 35 | using namespace TagLib; 36 | 37 | class Vorbis::File::FilePrivate 38 | { 39 | public: 40 | FilePrivate() : 41 | comment(0), 42 | properties(0) {} 43 | 44 | ~FilePrivate() 45 | { 46 | delete comment; 47 | delete properties; 48 | } 49 | 50 | Ogg::XiphComment *comment; 51 | Properties *properties; 52 | }; 53 | 54 | namespace TagLib { 55 | /*! 56 | * Vorbis headers can be found with one type ID byte and the string "vorbis" in 57 | * an Ogg stream. 0x03 indicates the comment header. 58 | */ 59 | static const char vorbisCommentHeaderID[] = { 0x03, 'v', 'o', 'r', 'b', 'i', 's', 0 }; 60 | } 61 | 62 | //////////////////////////////////////////////////////////////////////////////// 63 | // public members 64 | //////////////////////////////////////////////////////////////////////////////// 65 | 66 | Vorbis::File::File(FileName file, bool readProperties, 67 | Properties::ReadStyle propertiesStyle) : Ogg::File(file) 68 | { 69 | d = new FilePrivate; 70 | if(isOpen()) 71 | read(readProperties, propertiesStyle); 72 | } 73 | 74 | Vorbis::File::File(IOStream *stream, bool readProperties, 75 | Properties::ReadStyle propertiesStyle) : Ogg::File(stream) 76 | { 77 | d = new FilePrivate; 78 | if(isOpen()) 79 | read(readProperties, propertiesStyle); 80 | } 81 | 82 | Vorbis::File::~File() 83 | { 84 | delete d; 85 | } 86 | 87 | Ogg::XiphComment *Vorbis::File::tag() const 88 | { 89 | return d->comment; 90 | } 91 | 92 | PropertyMap Vorbis::File::properties() const 93 | { 94 | return d->comment->properties(); 95 | } 96 | 97 | PropertyMap Vorbis::File::setProperties(const PropertyMap &properties) 98 | { 99 | return d->comment->setProperties(properties); 100 | } 101 | 102 | Vorbis::Properties *Vorbis::File::audioProperties() const 103 | { 104 | return d->properties; 105 | } 106 | 107 | bool Vorbis::File::save() 108 | { 109 | ByteVector v(vorbisCommentHeaderID); 110 | 111 | if(!d->comment) 112 | d->comment = new Ogg::XiphComment; 113 | v.append(d->comment->render()); 114 | 115 | setPacket(1, v); 116 | 117 | return Ogg::File::save(); 118 | } 119 | 120 | //////////////////////////////////////////////////////////////////////////////// 121 | // private members 122 | //////////////////////////////////////////////////////////////////////////////// 123 | 124 | void Vorbis::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) 125 | { 126 | ByteVector commentHeaderData = packet(1); 127 | 128 | if(commentHeaderData.mid(0, 7) != vorbisCommentHeaderID) { 129 | debug("Vorbis::File::read() - Could not find the Vorbis comment header."); 130 | setValid(false); 131 | return; 132 | } 133 | 134 | d->comment = new Ogg::XiphComment(commentHeaderData.mid(7)); 135 | 136 | if(readProperties) 137 | d->properties = new Properties(this, propertiesStyle); 138 | } 139 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/ogg/oggfile.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "taglib_export.h" 27 | #include "tfile.h" 28 | #include "tbytevectorlist.h" 29 | 30 | #ifndef TAGLIB_OGGFILE_H 31 | #define TAGLIB_OGGFILE_H 32 | 33 | namespace TagLib { 34 | 35 | //! A namespace for the classes used by Ogg-based metadata files 36 | 37 | namespace Ogg { 38 | 39 | class PageHeader; 40 | 41 | //! An implementation of TagLib::File with some helpers for Ogg based formats 42 | 43 | /*! 44 | * This is an implementation of Ogg file page and packet rendering and is of 45 | * use to Ogg based formats. While the API is small this handles the 46 | * non-trivial details of breaking up an Ogg stream into packets and makes 47 | * these available (via subclassing) to the codec meta data implementations. 48 | */ 49 | 50 | class TAGLIB_EXPORT File : public TagLib::File 51 | { 52 | public: 53 | virtual ~File(); 54 | 55 | /*! 56 | * Returns the packet contents for the i-th packet (starting from zero) 57 | * in the Ogg bitstream. 58 | * 59 | * \warning The requires reading at least the packet header for every page 60 | * up to the requested page. 61 | */ 62 | ByteVector packet(uint i); 63 | 64 | /*! 65 | * Sets the packet with index \a i to the value \a p. 66 | */ 67 | void setPacket(uint i, const ByteVector &p); 68 | 69 | /*! 70 | * Returns a pointer to the PageHeader for the first page in the stream or 71 | * null if the page could not be found. 72 | */ 73 | const PageHeader *firstPageHeader(); 74 | 75 | /*! 76 | * Returns a pointer to the PageHeader for the last page in the stream or 77 | * null if the page could not be found. 78 | */ 79 | const PageHeader *lastPageHeader(); 80 | 81 | virtual bool save(); 82 | 83 | protected: 84 | /*! 85 | * Constructs an Ogg file from \a file. 86 | * 87 | * \note This constructor is protected since Ogg::File shouldn't be 88 | * instantiated directly but rather should be used through the codec 89 | * specific subclasses. 90 | */ 91 | File(FileName file); 92 | 93 | /*! 94 | * Constructs an Ogg file from \a stream. 95 | * 96 | * \note This constructor is protected since Ogg::File shouldn't be 97 | * instantiated directly but rather should be used through the codec 98 | * specific subclasses. 99 | * 100 | * \note TagLib will *not* take ownership of the stream, the caller is 101 | * responsible for deleting it after the File object. 102 | */ 103 | File(IOStream *stream); 104 | 105 | private: 106 | File(const File &); 107 | File &operator=(const File &); 108 | 109 | /*! 110 | * Reads the next page and updates the internal "current page" pointer. 111 | */ 112 | bool nextPage(); 113 | void writePageGroup(const List &group); 114 | 115 | class FilePrivate; 116 | FilePrivate *d; 117 | }; 118 | 119 | } 120 | } 121 | 122 | #endif 123 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_UNIQUEFILEIDENTIFIERFRAME 27 | #define TAGLIB_UNIQUEFILEIDENTIFIERFRAME 28 | 29 | #include "id3v2frame.h" 30 | 31 | namespace TagLib { 32 | 33 | namespace ID3v2 { 34 | 35 | /*! 36 | * This is an implementation of ID3v2 unique file identifier frames. This 37 | * frame is used to identify the file in an arbitrary database identified 38 | * by the owner field. 39 | */ 40 | 41 | //! An implementation of ID3v2 unique identifier frames 42 | 43 | class TAGLIB_EXPORT UniqueFileIdentifierFrame : public ID3v2::Frame 44 | { 45 | friend class FrameFactory; 46 | 47 | public: 48 | /*! 49 | * Creates a uniqe file identifier frame based on \a data. 50 | */ 51 | UniqueFileIdentifierFrame(const ByteVector &data); 52 | 53 | /*! 54 | * Creates a unique file identifier frame with the owner \a owner and 55 | * the identification \a id. 56 | */ 57 | UniqueFileIdentifierFrame(const String &owner, const ByteVector &id); 58 | 59 | /*! 60 | * Destroys the frame. 61 | */ 62 | ~UniqueFileIdentifierFrame(); 63 | 64 | /*! 65 | * Returns the owner for the frame; essentially this is the key for 66 | * determining which identification scheme this key belongs to. This 67 | * will usually either be an email address or URL for the person or tool 68 | * used to create the unique identifier. 69 | * 70 | * \see setOwner() 71 | */ 72 | String owner() const; 73 | 74 | /*! 75 | * Returns the unique identifier. Though sometimes this is a text string 76 | * it also may be binary data and as much should be assumed when handling 77 | * it. 78 | */ 79 | ByteVector identifier() const; 80 | 81 | /*! 82 | * Sets the owner of the identification scheme to \a s. 83 | * 84 | * \see owner() 85 | */ 86 | void setOwner(const String &s); 87 | 88 | /*! 89 | * Sets the unique file identifier to \a v. 90 | * 91 | * \see identifier() 92 | */ 93 | void setIdentifier(const ByteVector &v); 94 | 95 | virtual String toString() const; 96 | 97 | PropertyMap asProperties() const; 98 | 99 | /*! 100 | * UFID frames each have a unique owner. This searches for a UFID 101 | * frame with the owner \a o and returns a pointer to it. 102 | * 103 | * \see owner() 104 | */ 105 | static UniqueFileIdentifierFrame *findByOwner(const Tag *tag, const String &o); 106 | 107 | protected: 108 | virtual void parseFields(const ByteVector &data); 109 | virtual ByteVector renderFields() const; 110 | 111 | private: 112 | UniqueFileIdentifierFrame(const UniqueFileIdentifierFrame &); 113 | UniqueFileIdentifierFrame &operator=(const UniqueFileIdentifierFrame &); 114 | 115 | UniqueFileIdentifierFrame(const ByteVector &data, Header *h); 116 | 117 | class UniqueFileIdentifierFramePrivate; 118 | UniqueFileIdentifierFramePrivate *d; 119 | }; 120 | } 121 | } 122 | 123 | #endif 124 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4file.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include 29 | #include "mp4atom.h" 30 | #include "mp4tag.h" 31 | #include "mp4file.h" 32 | 33 | using namespace TagLib; 34 | 35 | class MP4::File::FilePrivate 36 | { 37 | public: 38 | FilePrivate() : tag(0), atoms(0), properties(0) 39 | { 40 | } 41 | 42 | ~FilePrivate() 43 | { 44 | if(atoms) { 45 | delete atoms; 46 | atoms = 0; 47 | } 48 | if(tag) { 49 | delete tag; 50 | tag = 0; 51 | } 52 | if(properties) { 53 | delete properties; 54 | properties = 0; 55 | } 56 | } 57 | 58 | MP4::Tag *tag; 59 | MP4::Atoms *atoms; 60 | MP4::Properties *properties; 61 | }; 62 | 63 | MP4::File::File(FileName file, bool readProperties, AudioProperties::ReadStyle audioPropertiesStyle) 64 | : TagLib::File(file) 65 | { 66 | d = new FilePrivate; 67 | if(isOpen()) 68 | read(readProperties, audioPropertiesStyle); 69 | } 70 | 71 | MP4::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle audioPropertiesStyle) 72 | : TagLib::File(stream) 73 | { 74 | d = new FilePrivate; 75 | if(isOpen()) 76 | read(readProperties, audioPropertiesStyle); 77 | } 78 | 79 | MP4::File::~File() 80 | { 81 | delete d; 82 | } 83 | 84 | MP4::Tag * 85 | MP4::File::tag() const 86 | { 87 | return d->tag; 88 | } 89 | 90 | PropertyMap MP4::File::properties() const 91 | { 92 | return d->tag->properties(); 93 | } 94 | 95 | void MP4::File::removeUnsupportedProperties(const StringList &properties) 96 | { 97 | d->tag->removeUnsupportedProperties(properties); 98 | } 99 | 100 | PropertyMap MP4::File::setProperties(const PropertyMap &properties) 101 | { 102 | return d->tag->setProperties(properties); 103 | } 104 | 105 | MP4::Properties * 106 | MP4::File::audioProperties() const 107 | { 108 | return d->properties; 109 | } 110 | 111 | bool 112 | MP4::File::checkValid(const MP4::AtomList &list) 113 | { 114 | for(uint i = 0; i < list.size(); i++) { 115 | if(list[i]->length == 0) 116 | return false; 117 | if(!checkValid(list[i]->children)) 118 | return false; 119 | } 120 | return true; 121 | } 122 | 123 | void 124 | MP4::File::read(bool readProperties, Properties::ReadStyle audioPropertiesStyle) 125 | { 126 | if(!isValid()) 127 | return; 128 | 129 | d->atoms = new Atoms(this); 130 | if (!checkValid(d->atoms->atoms)) { 131 | setValid(false); 132 | return; 133 | } 134 | 135 | // must have a moov atom, otherwise consider it invalid 136 | MP4::Atom *moov = d->atoms->find("moov"); 137 | if(!moov) { 138 | setValid(false); 139 | return; 140 | } 141 | 142 | d->tag = new Tag(this, d->atoms); 143 | if(readProperties) { 144 | d->properties = new Properties(this, d->atoms, audioPropertiesStyle); 145 | } 146 | } 147 | 148 | bool 149 | MP4::File::save() 150 | { 151 | if(readOnly()) { 152 | debug("MP4::File::save() -- File is read only."); 153 | return false; 154 | } 155 | 156 | if(!isValid()) { 157 | debug("MP4::File::save() -- Trying to save invalid file."); 158 | return false; 159 | } 160 | 161 | return d->tag->save(); 162 | } 163 | 164 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/toolkit/tiostream.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2011 by Lukas Lalinsky 3 | email : lalinsky@gmail.com 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include "tiostream.h" 27 | 28 | using namespace TagLib; 29 | 30 | #ifdef _WIN32 31 | 32 | # include "tstring.h" 33 | # include "tdebug.h" 34 | # include 35 | 36 | namespace 37 | { 38 | // Check if the running system has CreateFileW() function. 39 | // Windows9x systems don't have CreateFileW() or can't accept Unicode file names. 40 | 41 | bool supportsUnicode() 42 | { 43 | const FARPROC p = GetProcAddress(GetModuleHandleA("kernel32"), "CreateFileW"); 44 | return (p != NULL); 45 | } 46 | 47 | // Indicates whether the system supports Unicode file names. 48 | 49 | const bool SystemSupportsUnicode = supportsUnicode(); 50 | 51 | // Converts a UTF-16 string into a local encoding. 52 | // This function should only be used in Windows9x systems which don't support 53 | // Unicode file names. 54 | 55 | std::string unicodeToAnsi(const wchar_t *wstr) 56 | { 57 | if(SystemSupportsUnicode) { 58 | debug("unicodeToAnsi() - Should not be used on WinNT systems."); 59 | } 60 | 61 | const int len = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL); 62 | if(len == 0) 63 | return std::string(); 64 | 65 | std::string str(len, '\0'); 66 | WideCharToMultiByte(CP_ACP, 0, wstr, -1, &str[0], len, NULL, NULL); 67 | 68 | return str; 69 | } 70 | } 71 | 72 | // If WinNT, stores a Unicode string into m_wname directly. 73 | // If Win9x, converts and stores it into m_name to avoid calling Unicode version functions. 74 | 75 | FileName::FileName(const wchar_t *name) 76 | : m_name (SystemSupportsUnicode ? "" : unicodeToAnsi(name)) 77 | , m_wname(SystemSupportsUnicode ? name : L"") 78 | { 79 | } 80 | 81 | FileName::FileName(const char *name) 82 | : m_name(name) 83 | { 84 | } 85 | 86 | FileName::FileName(const FileName &name) 87 | : m_name (name.m_name) 88 | , m_wname(name.m_wname) 89 | { 90 | } 91 | 92 | FileName::operator const wchar_t *() const 93 | { 94 | return m_wname.c_str(); 95 | } 96 | 97 | FileName::operator const char *() const 98 | { 99 | return m_name.c_str(); 100 | } 101 | 102 | const std::wstring &FileName::wstr() const 103 | { 104 | return m_wname; 105 | } 106 | 107 | const std::string &FileName::str() const 108 | { 109 | return m_name; 110 | } 111 | 112 | String FileName::toString() const 113 | { 114 | if(!m_wname.empty()) { 115 | return String(m_wname); 116 | } 117 | else if(!m_name.empty()) { 118 | const int len = MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, NULL, 0); 119 | if(len == 0) 120 | return String::null; 121 | 122 | std::vector buf(len); 123 | MultiByteToWideChar(CP_ACP, 0, m_name.c_str(), -1, &buf[0], len); 124 | 125 | return String(&buf[0]); 126 | } 127 | else { 128 | return String::null; 129 | } 130 | } 131 | 132 | 133 | #endif // _WIN32 134 | 135 | //////////////////////////////////////////////////////////////////////////////// 136 | // public members 137 | //////////////////////////////////////////////////////////////////////////////// 138 | 139 | IOStream::IOStream() 140 | { 141 | } 142 | 143 | IOStream::~IOStream() 144 | { 145 | } 146 | 147 | void IOStream::clear() 148 | { 149 | } 150 | 151 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4atom.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007,2011 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | // This file is not part of the public API! 27 | 28 | #ifndef DO_NOT_DOCUMENT 29 | 30 | #ifndef TAGLIB_MP4ATOM_H 31 | #define TAGLIB_MP4ATOM_H 32 | 33 | #include "tfile.h" 34 | #include "tlist.h" 35 | 36 | namespace TagLib { 37 | 38 | namespace MP4 { 39 | 40 | class Atom; 41 | typedef TagLib::List AtomList; 42 | 43 | enum AtomDataType 44 | { 45 | TypeImplicit = 0, // for use with tags for which no type needs to be indicated because only one type is allowed 46 | TypeUTF8 = 1, // without any count or null terminator 47 | TypeUTF16 = 2, // also known as UTF-16BE 48 | TypeSJIS = 3, // deprecated unless it is needed for special Japanese characters 49 | TypeHTML = 6, // the HTML file header specifies which HTML version 50 | TypeXML = 7, // the XML header must identify the DTD or schemas 51 | TypeUUID = 8, // also known as GUID; stored as 16 bytes in binary (valid as an ID) 52 | TypeISRC = 9, // stored as UTF-8 text (valid as an ID) 53 | TypeMI3P = 10, // stored as UTF-8 text (valid as an ID) 54 | TypeGIF = 12, // (deprecated) a GIF image 55 | TypeJPEG = 13, // a JPEG image 56 | TypePNG = 14, // a PNG image 57 | TypeURL = 15, // absolute, in UTF-8 characters 58 | TypeDuration = 16, // in milliseconds, 32-bit integer 59 | TypeDateTime = 17, // in UTC, counting seconds since midnight, January 1, 1904; 32 or 64-bits 60 | TypeGenred = 18, // a list of enumerated values 61 | TypeInteger = 21, // a signed big-endian integer with length one of { 1,2,3,4,8 } bytes 62 | TypeRIAAPA = 24, // RIAA parental advisory; { -1=no, 1=yes, 0=unspecified }, 8-bit ingteger 63 | TypeUPC = 25, // Universal Product Code, in text UTF-8 format (valid as an ID) 64 | TypeBMP = 27, // Windows bitmap image 65 | TypeUndefined = 255 // undefined 66 | }; 67 | 68 | struct AtomData { 69 | AtomData(AtomDataType type, ByteVector data) : type(type), locale(0), data(data) {} 70 | AtomDataType type; 71 | int locale; 72 | ByteVector data; 73 | }; 74 | 75 | typedef TagLib::List AtomDataList; 76 | 77 | class Atom 78 | { 79 | public: 80 | Atom(File *file); 81 | ~Atom(); 82 | Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 83 | bool path(AtomList &path, const char *name1, const char *name2 = 0, const char *name3 = 0); 84 | AtomList findall(const char *name, bool recursive = false); 85 | long offset; 86 | long length; 87 | TagLib::ByteVector name; 88 | AtomList children; 89 | private: 90 | static const int numContainers = 11; 91 | static const char *containers[11]; 92 | }; 93 | 94 | //! Root-level atoms 95 | class Atoms 96 | { 97 | public: 98 | Atoms(File *file); 99 | ~Atoms(); 100 | Atom *find(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 101 | AtomList path(const char *name1, const char *name2 = 0, const char *name3 = 0, const char *name4 = 0); 102 | AtomList atoms; 103 | }; 104 | 105 | } 106 | 107 | } 108 | 109 | #endif 110 | 111 | #endif 112 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp: -------------------------------------------------------------------------------- 1 | /*************************************************************************** 2 | copyright : (C) 2002 - 2008 by Scott Wheeler 3 | email : wheeler@kde.org 4 | ***************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | #include "id3v2tag.h" 31 | #include "uniquefileidentifierframe.h" 32 | 33 | using namespace TagLib; 34 | using namespace ID3v2; 35 | 36 | class UniqueFileIdentifierFrame::UniqueFileIdentifierFramePrivate 37 | { 38 | public: 39 | String owner; 40 | ByteVector identifier; 41 | }; 42 | 43 | //////////////////////////////////////////////////////////////////////////////// 44 | // public methods 45 | //////////////////////////////////////////////////////////////////////////////// 46 | 47 | UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) : 48 | ID3v2::Frame(data) 49 | { 50 | d = new UniqueFileIdentifierFramePrivate; 51 | setData(data); 52 | } 53 | 54 | UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const String &owner, const ByteVector &id) : 55 | ID3v2::Frame("UFID") 56 | { 57 | d = new UniqueFileIdentifierFramePrivate; 58 | d->owner = owner; 59 | d->identifier = id; 60 | } 61 | 62 | UniqueFileIdentifierFrame::~UniqueFileIdentifierFrame() 63 | { 64 | delete d; 65 | } 66 | 67 | String UniqueFileIdentifierFrame::owner() const 68 | { 69 | return d->owner; 70 | } 71 | 72 | ByteVector UniqueFileIdentifierFrame::identifier() const 73 | { 74 | return d->identifier; 75 | } 76 | 77 | void UniqueFileIdentifierFrame::setOwner(const String &s) 78 | { 79 | d->owner = s; 80 | } 81 | 82 | void UniqueFileIdentifierFrame::setIdentifier(const ByteVector &v) 83 | { 84 | d->identifier = v; 85 | } 86 | 87 | String UniqueFileIdentifierFrame::toString() const 88 | { 89 | return String::null; 90 | } 91 | 92 | PropertyMap UniqueFileIdentifierFrame::asProperties() const 93 | { 94 | PropertyMap map; 95 | if(d->owner == "http://musicbrainz.org") { 96 | map.insert("MUSICBRAINZ_TRACKID", String(d->identifier)); 97 | } 98 | else { 99 | map.unsupportedData().append(frameID() + String("/") + d->owner); 100 | } 101 | return map; 102 | } 103 | 104 | UniqueFileIdentifierFrame *UniqueFileIdentifierFrame::findByOwner(const ID3v2::Tag *tag, const String &o) // static 105 | { 106 | ID3v2::FrameList comments = tag->frameList("UFID"); 107 | 108 | for(ID3v2::FrameList::ConstIterator it = comments.begin(); 109 | it != comments.end(); 110 | ++it) 111 | { 112 | UniqueFileIdentifierFrame *frame = dynamic_cast(*it); 113 | if(frame && frame->owner() == o) 114 | return frame; 115 | } 116 | 117 | return 0; 118 | } 119 | 120 | void UniqueFileIdentifierFrame::parseFields(const ByteVector &data) 121 | { 122 | if(data.size() < 1) { 123 | debug("An UFID frame must contain at least 1 byte."); 124 | return; 125 | } 126 | 127 | int pos = 0; 128 | d->owner = readStringField(data, String::Latin1, &pos); 129 | d->identifier = data.mid(pos); 130 | } 131 | 132 | ByteVector UniqueFileIdentifierFrame::renderFields() const 133 | { 134 | ByteVector data; 135 | 136 | data.append(d->owner.data(String::Latin1)); 137 | data.append(char(0)); 138 | data.append(d->identifier); 139 | 140 | return data; 141 | } 142 | 143 | UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data, Header *h) : 144 | Frame(h) 145 | { 146 | d = new UniqueFileIdentifierFramePrivate; 147 | parseFields(fieldData(data)); 148 | } 149 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4file.h: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #ifndef TAGLIB_MP4FILE_H 27 | #define TAGLIB_MP4FILE_H 28 | 29 | #include "tag.h" 30 | #include "tfile.h" 31 | #include "taglib_export.h" 32 | #include "mp4properties.h" 33 | #include "mp4tag.h" 34 | 35 | namespace TagLib { 36 | 37 | //! An implementation of MP4 (AAC, ALAC, ...) metadata 38 | namespace MP4 { 39 | 40 | class Atoms; 41 | 42 | /*! 43 | * This implements and provides an interface for MP4 files to the 44 | * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing 45 | * the abstract TagLib::File API as well as providing some additional 46 | * information specific to MP4 files. 47 | */ 48 | class TAGLIB_EXPORT File : public TagLib::File 49 | { 50 | public: 51 | /*! 52 | * Constructs an MP4 file from \a file. If \a readProperties is true the 53 | * file's audio properties will also be read. 54 | * 55 | * \note In the current implementation, \a propertiesStyle is ignored. 56 | */ 57 | File(FileName file, bool readProperties = true, 58 | Properties::ReadStyle audioPropertiesStyle = Properties::Average); 59 | 60 | /*! 61 | * Constructs an MP4 file from \a stream. If \a readProperties is true the 62 | * file's audio properties will also be read. 63 | * 64 | * \note TagLib will *not* take ownership of the stream, the caller is 65 | * responsible for deleting it after the File object. 66 | * 67 | * \note In the current implementation, \a propertiesStyle is ignored. 68 | */ 69 | File(IOStream *stream, bool readProperties = true, 70 | Properties::ReadStyle audioPropertiesStyle = Properties::Average); 71 | 72 | /*! 73 | * Destroys this instance of the File. 74 | */ 75 | virtual ~File(); 76 | 77 | /*! 78 | * Returns a pointer to the MP4 tag of the file. 79 | * 80 | * MP4::Tag implements the tag interface, so this serves as the 81 | * reimplementation of TagLib::File::tag(). 82 | * 83 | * \note The Tag is still owned by the MP4::File and should not be 84 | * deleted by the user. It will be deleted when the file (object) is 85 | * destroyed. 86 | */ 87 | Tag *tag() const; 88 | 89 | /*! 90 | * Implements the unified property interface -- export function. 91 | */ 92 | PropertyMap properties() const; 93 | 94 | /*! 95 | * Removes unsupported properties. Forwards to the actual Tag's 96 | * removeUnsupportedProperties() function. 97 | */ 98 | void removeUnsupportedProperties(const StringList &properties); 99 | 100 | /*! 101 | * Implements the unified property interface -- import function. 102 | */ 103 | PropertyMap setProperties(const PropertyMap &); 104 | 105 | /*! 106 | * Returns the MP4 audio properties for this file. 107 | */ 108 | Properties *audioProperties() const; 109 | 110 | /*! 111 | * Save the file. 112 | * 113 | * This returns true if the save was successful. 114 | */ 115 | bool save(); 116 | 117 | private: 118 | 119 | void read(bool readProperties, Properties::ReadStyle audioPropertiesStyle); 120 | bool checkValid(const MP4::AtomList &list); 121 | 122 | class FilePrivate; 123 | FilePrivate *d; 124 | }; 125 | 126 | } 127 | 128 | } 129 | 130 | #endif 131 | -------------------------------------------------------------------------------- /foo_cad_plus/taglib/mp4/mp4item.cpp: -------------------------------------------------------------------------------- 1 | /************************************************************************** 2 | copyright : (C) 2007 by Lukáš Lalinský 3 | email : lalinsky@gmail.com 4 | **************************************************************************/ 5 | 6 | /*************************************************************************** 7 | * This library is free software; you can redistribute it and/or modify * 8 | * it under the terms of the GNU Lesser General Public License version * 9 | * 2.1 as published by the Free Software Foundation. * 10 | * * 11 | * This library is distributed in the hope that it will be useful, but * 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of * 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 14 | * Lesser General Public License for more details. * 15 | * * 16 | * You should have received a copy of the GNU Lesser General Public * 17 | * License along with this library; if not, write to the Free Software * 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 19 | * 02110-1301 USA * 20 | * * 21 | * Alternatively, this file is available under the Mozilla Public * 22 | * License Version 1.1. You may obtain a copy of the License at * 23 | * http://www.mozilla.org/MPL/ * 24 | ***************************************************************************/ 25 | 26 | #include 27 | #include 28 | #include "trefcounter.h" 29 | #include "mp4item.h" 30 | 31 | using namespace TagLib; 32 | 33 | class MP4::Item::ItemPrivate : public RefCounter 34 | { 35 | public: 36 | ItemPrivate() : RefCounter(), valid(true), atomDataType(TypeUndefined) {} 37 | 38 | bool valid; 39 | AtomDataType atomDataType; 40 | union { 41 | bool m_bool; 42 | int m_int; 43 | IntPair m_intPair; 44 | uchar m_byte; 45 | uint m_uint; 46 | long long m_longlong; 47 | }; 48 | StringList m_stringList; 49 | ByteVectorList m_byteVectorList; 50 | MP4::CoverArtList m_coverArtList; 51 | }; 52 | 53 | MP4::Item::Item() 54 | { 55 | d = new ItemPrivate; 56 | d->valid = false; 57 | } 58 | 59 | MP4::Item::Item(const Item &item) : d(item.d) 60 | { 61 | d->ref(); 62 | } 63 | 64 | MP4::Item & 65 | MP4::Item::operator=(const Item &item) 66 | { 67 | if(d->deref()) { 68 | delete d; 69 | } 70 | d = item.d; 71 | d->ref(); 72 | return *this; 73 | } 74 | 75 | MP4::Item::~Item() 76 | { 77 | if(d->deref()) { 78 | delete d; 79 | } 80 | } 81 | 82 | MP4::Item::Item(bool value) 83 | { 84 | d = new ItemPrivate; 85 | d->m_bool = value; 86 | } 87 | 88 | MP4::Item::Item(int value) 89 | { 90 | d = new ItemPrivate; 91 | d->m_int = value; 92 | } 93 | 94 | MP4::Item::Item(uchar value) 95 | { 96 | d = new ItemPrivate; 97 | d->m_byte = value; 98 | } 99 | 100 | MP4::Item::Item(uint value) 101 | { 102 | d = new ItemPrivate; 103 | d->m_uint = value; 104 | } 105 | 106 | MP4::Item::Item(long long value) 107 | { 108 | d = new ItemPrivate; 109 | d->m_longlong = value; 110 | } 111 | 112 | MP4::Item::Item(int value1, int value2) 113 | { 114 | d = new ItemPrivate; 115 | d->m_intPair.first = value1; 116 | d->m_intPair.second = value2; 117 | } 118 | 119 | MP4::Item::Item(const ByteVectorList &value) 120 | { 121 | d = new ItemPrivate; 122 | d->m_byteVectorList = value; 123 | } 124 | 125 | MP4::Item::Item(const StringList &value) 126 | { 127 | d = new ItemPrivate; 128 | d->m_stringList = value; 129 | } 130 | 131 | MP4::Item::Item(const MP4::CoverArtList &value) 132 | { 133 | d = new ItemPrivate; 134 | d->m_coverArtList = value; 135 | } 136 | 137 | void MP4::Item::setAtomDataType(MP4::AtomDataType type) 138 | { 139 | d->atomDataType = type; 140 | } 141 | 142 | MP4::AtomDataType MP4::Item::atomDataType() const 143 | { 144 | return d->atomDataType; 145 | } 146 | 147 | bool 148 | MP4::Item::toBool() const 149 | { 150 | return d->m_bool; 151 | } 152 | 153 | int 154 | MP4::Item::toInt() const 155 | { 156 | return d->m_int; 157 | } 158 | 159 | uchar 160 | MP4::Item::toByte() const 161 | { 162 | return d->m_byte; 163 | } 164 | 165 | TagLib::uint 166 | MP4::Item::toUInt() const 167 | { 168 | return d->m_uint; 169 | } 170 | 171 | long long 172 | MP4::Item::toLongLong() const 173 | { 174 | return d->m_longlong; 175 | } 176 | 177 | MP4::Item::IntPair 178 | MP4::Item::toIntPair() const 179 | { 180 | return d->m_intPair; 181 | } 182 | 183 | StringList 184 | MP4::Item::toStringList() const 185 | { 186 | return d->m_stringList; 187 | } 188 | 189 | ByteVectorList 190 | MP4::Item::toByteVectorList() const 191 | { 192 | return d->m_byteVectorList; 193 | } 194 | 195 | MP4::CoverArtList 196 | MP4::Item::toCoverArtList() const 197 | { 198 | return d->m_coverArtList; 199 | } 200 | 201 | bool 202 | MP4::Item::isValid() const 203 | { 204 | return d->valid; 205 | } 206 | 207 | --------------------------------------------------------------------------------