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

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

26 27 28 29
#include "GenericRenderer.h"

#include <QObject>

30 31
class   Clip;
class   Media;
32

33
class ClipRenderer : public GenericRenderer
34
{
geoff's avatar
geoff committed
35
    Q_OBJECT
36
    Q_DISABLE_COPY( ClipRenderer )
37

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

42
    virtual void            togglePlayPause();
43
    virtual void            stop();
44
    virtual void            setVolume( int volume );
45
    virtual int             getVolume() const;
46 47
    virtual void            nextFrame();
    virtual void            previousFrame();
48
    virtual qint64          length() const;
49
    virtual qint64          getLengthMs() const;
50
    virtual qint64          getCurrentFrame() const;
51
    virtual float           getFps() const;
52
    virtual Clip            *getClip();
53

54 55 56
private:
    void                    startPreview();

geoff's avatar
geoff committed
57
private:
58
    bool                    m_clipLoaded;
59
    Clip*                   m_selectedClip;
60 61
    qint64                  m_begin;
    qint64                  m_end;
62 63 64 65 66
    /**
     *  \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;
67 68

public slots:
69 70 71 72
    /**
     *  \brief      Set the Clip to render
     *  \param      clip    The clip to render
     */
73
    void                    setClip( Clip* clip );
74
    void                    clipUnloaded( const QUuid& uuid );
75
    virtual void            previewWidgetCursorChanged( qint64 newFrame );
76
    void                    updateInfos( Clip* clip );
77

78 79 80 81 82 83 84 85
    /**
     *  \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();
     */
86
    void                    __timeChanged( qint64 time );
87
    void                    __videoStopped();
geoff's avatar
geoff committed
88 89
};

90
#endif // CLIPRENDERER_H