VLCMediaPlayer.h 3.56 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
/*****************************************************************************
 * VLCMediaPlayer.h: Binding for libvlc_media_player
 *****************************************************************************
 * 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.
 *****************************************************************************/

Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
23 24 25 26 27 28
#ifndef VLCMEDIAPLAYER_H
#define VLCMEDIAPLAYER_H

#include "vlc/vlc.h"

#include <QMutex>
Ludovic Fauvet's avatar
Ludovic Fauvet committed
29
#include <QObject>
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
30 31 32 33 34 35 36

#include "VLCpp.hpp"
#include "VLCMedia.h"
#include "VLCException.h"

namespace   LibVLCpp
{
Ludovic Fauvet's avatar
Ludovic Fauvet committed
37
    class   MediaPlayer : public QObject, public Internal< libvlc_media_player_t >
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
38
    {
Ludovic Fauvet's avatar
Ludovic Fauvet committed
39
        Q_OBJECT
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
40
    public:
41
        MediaPlayer();
42
        MediaPlayer( Media* media );
43
        ~MediaPlayer();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
44 45 46 47
        void                                play();
        void                                pause();
        void                                stop();
        qint64                              getTime();
Ludovic Fauvet's avatar
Ludovic Fauvet committed
48
        void                                setTime( qint64 time );
49 50
        float                               getPosition();
        void                                setPosition( float pos );
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
51
        qint64                              getLength();
52
        void                                takeSnapshot( const char* outputFile, unsigned int width, unsigned int heigth );
53 54
        bool                                isPlaying();
        bool                                isSeekable();
55 56
        void                                setDrawable( void* hwnd );
        void                                setDrawable( uint32_t drawable );
57
        void                                setMedia(Media* media);
58 59
        int                                 getWidth();
        int                                 getHeight();
60
        float                               getFps();
61
        void                                nextFrame();
62
        bool                                hasVout();
63 64
        const QString&                      getLoadedFileName() const;
        QString                             getLoadedMRL();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
65 66

    private:
Ludovic Fauvet's avatar
Ludovic Fauvet committed
67 68
        static void                         callbacks( const libvlc_event_t* event, void* self );

Ludovic Fauvet's avatar
Ludovic Fauvet committed
69
        Exception                           m_ex;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
70
        libvlc_event_manager_t*             p_em;
71
        Media*                              m_media;
Ludovic Fauvet's avatar
Ludovic Fauvet committed
72 73 74

    signals:
        void                                snapshotTaken();
75
        void                                timeChanged( qint64 );
76
        void                                playing();
77 78 79
        void                                paused();
        void                                stopped();
        void                                endReached();
80
        void                                positionChanged( float );
81
        void                                lengthChanged();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
82 83 84 85
    };
}

#endif // VLCMEDIAPLAYER_H