AudioTrack.h 3.01 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*****************************************************************************
 * Media Library
 *****************************************************************************
 * Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
 *
 * Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
 *
 * This program 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

23 24 25
#ifndef AUDIOTRACK_H
#define AUDIOTRACK_H

26 27
#include "medialibrary/IAudioTrack.h"
#include "medialibrary/IMediaLibrary.h"
28
#include "database/DatabaseHelpers.h"
29

30 31 32
namespace medialibrary
{

33 34 35 36 37 38 39
class AudioTrack;

namespace policy
{
struct AudioTrackTable
{
    static const std::string Name;
40
    static const std::string PrimaryKeyColumn;
41
    static int64_t AudioTrack::* const PrimaryKey;
42 43 44
};
}

45
class AudioTrack : public IAudioTrack, public DatabaseHelpers<AudioTrack, policy::AudioTrackTable>
46 47
{
    public:
48
        AudioTrack(MediaLibraryPtr ml, sqlite::Row& row );
49 50 51
        AudioTrack( MediaLibraryPtr ml, const std::string& codec, unsigned int bitrate,
                    unsigned int sampleRate, unsigned int nbChannels, const std::string& language,
                    const std::string& desc, int64_t mediaId );
52

53
        virtual int64_t id() const override;
54 55 56 57
        virtual const std::string&codec() const override;
        virtual unsigned int bitrate() const override;
        virtual unsigned int sampleRate() const override;
        virtual unsigned int nbChannels() const override;
58 59
        virtual const std::string& language() const override;
        virtual const std::string& description() const override;
60

61
        static void createTable( sqlite::Connection* dbConnection );
62
        static std::shared_ptr<AudioTrack> create( MediaLibraryPtr ml, const std::string& codec,
63 64
                                                   unsigned int bitrate, unsigned int sampleRate, unsigned int nbChannels,
                                                   const std::string& language, const std::string& desc, int64_t mediaId );
65 66

    private:
67
        int64_t m_id;
68 69 70 71
        std::string m_codec;
        unsigned int m_bitrate;
        unsigned int m_sampleRate;
        unsigned int m_nbChannels;
72 73
        std::string m_language;
        std::string m_description;
74
        int64_t m_mediaId;
75 76 77 78 79

    private:
        friend struct policy::AudioTrackTable;
};

80 81
}

82
#endif // AUDIOTRACK_H