Source

libtaginfo / libtaginfo / taginfo_xiphtags.h

/*
 * Copyright (C) 2008-2013 J.Rios <anonbeat@gmail.com>
 * Copyright (C) 2013 Jörn Magens
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 * 
 * This Program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; see the file LICENSE.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth 
 * Floor, Boston, MA  02110-1301  USA
 * https://www.gnu.org/licenses/lgpl-2.1.txt
 *
 * Author:
 * 	Jörn Magens <shuerhaaken@googlemail.com>
 * 
 */


#ifndef TAGINFO_XIPH_H
#define TAGINFO_XIPH_H


#include "taginfo.h"

#include <flacfile.h>
#include <oggfile.h>
#include <vorbisfile.h>


using namespace TagLib;
using namespace TagInfo;


/** @file */


namespace TagInfo {
    
    // GENERAL XIPH
    /*!
     * XiphInfo is a common implementation of Info for media files with xiph comment tags.
    */        
    class XiphInfo : public Info {
        protected :
            //! Constructor for XiphInfo
            //! \param filename is the path to the media file
            XiphInfo(const String &filename = "");
            //! Xiph comment
            Ogg::XiphComment * xiphcomment;
            
        public :
            virtual ~XiphInfo();
            
            virtual bool load(void);
            virtual bool save(void);
            
            virtual Image ** get_images(int &image_count) const;
            virtual void     set_images(const Image ** images, const int image_count);
            
            //virtual bool can_handle_lyrics(void) const;
            virtual String get_lyrics(void) const;
            virtual bool   set_lyrics(const String &lyrics);
    };
    
    // FILE TYPES
    
    /*!
     * FlacInfo is an implementation of Info for flac files.
    */    
    class FlacInfo : public XiphInfo {
        protected :
            //! Flac tag
            TagLib::FLAC::File * flac_file;
            virtual bool setup_file_ref();
        
        public :
            //! Constructor for FlacInfo
            //! \param filename is the path to the media file
            FlacInfo(const String &filename = "");
            virtual ~FlacInfo();
            
            virtual bool load(void);
            
            virtual Image ** get_images(int &image_count) const;
            virtual void     set_images(const Image ** images, const int image_count);
    };
    
    
    /*!
     * OggInfo is an implementation of Info for ogg and oga files.
    */    
    class OggInfo : public XiphInfo {
        protected :
            virtual bool setup_file_ref();
            
        public :
            //! Constructor for OggInfo
            //! \param filename is the path to the media file
            OggInfo(const String &filename = "");
            virtual ~OggInfo();
    };
    
    
    /*!
     * SpeexInfo is an implementation of Info for speex files.
    */    
    class SpeexInfo : public XiphInfo {
        protected :
            virtual bool setup_file_ref();
            
        public :
            //! Constructor for SpeexInfo
            //! \param filename is the path to the media file
            SpeexInfo(const String &filename = "");
            virtual ~SpeexInfo();
    };
}

#endif