ClipRenderer.h 2.74 KB
Newer Older
Christophe Courtaut's avatar
Christophe Courtaut committed
1
/*****************************************************************************
2
 * ClipRenderer.h: Preview widget
Christophe Courtaut's avatar
Christophe Courtaut committed
3
 *****************************************************************************
4
 * Copyright (C) 2008-2016 VideoLAN
Christophe Courtaut's avatar
Christophe Courtaut committed
5
 *
6 7
 * Authors: Yikei Lu    <luyikei.qmltu@gmail.com>
 *          Hugo Beauzée-Luyssen <hugo@beauzee.fr>
Christophe Courtaut's avatar
Christophe Courtaut committed
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 *
 * 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.
 *****************************************************************************/

24 25
#ifndef CLIPRENDERER_H
#define CLIPRENDERER_H
geoff's avatar
geoff committed
26

27
#include "AbstractRenderer.h"
28 29

#include <QObject>
30
#include <QSharedPointer>
31

32 33
class   Clip;
class   Media;
34

35
class ClipRenderer : public AbstractRenderer
36
{
geoff's avatar
geoff committed
37
    Q_OBJECT
38
    Q_DISABLE_COPY( ClipRenderer )
39

geoff's avatar
geoff committed
40
public:
41
    explicit ClipRenderer();
42
    virtual ~ClipRenderer();
geoff's avatar
geoff committed
43

44
    virtual void            togglePlayPause();
45
    virtual void            stop();
46
    virtual qint64          length() const;
47
    virtual qint64          getLengthMs() const;
48
    virtual QSharedPointer<Clip> getClip();
49

50 51 52
private:
    void                    startPreview();

geoff's avatar
geoff committed
53
private:
54
    bool                    m_clipLoaded;
55
    QSharedPointer<Clip>    m_selectedClip;
56 57 58 59 60
    /**
     *  \brief  This flags is used to know if a new media has been selected in the
     * library. If so, we must relaunch the render if the play button is clicked again.
     */
    bool                    m_mediaChanged;
61 62

public slots:
63 64 65 66
    /**
     *  \brief      Set the Clip to render
     *  \param      clip    The clip to render
     */
67
    void                    setClip( QSharedPointer<Clip> clip );
68
    void                    clipUnloaded( const QUuid& uuid );
69

70 71 72 73 74 75 76 77
    /**
     *  \brief      Triggered at every libvlc_MediaPlayerTimeChanged event.
     *
     *  This slot will compute a frame number based on the time and the clip's FPS.
     *  Once computed, it will emit a frameChanged signal, with the reason Renderer.
     *  \warning    The frame number computed may be unaccurate.
     *  \sa         frameChanged();
     */
78
    void                    positionChanged( qint64 time );
79
    void                    videoStopped();
geoff's avatar
geoff committed
80 81
};

82
#endif // CLIPRENDERER_H