]> git.sesse.net Git - vlc/blob - bindings/libvlcpp/src/media_player.hpp
a4c9bd47d199fad869b3e5d5420af98a6e972fe6
[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 #include "audio.hpp"
34 #include "video.hpp"
35
36 namespace libvlc
37 {
38
39 class MediaPlayer
40 {
41 public:
42     /**
43      * Create a media player without a media associated
44      * @param libvlcInstance: instance of the libVLC class
45      */
46     MediaPlayer( libVLC &libvlcInstance );
47
48     /**
49      * Create a media player with a media associated
50      * @param media: the associated media (the media can be safely destroy afterward)
51      */
52     MediaPlayer( Media &media );
53
54     /**
55      * Destructor
56      */
57     ~MediaPlayer();
58
59     /**
60      * Set the media associated with the player
61      * @param media: the media to associated with the player
62      */
63     void setMedia( Media &media );
64
65     /**
66      * Get the media associated with the player
67      * @return the media
68      */
69     ///@todo media();
70
71     /**
72      * Get the event manager associated to the media player
73      * @return the event manager
74      */
75     ///@todo eventManager()
76
77     /**
78      * Is the player playing
79      * @return true if the player is playing, false overwise
80      */
81     int isPlaying();
82
83     /**
84      * Play
85      */
86     void play();
87
88     /**
89      * Pause
90      */
91     void pause();
92
93     /**
94      * Stop
95      */
96     void stop();
97
98
99     /**
100      * Set the NSView handler where the media player shoud render the video
101      * @param drawable: the NSView handler
102      */
103     void setNSObject( void *drawable );
104
105     /**
106      * Get the NSView handler associated with the media player
107      * @return the NSView handler
108      */
109     void* nsobject();
110
111     /**
112      * Set the agl handler where the media player shoud render the video
113      * @param drawable: the agl handler
114      */
115     void setAgl( uint32_t drawable );
116
117     /**
118      * Get the agl handler associated with the media player
119      * @return the agl handler
120      */
121     uint32_t agl();
122
123     /**
124      * Set the X Window drawable where the media player shoud render the video
125      * @param drawable: the X Window drawable
126      */
127     void setXWindow( uint32_t drawable );
128
129     /**
130      * Get the X Window drawable associated with the media player
131      * @return the X Window drawable
132      */
133     uint32_t xwindow();
134
135     /**
136      * Set the Win32/Win64 API window handle where the media player shoud
137      * render the video
138      * @param drawable: the windows handle
139      */
140     void setHwnd( void *drawable );
141
142     /**
143      * Get the  Win32/Win64 API window handle associated with the media player
144      * @return the windows handle
145      */
146     void *hwnd();
147
148
149     /**
150      * Get the movie lenght (in ms)
151      * @return the movie length
152      */
153     int64_t lenght();
154
155     /**
156      * Get the current movie time (in ms)
157      * @return the current movie time
158      */
159     int64_t time();
160
161     /**
162       * Set the movie time (in ms)
163       * @param new_time the movie time (in ms)
164       */
165     void setTime( int64_t new_time );
166
167     /**
168       * Get the movie position (in percent)
169       * @return the movie position
170       */
171     float position();
172
173     /**
174       * Set the movie position (in percent)
175       * @param position the movie position
176       */
177     void setPosition( float position );
178
179     /**
180      * Get the current movie chapter
181      * @return the current chapter
182      */
183     int chapter();
184
185     /**
186      * Get the movie chapter count
187      * @return the movie chapter count
188      */
189     int chapterCount();
190
191     /**
192      * Get the number of chapter in the given title
193      * @param title: the title
194      * @return the number of chapter in title
195      */
196     int chapterCount( int title );
197
198     /**
199      * Set the movie chapter
200      * @param chapter: the chapter to play
201      */
202     void setChapter( int chapter );
203
204     /**
205      * Is the player going to play the media (not dead or dying)
206      * @return true if the player will play
207      */
208     int willPlay();
209
210     /**
211      * Get the current title
212      * @return the title
213      */
214     int title();
215
216     /**
217      * Get the title count
218      * @return the number of title
219      */
220     int titleCount();
221
222     /**
223      * Set the title
224      * @param title: the title
225      */
226     void setTitle( int title );
227
228
229     /**
230      * Move to the previous chapter
231      */
232     void previousChapter();
233
234     /**
235      * Move to the next chapter
236      */
237     void nextChapter();
238
239     /**
240      * Get the movie play rate
241      * @return the play rate
242      */
243     float rate();
244
245     /**
246      * Set the movie rate
247      * @param rate: the rate
248      */
249     void setRate( float rate );
250
251     /**
252      * Get the movie state
253      * @return the state
254      */
255     libvlc_state_t state();
256
257     /**
258      * Get the movie fps
259      * @return the movie fps
260      */
261     float fps();
262
263
264     /**
265      * Does the media player have a video output
266      * @return true if the media player has a video output
267      */
268     int hasVout();
269
270     /**
271      * Is the media player able to seek ?
272      * @return true if the media player can seek
273      */
274     int isSeekable();
275
276     /**
277      * Can this media player be paused ?
278      * @return true if the media player can pause
279      */
280     int canPause();
281
282     /**
283      * Display the next frame
284      */
285     void nextFrame();
286
287
288     /**
289      * Toggle fullscreen status on a non-embedded video output
290      */
291     void toggleFullscreen();
292
293     /**
294      * Enable fullscreen on a non-embedded video output
295      */
296     void enableFullscreen();
297
298     /**
299      * Disable fullscreen on a non-embedded video output
300      */
301     void disableFullscreen();
302
303     /**
304      * Get the fullscreen status
305      * @return true if the fullscreen is enable, false overwise
306      */
307     int fullscreen();
308
309     /**
310      * Get the class that handle the Audio
311      * @return the instance of Audio associated with this MediaPlayer
312      */
313     Audio &audio();
314
315     /**
316      * Get the class that handle the Video
317      * @return the instance of the Video associated with this MediaPlayer
318      */
319     Video &video();
320
321 private:
322     /** The media player instance of libvlc */
323     libvlc_media_player_t *m_player;
324
325     /** The Audio part of the media player */
326     Audio m_audio;
327
328     /** The Video part of the media player */
329     Video m_video;
330 };
331
332 };
333
334 #endif // LIBVLCPP_MEDIA_PLAYER_HPP
335