Clip.h 3.94 KB
Newer Older
1
/*****************************************************************************
2
 * Clip.h : Represents a basic container for media informations.
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
 * Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * 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 General Public License for more details.
 *
 * You should have received a copy of the GNU 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.
 *****************************************************************************/

/** \file
  * This file contains the Clip class declaration/definition.
  * It's used by the timeline in order to represent a subset of a media
  */

#ifndef CLIP_H__
# define CLIP_H__

#include <QObject>
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
32
#include <QUuid>
33
34
35

#include "Media.h"

36
37
38
39
40
//TODO: REMOVE THIS
#ifndef FPS
#define FPS     30
#endif

41
42
class Media;

43
44
45
46
47
class   Clip : public QObject
{
    Q_OBJECT

    public:
48
        Clip( Media* parent );
49
50
        Clip( Media* parent, qint64 begin, qint64 end );
        Clip( Clip* creator, qint64 begin, qint64 end );
51
        Clip( Clip* clip );
52
        Clip( const QUuid& uuid, qint64 begin = 0, qint64 end = -1 );
53
        virtual ~Clip();
54

55
56
        qint64              getBegin() const;
        qint64              getEnd() const;
57

58
59
        void                setBegin( qint64 begin );
        void                setEnd( qint64 end );
60
        void                setBoundaries( qint64 newBegin, qint64 newEnd );
61

62
        /**
63
            \return         Returns the clip length in frame.
64
        */
65
        qint64              getLength() const;
66

67
        /**
68
            \return         Returns the clip length in seconds.
69
        */
70
        qint64              getLengthSecond() const;
71

72
        /**
73
            \return         Returns the Media that the clip was basep uppon.
74
75

        */
76
        Media*              getParent();
77
78

        /**
79
80
            \brief          Returns an unique Uuid for this clip (which is NOT the
                            parent's Uuid).
81

82
            \return         The Clip's Uuid as a QUuid
83
        */
84
        const QUuid&        getUuid() const;
85
86
87
88
89

        const QStringList&  getMetaTags() const;
        void                setMetaTags( const QStringList& tags );
        bool                matchMetaTag( const QString& tag ) const;

Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
90
91
92
        const QString&      getNotes() const;
        void                setNotes( const QString& notes );

93
    private:
94
95
        void        computeLength();

96
        Media*      m_parent;
97
98
99
100
101
102
103
104
105
106
107
108
109
110
        /**
         *  \brief  This represents the beginning of the Clip in frames, from the
         *          beginning of the parent Media.
         */
        qint64      m_begin;
        /**
         *  \brief  This represents the end of the Clip in frames, from the
         *          beginning of the parent Media.
         */
        qint64      m_end;

        /**
         *  \brief  The length in frames
         */
111
        qint64      m_length;
112
113
114
        /**
         *  \brief  The length in seconds (Be carreful, VLC uses MILLIseconds)
         */
115
        qint64      m_lengthSeconds;
116
117
118
119
120
        /**
         *  The Clip's timeline UUID. Used to identify the Clip in the
         *  timeline, as a unique object, even if this clip is present more than
         *  once.
         */
121
        QUuid       m_Uuid;
122
        QStringList m_metaTags;
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
123
        QString     m_notes;
124

125
126
    signals:
        void        lengthUpdated();
127
128
129
};

#endif //CLIP_H__