IMedia.h 3.3 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.
 *****************************************************************************/

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
23
#pragma once
24
25

#include <vector>
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
26
#include <memory>
27
28

#include "IMediaLibrary.h"
29
30
31
32
33

class IAlbumTrack;
class IShowEpisode;
class ITrackInformation;

34
class IMedia
35
36
{
    public:
37
        enum class Type : uint8_t
38
        {
39
40
            VideoType,
            AudioType,
41
            UnknownType
42
        };
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
43
44
45
46
47
48
49
50
        enum class SubType : uint8_t
        {
            Unknown,
            ShowEpisode,
            Movie,
            AlbumTrack,
        };

Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
51
        virtual ~IMedia() = default;
52

53
        virtual unsigned int id() const = 0;
54
        virtual Type type() = 0;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
55
        virtual SubType subType() const = 0;
56
        virtual const std::string& title() const = 0;
57
        virtual AlbumTrackPtr albumTrack() const = 0;
58
        /**
59
         * @brief duration Returns the media duration in ms
60
61
         */
        virtual int64_t duration() const = 0;
62
        virtual ShowEpisodePtr showEpisode() const = 0;
63
        virtual int playCount() const = 0;
64
        virtual void increasePlayCount() = 0;
65
        virtual const std::vector<FilePtr>& files() const = 0;
66
67
68
69
70
71
72
73
74
75
76
77
78
        ///
        /// \brief progress Returns the progress, in the [0;1] range
        ///
        virtual float progress() const = 0;
        virtual void setProgress( float progress ) = 0;
        ///
        /// \brief rating The media rating, or -1 if unset.
        /// It is up to the application to determine the values it wishes to use.
        /// No value is enforced, and any positive value (less or equal to INT32_MAX)
        /// will be accepted.
        ///
        virtual int rating() const = 0;
        virtual void setRating( int rating ) = 0;
79
80
        virtual bool addLabel( LabelPtr label ) = 0;
        virtual bool removeLabel( LabelPtr label ) = 0;
81
        virtual MoviePtr movie() const = 0;
82
        virtual std::vector<LabelPtr> labels() = 0;
83
84
        virtual std::vector<VideoTrackPtr> videoTracks() = 0;
        virtual std::vector<AudioTrackPtr> audioTracks() = 0;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
85
        ///
86
        /// \brief thumbnail Returns the path of a thumbnail for this media
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
87
88
89
90
        /// \return A path, relative to the thumbnailPath configured when initializing
        ///  The media library
        ///
        virtual const std::string& thumbnail() = 0;
91
        virtual unsigned int insertionDate() const = 0;
92
};