VLCMediaPlayer.h 4.12 KB
Newer Older
1 2 3
/*****************************************************************************
 * VLCMediaPlayer.h: Binding for libvlc_media_player
 *****************************************************************************
4
 * Copyright (C) 2008-2014 VideoLAN
5
 *
Hugo Beauzée-Luyssen's avatar
Hugo Beauzée-Luyssen committed
6
 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
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.
 *****************************************************************************/

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

#include "VLCpp.hpp"
27

28 29
#include "vlc/vlc.h"

30 31 32 33
struct  libvlc_media_player_t;
struct  libvlc_event_t;
struct  libvlc_event_manager_t;

Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
34 35
namespace   LibVLCpp
{
36
    class   Instance;
37
    class   Media;
38 39

    class   MediaPlayer : public Internal< libvlc_media_player_t >
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
40 41
    {
    public:
42

43 44
        typedef bool (*CheckEventCallback)(const MediaPlayer*, const libvlc_event_t*);

45
        MediaPlayer( Instance* vlcInstance );
46
        ~MediaPlayer();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
47 48
        void                                play();
        void                                pause();
49
        void                                setPause( bool isPaused );
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
50
        void                                stop();
51 52
        int                                 getVolume();
        int                                 setVolume( int volume );
53 54
        int64_t                             getTime();
        void                                setTime(int64_t time );
55 56
        float                               getPosition();
        void                                setPosition( float pos );
57 58 59
        /**
         \return        The length, in milliseconds.
        */
60
        int64_t getLength();
61
        void                                takeSnapshot( const char* outputFile, unsigned int width, unsigned int heigth );
62 63
        bool                                isPlaying();
        bool                                isSeekable();
64
        void                                setDrawable( void* drawable );
65
        void                                setMedia(Media* media);
66
        void                                getSize( unsigned int *outWidth, unsigned int *outHeight);
67
        float                               getFps();
68
        void                                nextFrame();
69
        bool                                hasVout();
70 71
        int                                 getNbAudioTrack();
        int                                 getNbVideoTrack();
72
        void                                setKeyInput( bool enabled );
73
        bool                                setAudioOutput(const char* module);
74
        void                                disableTitle();
75 76 77 78
        void                                setupVmemCallbacks( libvlc_video_lock_cb lock, libvlc_video_unlock_cb unlock,
                                                        libvlc_video_display_cb display, void* data );
        void                                setupVmem( const char* chroma, unsigned int width,
                                                       unsigned int height, unsigned int pitch );
79
        bool                                willPlay();
80
        libvlc_state_t                      state();
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
81

82 83 84 85

        void                                registerEvents( libvlc_callback_t callback, void* data );
        void                                unregisterEvents( libvlc_callback_t callback, void* data );
        const char*                         eventName( libvlc_event_type_t event ) const;
86

87
    private:
88
        libvlc_event_manager_t*             p_em;
Hugo Beauzee-Luyssen's avatar
Hugo Beauzee-Luyssen committed
89 90 91 92
    };
}

#endif // VLCMEDIAPLAYER_H