]> git.sesse.net Git - vlc/blob - bindings/libvlcpp/src/media_player.hpp
7a893254ff0bb8e03f9825a3abd55d83ebd328dc
[vlc] / bindings / libvlcpp / src / media_player.hpp
1 /*****************************************************************************
2  * media_player.hpp: Media player
3  *****************************************************************************
4  * Copyright (C) 2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: Rémi Duraffort <ivoire@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22  *****************************************************************************/
23
24 #ifndef LIBVLCPP_MEDIA_PLAYER_HPP
25 #define LIBVLCPP_MEDIA_PLAYER_HPP
26
27 #include <vlc/libvlc.h>
28 #include <vlc/libvlc_media.h>
29 #include <vlc/libvlc_media_player.h>
30
31 #include "libvlc.hpp"
32 #include "media.hpp"
33
34 namespace libvlc
35 {
36
37 class MediaPlayer
38 {
39 public:
40     /**
41      * Create a media player without a media associated
42      * @param libvlcInstance: instance of the libVLC class
43      */
44     MediaPlayer( libVLC &libvlcInstance );
45
46     /**
47      * Create a media player with a media associated
48      * @param media: the associated media (the media can be safely destroy afterward)
49      */
50     MediaPlayer( Media &media);
51
52     /**
53      * Destructor
54      */
55     ~MediaPlayer();
56
57     /**
58      * Set the media associated with the player
59      * @param media: the media to associated with the player
60      */
61     void setMedia( Media &media );
62
63     /**
64      * Get the media associated with the player
65      * @return the media
66      */
67     ///@todo media();
68
69     /**
70      * Get the event manager associated to the media player
71      * @return the event manager
72      */
73     ///@todo eventManager()
74
75     /**
76      * Is the player playing
77      * @return true if the player is playing, false overwise
78      */
79     int isPlaying();
80
81     /**
82      * Play
83      */
84     void play();
85
86     /**
87      * Pause
88      */
89     void pause();
90
91     /**
92      * Stop
93      */
94     void stop();
95
96
97     /**
98      * Set the NSView handler where the media player shoud render the video
99      * @param drawable: the NSView handler
100      */
101     void setNSObject( void *drawable );
102
103     /**
104      * Get the NSView handler associated with the media player
105      * @return the NSView handler
106      */
107     void* nsobject();
108
109     /**
110      * Set the agl handler where the media player shoud render the video
111      * @param drawable: the agl handler
112      */
113     void setAgl( uint32_t drawable );
114
115     /**
116      * Get the agl handler associated with the media player
117      * @return the agl handler
118      */
119     uint32_t agl();
120
121     /**
122      * Set the X Window drawable where the media player shoud render the video
123      * @param drawable: the X Window drawable
124      */
125     void setXWindow( uint32_t drawable );
126
127     /**
128      * Get the X Window drawable associated with the media player
129      * @return the X Window drawable
130      */
131     uint32_t xwindow();
132
133     /**
134      * Set the Win32/Win64 API window handle where the media player shoud
135      * render the video
136      * @param drawable: the windows handle
137      */
138     void setHwnd( void *drawable );
139
140     /**
141      * Get the  Win32/Win64 API window handle associated with the media player
142      * @return the windows handle
143      */
144     void *hwnd();
145
146
147     /**
148      * Get the movie lenght (in ms)
149      * @return the movie length
150      */
151     int64_t lenght();
152
153     /**
154      * Get the current movie time (in ms)
155      * @return the current movie time
156      */
157     int64_t time();
158
159     /**
160       * Set the movie time (in ms)
161       * @param new_time the movie time (in ms)
162       */
163     void setTime( int64_t new_time );
164
165     /**
166       * Get the movie position (in percent)
167       * @return the movie position
168       */
169     float position();
170
171     /**
172       * Set the movie position (in percent)
173       * @param position the movie position
174       */
175     void setPosition( float position );
176
177     /**
178      * Get the current movie chapter
179      * @return the current chapter
180      */
181     int chapter();
182
183     /**
184      * Get the movie chapter count
185      * @return the movie chapter count
186      */
187     int chapterCount();
188
189     /**
190      * Get the number of chapter in the given title
191      * @param title: the title
192      * @return the number of chapter in title
193      */
194     int chapterCount( int title );
195
196     /**
197      * Set the movie chapter
198      * @param chapter: the chapter to play
199      */
200     void setChapter( int chapter );
201
202     /**
203      * Is the player going to play the media (not dead or dying)
204      * @return true if the player will play
205      */
206     int willPlay();
207
208     /**
209      * Get the current title
210      * @return the title
211      */
212     int title();
213
214     /**
215      * Get the title count
216      * @return the number of title
217      */
218     int titleCount();
219
220     /**
221      * Set the title
222      * @param title: the title
223      */
224     void setTitle( int title );
225
226
227     /**
228      * Move to the previous chapter
229      */
230     void previousChapter();
231
232     /**
233      * Move to the next chapter
234      */
235     void nextChapter();
236
237     /**
238      * Get the movie play rate
239      * @return the play rate
240      */
241     float rate();
242
243     /**
244      * Set the movie rate
245      * @param rate: the rate
246      */
247     void setRate( float rate );
248
249     /**
250      * Get the movie state
251      * @return the state
252      */
253     libvlc_state_t state();
254
255     /**
256      * Get the movie fps
257      * @return the movie fps
258      */
259     float fps();
260
261
262     /**
263      * Does the media player have a video output
264      * @return true if the media player has a video output
265      */
266     int hasVout();
267
268     /**
269      * Is the media player able to seek ?
270      * @return true if the media player can seek
271      */
272     int isSeekable();
273
274     /**
275      * Can this media player be paused ?
276      * @return true if the media player can pause
277      */
278     int canPause();
279
280     /**
281      * Display the next frame
282      */
283     void nextFrame();
284
285
286     /**
287      * Toggle fullscreen status on a non-embedded video output
288      */
289     void toggleFullscreen();
290
291     /**
292      * Enable fullscreen on a non-embedded video output
293      */
294     void enableFullscreen();
295
296     /**
297      * Disable fullscreen on a non-embedded video output
298      */
299     void disableFullscreen();
300
301     /**
302      * Get the fullscreen status
303      * @return true if the fullscreen is enable, false overwise
304      */
305     int fullscreen();
306
307 private:
308     /** The media player instance of libvlc */
309     libvlc_media_player_t *m_player;
310 };
311
312 };
313
314 #endif // LIBVLCPP_MEDIA_PLAYER_HPP
315