File indexing completed on 2024-04-28 04:45:53

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Sergey Ivanov <123kash@gmail.com>                                 *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 
0018 #ifndef VORBISCOMMENTTAGHELPER_H
0019 #define VORBISCOMMENTTAGHELPER_H
0020 
0021 #include "TagHelper.h"
0022 
0023 #include <xiphcomment.h>
0024 #include <flacfile.h>
0025 
0026 class QImage;
0027 
0028 namespace Meta
0029 {
0030     namespace Tag
0031     {
0032         class AMAROKSHARED_EXPORT VorbisCommentTagHelper : public TagHelper
0033         {
0034             public:
0035                 VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::XiphComment *commentsTag, Amarok::FileType fileType, TagLib::FLAC::File *file = nullptr );
0036 
0037                 Meta::FieldHash tags() const override;
0038                 bool setTags( const Meta::FieldHash &changes ) override;
0039 
0040                 TagLib::ByteVector render() const override;
0041 
0042                 bool hasEmbeddedCover() const override;
0043                 QImage embeddedCover() const override;
0044                 bool setEmbeddedCover( const QImage &cover ) override;
0045 
0046             private:
0047                 static bool parsePictureBlock( const TagLib::StringList& block, QImage* result = nullptr );
0048                 TagLib::Ogg::XiphComment *m_tag;
0049                 TagLib::FLAC::File *m_flacFile;
0050         };
0051     }
0052 }
0053 
0054 #endif // VORBISCOMMENTTAGHELPER_H