ClipRenderer.h 3.13 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 Beauzee-Luyssen <hugo@vlmc.org>
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
class   Clip;
class   Media;
class   QUuid;
29

30 31 32 33
namespace LibVLCpp
{
    class   Media;
}
34

35 36
#include "GenericRenderer.h"

37
#include <QObject>
geoff's avatar
geoff committed
38

39
class ClipRenderer : public GenericRenderer
40
{
geoff's avatar
geoff committed
41
    Q_OBJECT
42
    Q_DISABLE_COPY( ClipRenderer )
43

geoff's avatar
geoff committed
44
public:
45
    explicit ClipRenderer();
46
    virtual ~ClipRenderer();
geoff's avatar
geoff committed
47

48
    virtual void            togglePlayPause( bool forcePause );
49
    virtual void            stop();
50 51
    virtual void            nextFrame();
    virtual void            previousFrame();
52
    virtual qint64          getLength() const;
53
    virtual qint64          getLengthMs() const;
54
    virtual qint64          getCurrentFrame() const;
55
    virtual float           getFps() const;
56
    virtual Media*          getMedia() const;
57

58 59 60
private:
    void                    startPreview();

geoff's avatar
geoff committed
61
private:
62
    bool                    m_clipLoaded;
63
    LibVLCpp::Media*        m_vlcMedia;
64 65 66
    Media*                  m_selectedMedia;
    qint64                  m_begin;
    qint64                  m_end;
67 68 69 70 71
    /**
     *  \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;
72 73

public slots:
74 75 76 77 78
    /**
     *  \brief      Set the Clip to render
     *  \param      clip    The clip to render
     */
    virtual void            setClip( const QUuid& );
79
    virtual void            mediaUnloaded( const QUuid& );
80
    virtual void            previewWidgetCursorChanged( qint64 newFrame );
81

82 83 84 85 86 87 88 89
    /**
     *  \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();
     */
90
    void                    __timeChanged( qint64 time );
91
    void                    __endReached();
92
    void                    __videoStopped();
geoff's avatar
geoff committed
93 94
};

95
#endif // CLIPRENDERER_H