IMedia.h 3.17 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
26
#ifndef IFILE_H
#define IFILE_H

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

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

class IAlbumTrack;
class IShowEpisode;
class ITrackInformation;

35
class IMedia
36
37
{
    public:
38
        enum class Type : uint8_t
39
40
41
        {
            VideoType, // Any video file, not being a tv show episode
            AudioType, // Any kind of audio file, not being an album track
42
            UnknownType
43
        };
44
        virtual ~IMedia() {}
45

46
        virtual unsigned int id() const = 0;
47
        virtual Type type() = 0;
48
        virtual const std::string& title() = 0;
49
        virtual AlbumTrackPtr albumTrack() = 0;
50
51
52
53
        /**
         * @brief duration Returns the file duration in ms
         */
        virtual int64_t duration() const = 0;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
54
        virtual std::shared_ptr<IShowEpisode> showEpisode() = 0;
55
        virtual int playCount() const = 0;
56
        virtual void increasePlayCount() = 0;
57
        virtual const std::string& mrl() const = 0;
58
59
60
61
62
63
64
65
66
67
68
69
70
        ///
        /// \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;
71
72
        virtual bool addLabel( LabelPtr label ) = 0;
        virtual bool removeLabel( LabelPtr label ) = 0;
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
73
        virtual MoviePtr movie() = 0;
74
        virtual const std::string& artist() const = 0;
75
        virtual std::vector<LabelPtr> labels() = 0;
76
77
        virtual std::vector<VideoTrackPtr> videoTracks() = 0;
        virtual std::vector<AudioTrackPtr> audioTracks() = 0;
78
79
80
        // Returns the location of this file snapshot.
        // This is likely to be used for album arts as well.
        virtual const std::string& snapshot() = 0;
81
        virtual unsigned int insertionDate() const = 0;
82
83
84
};

#endif // IFILE_H