VideoTrack.h 2.9 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 VIDEOTRACK_H
#define VIDEOTRACK_H

26
#include "database/DatabaseHelpers.h"
27
#include "medialibrary/IVideoTrack.h"
28 29 30

#include <sqlite3.h>

31 32 33
namespace medialibrary
{

34 35 36 37 38 39 40
class VideoTrack;

namespace policy
{
struct VideoTrackTable
{
    static const std::string Name;
41
    static const std::string PrimaryKeyColumn;
42
    static int64_t VideoTrack::* const PrimaryKey;
43 44 45
};
}

46
class VideoTrack : public IVideoTrack, public DatabaseHelpers<VideoTrack, policy::VideoTrackTable>
47 48
{
    public:
49 50
        VideoTrack( MediaLibraryPtr, sqlite::Row& row );
        VideoTrack( MediaLibraryPtr, const std::string& codec,
51 52
                    unsigned int width, unsigned int height, float fps, int64_t mediaId,
                    const std::string& language, const std::string& description );
53

54
        virtual int64_t id() const override;
55 56 57 58
        virtual const std::string& codec() const override;
        virtual unsigned int width() const override;
        virtual unsigned int height() const override;
        virtual float fps() const override;
59 60
        virtual const std::string& language() const override;
        virtual const std::string& description() const override;
61

62
        static void createTable( sqlite::Connection* dbConnection );
63 64 65
        static std::shared_ptr<VideoTrack> create( MediaLibraryPtr ml, const std::string& codec,
                                    unsigned int width, unsigned int height, float fps, int64_t mediaId,
                                    const std::string& language, const std::string& description );
66 67

    private:
68
        int64_t m_id;
69 70 71 72
        std::string m_codec;
        unsigned int m_width;
        unsigned int m_height;
        float m_fps;
73
        int64_t m_mediaId;
74 75
        std::string m_language;
        std::string m_description;
76 77 78 79 80

    private:
        friend struct policy::VideoTrackTable;
};

81 82
}

83
#endif // VIDEOTRACK_H