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 4 5
 *****************************************************************************
 * Copyright (C) 2008-2009 the VLMC team
 *
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
#include <QWidget>
#include <QObject>
28

29
#include "VLCMediaPlayer.h"
30
#include "Clip.h"
31
#include "GenericRenderer.h"
geoff's avatar
geoff committed
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( bool forcePause );
43
    virtual void            stop();
44 45
    virtual void            nextFrame();
    virtual void            previousFrame();
46
    virtual qint64          getLength() const;
47
    virtual qint64          getLengthMs() const;
48
    virtual qint64          getCurrentFrame() const;
49
    virtual float           getFps() const;
50
    virtual Media*          getMedia() const;
51

52 53
private:
    void                    startPreview();
54
    void                    setSnapshotVisibility( bool val );
55

geoff's avatar
geoff committed
56
private:
57
    bool                    m_clipLoaded;
58
    LibVLCpp::Media*        m_vlcMedia;
59 60 61
    Media*                  m_selectedMedia;
    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
    virtual void            setClip( Clip* clip );
70
    virtual void            setMedia( Media* media );
71
    virtual void            mediaUnloaded( const QUuid& );
72
    virtual void            previewWidgetCursorChanged( qint64 newFrame );
73

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

87
#endif // CLIPRENDERER_H