VideoTrack.h 3.48 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
class VideoTrack;

36
class VideoTrack : public IVideoTrack, public DatabaseHelpers<VideoTrack>
37 38
{
    public:
39 40 41 42 43 44
        struct Table
        {
            static const std::string Name;
            static const std::string PrimaryKeyColumn;
            static int64_t VideoTrack::* const PrimaryKey;
        };
45
        VideoTrack( MediaLibraryPtr, sqlite::Row& row );
46
        VideoTrack( MediaLibraryPtr, const std::string& codec,
47
                    unsigned int width, unsigned int height, uint32_t fpsNum,
48 49
                    uint32_t fpsDen, uint32_t bitrate, uint32_t sarNum, uint32_t sarDen,
                    int64_t mediaId, const std::string& language, const std::string& description );
50

51
        virtual int64_t id() const override;
52 53 54 55
        virtual const std::string& codec() const override;
        virtual unsigned int width() const override;
        virtual unsigned int height() const override;
        virtual float fps() const override;
56 57
        virtual uint32_t fpsNum() const override;
        virtual uint32_t fpsDen() const override;
58
        virtual uint32_t bitrate() const override;
59 60
        virtual uint32_t sarNum() const override;
        virtual uint32_t sarDen() const override;
61 62
        virtual const std::string& language() const override;
        virtual const std::string& description() const override;
63

64
        static void createTable( sqlite::Connection* dbConnection );
65
        static std::shared_ptr<VideoTrack> create( MediaLibraryPtr ml, const std::string& codec,
66
                                    unsigned int width, unsigned int height, uint32_t fpsNum,
67 68
                                    uint32_t fpsDen, uint32_t bitrate, uint32_t sarNum,
                                    uint32_t sarDen, int64_t mediaId, const std::string& language,
69
                                    const std::string& description );
70 71

    private:
72
        int64_t m_id;
73 74 75
        std::string m_codec;
        unsigned int m_width;
        unsigned int m_height;
76 77
        uint32_t m_fpsNum;
        uint32_t m_fpsDen;
78
        uint32_t m_bitrate;
79 80
        uint32_t m_sarNum;
        uint32_t m_sarDen;
81
        int64_t m_mediaId;
82 83
        std::string m_language;
        std::string m_description;
84 85

    private:
86
        friend struct VideoTrack::Table;
87 88
};

89 90
}

91
#endif // VIDEOTRACK_H