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