]> git.sesse.net Git - vlc/blob - include/vlc/libvlc_media_player.h
Add version infos to new LibVLC functions
[vlc] / include / vlc / libvlc_media_player.h
1 /*****************************************************************************
2  * libvlc_media_player.h:  libvlc_media_player external API
3  *****************************************************************************
4  * Copyright (C) 1998-2010 the VideoLAN team
5  * $Id$
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *          Jean-Paul Saman <jpsaman@videolan.org>
9  *          Pierre d'Herbemont <pdherbemont@videolan.org>
10  *
11  * This program is free software; you can redistribute it and/or modify
12  * it under the terms of the GNU General Public License as published by
13  * the Free Software Foundation; either version 2 of the License, or
14  * (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
24  *****************************************************************************/
25
26 /**
27  * \file
28  * This file defines libvlc_media_player external API
29  */
30
31 #ifndef VLC_LIBVLC_MEDIA_PLAYER_H
32 #define VLC_LIBVLC_MEDIA_PLAYER_H 1
33
34 # ifdef __cplusplus
35 extern "C" {
36 # endif
37
38 /*****************************************************************************
39  * Media Player
40  *****************************************************************************/
41 /** \defgroup libvlc_media_player LibVLC media player
42  * \ingroup libvlc
43  * A LibVLC media player plays one media (usually in a custom drawable).
44  * @{
45  */
46
47 typedef struct libvlc_media_player_t libvlc_media_player_t;
48
49 /**
50  * Description for video, audio tracks and subtitles. It contains
51  * id, name (description string) and pointer to next record.
52  */
53 typedef struct libvlc_track_description_t
54 {
55     int   i_id;
56     char *psz_name;
57     struct libvlc_track_description_t *p_next;
58
59 } libvlc_track_description_t;
60
61 /**
62  * Description for audio output. It contains
63  * name, description and pointer to next record.
64  */
65 typedef struct libvlc_audio_output_t
66 {
67     char *psz_name;
68     char *psz_description;
69     struct libvlc_audio_output_t *p_next;
70
71 } libvlc_audio_output_t;
72
73 /**
74  * Rectangle type for video geometry
75  */
76 typedef struct libvlc_rectangle_t
77 {
78     int top, left;
79     int bottom, right;
80 } libvlc_rectangle_t;
81
82 /**
83  * Marq options definition
84  */
85 typedef enum libvlc_video_marquee_option_t {
86     libvlc_marquee_Enable = 0,
87     libvlc_marquee_Text,                /** string argument */
88     libvlc_marquee_Color,
89     libvlc_marquee_Opacity,
90     libvlc_marquee_Position,
91     libvlc_marquee_Refresh,
92     libvlc_marquee_Size,
93     libvlc_marquee_Timeout,
94     libvlc_marquee_X,
95     libvlc_marquee_Y
96 } libvlc_video_marquee_option_t;
97
98 /**
99  * Create an empty Media Player object
100  *
101  * \param p_libvlc_instance the libvlc instance in which the Media Player
102  *        should be created.
103  * \return a new media player object, or NULL on error.
104  */
105 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new( libvlc_instance_t *p_libvlc_instance );
106
107 /**
108  * Create a Media Player object from a Media
109  *
110  * \param p_md the media. Afterwards the p_md can be safely
111  *        destroyed.
112  * \return a new media player object, or NULL on error.
113  */
114 VLC_PUBLIC_API libvlc_media_player_t * libvlc_media_player_new_from_media( libvlc_media_t *p_md );
115
116 /**
117  * Release a media_player after use
118  * Decrement the reference count of a media player object. If the
119  * reference count is 0, then libvlc_media_player_release() will
120  * release the media player object. If the media player object
121  * has been released, then it should not be used again.
122  *
123  * \param p_mi the Media Player to free
124  */
125 VLC_PUBLIC_API void libvlc_media_player_release( libvlc_media_player_t *p_mi );
126
127 /**
128  * Retain a reference to a media player object. Use
129  * libvlc_media_player_release() to decrement reference count.
130  *
131  * \param p_mi media player object
132  */
133 VLC_PUBLIC_API void libvlc_media_player_retain( libvlc_media_player_t *p_mi );
134
135 /**
136  * Set the media that will be used by the media_player. If any,
137  * previous md will be released.
138  *
139  * \param p_mi the Media Player
140  * \param p_md the Media. Afterwards the p_md can be safely
141  *        destroyed.
142  */
143 VLC_PUBLIC_API void libvlc_media_player_set_media( libvlc_media_player_t *p_mi,
144                                                    libvlc_media_t *p_md );
145
146 /**
147  * Get the media used by the media_player.
148  *
149  * \param p_mi the Media Player
150  * \return the media associated with p_mi, or NULL if no
151  *         media is associated
152  */
153 VLC_PUBLIC_API libvlc_media_t * libvlc_media_player_get_media( libvlc_media_player_t *p_mi );
154
155 /**
156  * Get the Event Manager from which the media player send event.
157  *
158  * \param p_mi the Media Player
159  * \return the event manager associated with p_mi
160  */
161 VLC_PUBLIC_API libvlc_event_manager_t * libvlc_media_player_event_manager ( libvlc_media_player_t *p_mi );
162
163 /**
164  * is_playing
165  *
166  * \param p_mi the Media Player
167  * \return 1 if the media player is playing, 0 otherwise
168  */
169 VLC_PUBLIC_API int libvlc_media_player_is_playing ( libvlc_media_player_t *p_mi );
170
171 /**
172  * Play
173  *
174  * \param p_mi the Media Player
175  * \return 0 if playback started (and was already started), or -1 on error.
176  */
177 VLC_PUBLIC_API int libvlc_media_player_play ( libvlc_media_player_t *p_mi );
178
179 /**
180  * Pause or resume (no effect if there is no media)
181  *
182  * \param mp the Media Player
183  * \param do_pause play/resume if zero, pause if non-zero
184  * \version LibVLC 1.1.1 or later
185  */
186 VLC_PUBLIC_API void libvlc_media_player_set_pause ( libvlc_media_player_t *mp,
187                                                     int do_pause );
188
189 /**
190  * Toggle pause (no effect if there is no media)
191  *
192  * \param p_mi the Media Player
193  */
194 VLC_PUBLIC_API void libvlc_media_player_pause ( libvlc_media_player_t *p_mi );
195
196 /**
197  * Stop (no effect if there is no media)
198  *
199  * \param p_mi the Media Player
200  */
201 VLC_PUBLIC_API void libvlc_media_player_stop ( libvlc_media_player_t *p_mi );
202
203 /**
204  * Set the NSView handler where the media player should render its video output.
205  *
206  * Use the vout called "macosx".
207  *
208  * The drawable is an NSObject that follow the VLCOpenGLVideoViewEmbedding
209  * protocol:
210  *
211  * @begincode
212  * \@protocol VLCOpenGLVideoViewEmbedding <NSObject>
213  * - (void)addVoutSubview:(NSView *)view;
214  * - (void)removeVoutSubview:(NSView *)view;
215  * \@end
216  * @endcode
217  *
218  * Or it can be an NSView object.
219  *
220  * If you want to use it along with Qt4 see the QMacCocoaViewContainer. Then
221  * the following code should work:
222  * @begincode
223  * {
224  *     NSView *video = [[NSView alloc] init];
225  *     QMacCocoaViewContainer *container = new QMacCocoaViewContainer(video, parent);
226  *     libvlc_media_player_set_nsobject(mp, video);
227  *     [video release];
228  * }
229  * @endcode
230  *
231  * You can find a live example in VLCVideoView in VLCKit.framework.
232  *
233  * \param p_mi the Media Player
234  * \param drawable the drawable that is either an NSView or an object following
235  * the VLCOpenGLVideoViewEmbedding protocol.
236  */
237 VLC_PUBLIC_API void libvlc_media_player_set_nsobject ( libvlc_media_player_t *p_mi, void * drawable );
238
239 /**
240  * Get the NSView handler previously set with libvlc_media_player_set_nsobject().
241  *
242  * \param p_mi the Media Player
243  * \return the NSView handler or 0 if none where set
244  */
245 VLC_PUBLIC_API void * libvlc_media_player_get_nsobject ( libvlc_media_player_t *p_mi );
246
247 /**
248  * Set the agl handler where the media player should render its video output.
249  *
250  * \param p_mi the Media Player
251  * \param drawable the agl handler
252  */
253 VLC_PUBLIC_API void libvlc_media_player_set_agl ( libvlc_media_player_t *p_mi, uint32_t drawable );
254
255 /**
256  * Get the agl handler previously set with libvlc_media_player_set_agl().
257  *
258  * \param p_mi the Media Player
259  * \return the agl handler or 0 if none where set
260  */
261 VLC_PUBLIC_API uint32_t libvlc_media_player_get_agl ( libvlc_media_player_t *p_mi );
262
263 /**
264  * Set an X Window System drawable where the media player should render its
265  * video output. If LibVLC was built without X11 output support, then this has
266  * no effects.
267  *
268  * The specified identifier must correspond to an existing Input/Output class
269  * X11 window. Pixmaps are <b>not</b> supported. The caller shall ensure that
270  * the X11 server is the same as the one the VLC instance has been configured
271  * with.
272  * If XVideo is <b>not</b> used, it is assumed that the drawable has the
273  * following properties in common with the default X11 screen: depth, scan line
274  * pad, black pixel. This is a bug.
275  *
276  * \param p_mi the Media Player
277  * \param drawable the ID of the X window
278  */
279 VLC_PUBLIC_API void libvlc_media_player_set_xwindow ( libvlc_media_player_t *p_mi, uint32_t drawable );
280
281 /**
282  * Get the X Window System window identifier previously set with
283  * libvlc_media_player_set_xwindow(). Note that this will return the identifier
284  * even if VLC is not currently using it (for instance if it is playing an
285  * audio-only input).
286  *
287  * \param p_mi the Media Player
288  * \return an X window ID, or 0 if none where set.
289  */
290 VLC_PUBLIC_API uint32_t libvlc_media_player_get_xwindow ( libvlc_media_player_t *p_mi );
291
292 /**
293  * Set a Win32/Win64 API window handle (HWND) where the media player should
294  * render its video output. If LibVLC was built without Win32/Win64 API output
295  * support, then this has no effects.
296  *
297  * \param p_mi the Media Player
298  * \param drawable windows handle of the drawable
299  */
300 VLC_PUBLIC_API void libvlc_media_player_set_hwnd ( libvlc_media_player_t *p_mi, void *drawable );
301
302 /**
303  * Get the Windows API window handle (HWND) previously set with
304  * libvlc_media_player_set_hwnd(). The handle will be returned even if LibVLC
305  * is not currently outputting any video to it.
306  *
307  * \param p_mi the Media Player
308  * \return a window handle or NULL if there are none.
309  */
310 VLC_PUBLIC_API void *libvlc_media_player_get_hwnd ( libvlc_media_player_t *p_mi );
311
312
313
314 /** \bug This might go away ... to be replaced by a broader system */
315
316 /**
317  * Get the current movie length (in ms).
318  *
319  * \param p_mi the Media Player
320  * \return the movie length (in ms), or -1 if there is no media.
321  */
322 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_length( libvlc_media_player_t *p_mi );
323
324 /**
325  * Get the current movie time (in ms).
326  *
327  * \param p_mi the Media Player
328  * \return the movie time (in ms), or -1 if there is no media.
329  */
330 VLC_PUBLIC_API libvlc_time_t libvlc_media_player_get_time( libvlc_media_player_t *p_mi );
331
332 /**
333  * Set the movie time (in ms). This has no effect if no media is being played.
334  * Not all formats and protocols support this.
335  *
336  * \param p_mi the Media Player
337  * \param i_time the movie time (in ms).
338  */
339 VLC_PUBLIC_API void libvlc_media_player_set_time( libvlc_media_player_t *p_mi, libvlc_time_t i_time );
340
341 /**
342  * Get movie position.
343  *
344  * \param p_mi the Media Player
345  * \return movie position, or -1. in case of error
346  */
347 VLC_PUBLIC_API float libvlc_media_player_get_position( libvlc_media_player_t *p_mi );
348
349 /**
350  * Set movie position. This has no effect if playback is not enabled.
351  * This might not work depending on the underlying input format and protocol.
352  *
353  * \param p_mi the Media Player
354  * \param f_pos the position
355  */
356 VLC_PUBLIC_API void libvlc_media_player_set_position( libvlc_media_player_t *p_mi, float f_pos );
357
358 /**
359  * Set movie chapter (if applicable).
360  *
361  * \param p_mi the Media Player
362  * \param i_chapter chapter number to play
363  */
364 VLC_PUBLIC_API void libvlc_media_player_set_chapter( libvlc_media_player_t *p_mi, int i_chapter );
365
366 /**
367  * Get movie chapter.
368  *
369  * \param p_mi the Media Player
370  * \return chapter number currently playing, or -1 if there is no media.
371  */
372 VLC_PUBLIC_API int libvlc_media_player_get_chapter( libvlc_media_player_t *p_mi );
373
374 /**
375  * Get movie chapter count
376  *
377  * \param p_mi the Media Player
378  * \return number of chapters in movie, or -1.
379  */
380 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count( libvlc_media_player_t *p_mi );
381
382 /**
383  * Is the player able to play
384  *
385  * \param p_mi the Media Player
386  * \return boolean
387  */
388 VLC_PUBLIC_API int libvlc_media_player_will_play( libvlc_media_player_t *p_mi );
389
390 /**
391  * Get title chapter count
392  *
393  * \param p_mi the Media Player
394  * \param i_title title
395  * \return number of chapters in title, or -1
396  */
397 VLC_PUBLIC_API int libvlc_media_player_get_chapter_count_for_title(
398                        libvlc_media_player_t *p_mi, int i_title );
399
400 /**
401  * Set movie title
402  *
403  * \param p_mi the Media Player
404  * \param i_title title number to play
405  */
406 VLC_PUBLIC_API void libvlc_media_player_set_title( libvlc_media_player_t *p_mi, int i_title );
407
408 /**
409  * Get movie title
410  *
411  * \param p_mi the Media Player
412  * \return title number currently playing, or -1
413  */
414 VLC_PUBLIC_API int libvlc_media_player_get_title( libvlc_media_player_t *p_mi );
415
416 /**
417  * Get movie title count
418  *
419  * \param p_mi the Media Player
420  * \return title number count, or -1
421  */
422 VLC_PUBLIC_API int libvlc_media_player_get_title_count( libvlc_media_player_t *p_mi );
423
424 /**
425  * Set previous chapter (if applicable)
426  *
427  * \param p_mi the Media Player
428  */
429 VLC_PUBLIC_API void libvlc_media_player_previous_chapter( libvlc_media_player_t *p_mi );
430
431 /**
432  * Set next chapter (if applicable)
433  *
434  * \param p_mi the Media Player
435  */
436 VLC_PUBLIC_API void libvlc_media_player_next_chapter( libvlc_media_player_t *p_mi );
437
438 /**
439  * Get the requested movie play rate.
440  * @warning Depending on the underlying media, the requested rate may be
441  * different from the real playback rate.
442  *
443  * \param p_mi the Media Player
444  * \return movie play rate
445  */
446 VLC_PUBLIC_API float libvlc_media_player_get_rate( libvlc_media_player_t *p_mi );
447
448 /**
449  * Set movie play rate
450  *
451  * \param p_mi the Media Player
452  * \param rate movie play rate to set
453  * \return -1 if an error was detected, 0 otherwise (but even then, it might
454  * not actually work depending on the underlying media protocol)
455  */
456 VLC_PUBLIC_API int libvlc_media_player_set_rate( libvlc_media_player_t *p_mi, float rate );
457
458 /**
459  * Get current movie state
460  *
461  * \param p_mi the Media Player
462  * \return the current state of the media player (playing, paused, ...) \see libvlc_state_t
463  */
464 VLC_PUBLIC_API libvlc_state_t libvlc_media_player_get_state( libvlc_media_player_t *p_mi );
465
466 /**
467  * Get movie fps rate
468  *
469  * \param p_mi the Media Player
470  * \return frames per second (fps) for this playing movie, or 0 if unspecified
471  */
472 VLC_PUBLIC_API float libvlc_media_player_get_fps( libvlc_media_player_t *p_mi );
473
474 /** end bug */
475
476 /**
477  * How many video outputs does this media player have?
478  *
479  * \param p_mi the media player
480  * \return the number of video outputs
481  */
482 VLC_PUBLIC_API unsigned libvlc_media_player_has_vout( libvlc_media_player_t *p_mi );
483
484 /**
485  * Is this media player seekable?
486  *
487  * \param p_mi the media player
488  * \return true if the media player can seek
489  */
490 VLC_PUBLIC_API int libvlc_media_player_is_seekable( libvlc_media_player_t *p_mi );
491
492 /**
493  * Can this media player be paused?
494  *
495  * \param p_mi the media player
496  * \return true if the media player can pause
497  */
498 VLC_PUBLIC_API int libvlc_media_player_can_pause( libvlc_media_player_t *p_mi );
499
500
501 /**
502  * Display the next frame (if supported)
503  *
504  * \param p_mi the media player
505  */
506 VLC_PUBLIC_API void libvlc_media_player_next_frame( libvlc_media_player_t *p_mi );
507
508
509
510 /**
511  * Release (free) libvlc_track_description_t
512  *
513  * \param p_track_description the structure to release
514  */
515 VLC_PUBLIC_API void libvlc_track_description_release( libvlc_track_description_t *p_track_description );
516
517 /** \defgroup libvlc_video LibVLC video controls
518  * @{
519  */
520
521 /**
522  * Toggle fullscreen status on non-embedded video outputs.
523  *
524  * @warning The same limitations applies to this function
525  * as to libvlc_set_fullscreen().
526  *
527  * \param p_mi the media player
528  */
529 VLC_PUBLIC_API void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi );
530
531 /**
532  * Enable or disable fullscreen.
533  *
534  * @warning With most window managers, only a top-level windows can be in
535  * full-screen mode. Hence, this function will not operate properly if
536  * libvlc_media_player_set_xid() was used to embed the video in a non-top-level
537  * window. In that case, the embedding window must be reparented to the root
538  * window <b>before</b> fullscreen mode is enabled. You will want to reparent
539  * it back to its normal parent when disabling fullscreen.
540  *
541  * \param p_mi the media player
542  * \param b_fullscreen boolean for fullscreen status
543  */
544 VLC_PUBLIC_API void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen );
545
546 /**
547  * Get current fullscreen status.
548  *
549  * \param p_mi the media player
550  * \return the fullscreen status (boolean)
551  */
552 VLC_PUBLIC_API int libvlc_get_fullscreen( libvlc_media_player_t *p_mi );
553
554 /**
555  * Enable or disable key press events handling, according to the LibVLC hotkeys
556  * configuration. By default and for historical reasons, keyboard events are
557  * handled by the LibVLC video widget.
558  *
559  * \note On X11, there can be only one subscriber for key press and mouse
560  * click events per window. If your application has subscribed to those events
561  * for the X window ID of the video widget, then LibVLC will not be able to
562  * handle key presses and mouse clicks in any case.
563  *
564  * \warning This function is only implemented for X11 and Win32 at the moment.
565  *
566  * \param p_mi the media player
567  * \param on true to handle key press events, false to ignore them.
568  */
569 VLC_PUBLIC_API
570 void libvlc_video_set_key_input( libvlc_media_player_t *p_mi, unsigned on );
571
572 /**
573  * Enable or disable mouse click events handling. By default, those events are
574  * handled. This is needed for DVD menus to work, as well as a few video
575  * filters such as "puzzle".
576  *
577  * \note See also libvlc_video_set_key_input().
578  *
579  * \warning This function is only implemented for X11 and Win32 at the moment.
580  *
581  * \param p_mi the media player
582  * \param on true to handle mouse click events, false to ignore them.
583  */
584 VLC_PUBLIC_API
585 void libvlc_video_set_mouse_input( libvlc_media_player_t *p_mi, unsigned on );
586
587 /**
588  * Get the pixel dimensions of a video.
589  *
590  * \param p_mi media player
591  * \param num number of the video (starting from, and most commonly 0)
592  * \param px pointer to get the pixel width [OUT]
593  * \param py pointer to get the pixel height [OUT]
594  * \return 0 on success, -1 if the specified video does not exist
595  */
596 VLC_PUBLIC_API
597 int libvlc_video_get_size( libvlc_media_player_t *p_mi, unsigned num,
598                            unsigned *px, unsigned *py );
599
600 /**
601  * Get current video height.
602  * You should use libvlc_video_get_size() instead.
603  *
604  * \param p_mi the media player
605  * \return the video pixel height or 0 if not applicable
606  */
607 VLC_DEPRECATED_API
608 int libvlc_video_get_height( libvlc_media_player_t *p_mi );
609
610 /**
611  * Get current video width.
612  * You should use libvlc_video_get_size() instead.
613  *
614  * \param p_mi the media player
615  * \return the video pixel width or 0 if not applicable
616  */
617 VLC_DEPRECATED_API
618 int libvlc_video_get_width( libvlc_media_player_t *p_mi );
619
620 /**
621  * Get the mouse pointer coordinates over a video.
622  * Coordinates are expressed in terms of the decoded video resolution,
623  * <b>not</b> in terms of pixels on the screen/viewport (to get the latter,
624  * you can query your windowing system directly).
625  *
626  * Either of the coordinates may be negative or larger than the corresponding
627  * dimension of the video, if the cursor is outside the rendering area.
628  *
629  * @warning The coordinates may be out-of-date if the pointer is not located
630  * on the video rendering area. LibVLC does not track the pointer if it is
631  * outside of the video widget.
632  *
633  * @note LibVLC does not support multiple pointers (it does of course support
634  * multiple input devices sharing the same pointer) at the moment.
635  *
636  * \param p_mi media player
637  * \param num number of the video (starting from, and most commonly 0)
638  * \param px pointer to get the abscissa [OUT]
639  * \param py pointer to get the ordinate [OUT]
640  * \return 0 on success, -1 if the specified video does not exist
641  */
642 VLC_PUBLIC_API
643 int libvlc_video_get_cursor( libvlc_media_player_t *p_mi, unsigned num,
644                              int *px, int *py );
645
646 /**
647  * Get the current video scaling factor.
648  * See also libvlc_video_set_scale().
649  *
650  * \param p_mi the media player
651  * \return the currently configured zoom factor, or 0. if the video is set
652  * to fit to the output window/drawable automatically.
653  */
654 VLC_PUBLIC_API float libvlc_video_get_scale( libvlc_media_player_t *p_mi );
655
656 /**
657  * Set the video scaling factor. That is the ratio of the number of pixels on
658  * screen to the number of pixels in the original decoded video in each
659  * dimension. Zero is a special value; it will adjust the video to the output
660  * window/drawable (in windowed mode) or the entire screen.
661  *
662  * Note that not all video outputs support scaling.
663  *
664  * \param p_mi the media player
665  * \param f_factor the scaling factor, or zero
666  */
667 VLC_PUBLIC_API void libvlc_video_set_scale( libvlc_media_player_t *p_mi, float f_factor );
668
669 /**
670  * Get current video aspect ratio.
671  *
672  * \param p_mi the media player
673  * \return the video aspect ratio or NULL if unspecified
674  * (the result must be released with free()).
675  */
676 VLC_PUBLIC_API char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi );
677
678 /**
679  * Set new video aspect ratio.
680  *
681  * \param p_mi the media player
682  * \param psz_aspect new video aspect-ratio or NULL to reset to default
683  * \note Invalid aspect ratios are ignored.
684  */
685 VLC_PUBLIC_API void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi, const char *psz_aspect );
686
687 /**
688  * Get current video subtitle.
689  *
690  * \param p_mi the media player
691  * \return the video subtitle selected, or -1 if none
692  */
693 VLC_PUBLIC_API int libvlc_video_get_spu( libvlc_media_player_t *p_mi );
694
695 /**
696  * Get the number of available video subtitles.
697  *
698  * \param p_mi the media player
699  * \return the number of available video subtitles
700  */
701 VLC_PUBLIC_API int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi );
702
703 /**
704  * Get the description of available video subtitles.
705  *
706  * \param p_mi the media player
707  * \return list containing description of available video subtitles
708  */
709 VLC_PUBLIC_API libvlc_track_description_t *
710         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi );
711
712 /**
713  * Set new video subtitle.
714  *
715  * \param p_mi the media player
716  * \param i_spu new video subtitle to select
717  * \return 0 on success, -1 if out of range
718  */
719 VLC_PUBLIC_API int libvlc_video_set_spu( libvlc_media_player_t *p_mi, unsigned i_spu );
720
721 /**
722  * Set new video subtitle file.
723  *
724  * \param p_mi the media player
725  * \param psz_subtitle new video subtitle file
726  * \return the success status (boolean)
727  */
728 VLC_PUBLIC_API int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi, const char *psz_subtitle );
729
730 /**
731  * Get the description of available titles.
732  *
733  * \param p_mi the media player
734  * \return list containing description of available titles
735  */
736 VLC_PUBLIC_API libvlc_track_description_t *
737         libvlc_video_get_title_description( libvlc_media_player_t *p_mi );
738
739 /**
740  * Get the description of available chapters for specific title.
741  *
742  * \param p_mi the media player
743  * \param i_title selected title
744  * \return list containing description of available chapter for title i_title
745  */
746 VLC_PUBLIC_API libvlc_track_description_t *
747         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi, int i_title );
748
749 /**
750  * Get current crop filter geometry.
751  *
752  * \param p_mi the media player
753  * \return the crop filter geometry or NULL if unset
754  */
755 VLC_PUBLIC_API char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi );
756
757 /**
758  * Set new crop filter geometry.
759  *
760  * \param p_mi the media player
761  * \param psz_geometry new crop filter geometry (NULL to unset)
762  */
763 VLC_PUBLIC_API
764 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi, const char *psz_geometry );
765
766 /**
767  * Get current teletext page requested.
768  *
769  * \param p_mi the media player
770  * \return the current teletext page requested.
771  */
772 VLC_PUBLIC_API int libvlc_video_get_teletext( libvlc_media_player_t *p_mi );
773
774 /**
775  * Set new teletext page to retrieve.
776  *
777  * \param p_mi the media player
778  * \param i_page teletex page number requested
779  */
780 VLC_PUBLIC_API void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page );
781
782 /**
783  * Toggle teletext transparent status on video output.
784  *
785  * \param p_mi the media player
786  */
787 VLC_PUBLIC_API void libvlc_toggle_teletext( libvlc_media_player_t *p_mi );
788
789 /**
790  * Get number of available video tracks.
791  *
792  * \param p_mi media player
793  * \return the number of available video tracks (int)
794  */
795 VLC_PUBLIC_API int libvlc_video_get_track_count( libvlc_media_player_t *p_mi );
796
797 /**
798  * Get the description of available video tracks.
799  *
800  * \param p_mi media player
801  * \return list with description of available video tracks, or NULL on error
802  */
803 VLC_PUBLIC_API libvlc_track_description_t *
804         libvlc_video_get_track_description( libvlc_media_player_t *p_mi );
805
806 /**
807  * Get current video track.
808  *
809  * \param p_mi media player
810  * \return the video track (int) or -1 if none
811  */
812 VLC_PUBLIC_API int libvlc_video_get_track( libvlc_media_player_t *p_mi );
813
814 /**
815  * Set video track.
816  *
817  * \param p_mi media player
818  * \param i_track the track (int)
819  * \return 0 on success, -1 if out of range
820  */
821 VLC_PUBLIC_API
822 int libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track );
823
824 /**
825  * Take a snapshot of the current video window.
826  *
827  * If i_width AND i_height is 0, original size is used.
828  * If i_width XOR i_height is 0, original aspect-ratio is preserved.
829  *
830  * \param p_mi media player instance
831  * \param num number of video output (typically 0 for the first/only one)
832  * \param psz_filepath the path where to save the screenshot to
833  * \param i_width the snapshot's width
834  * \param i_height the snapshot's height
835  * \return 0 on success, -1 if the video was not found
836  */
837 VLC_PUBLIC_API
838 int libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, unsigned num,
839                                 const char *psz_filepath, unsigned int i_width,
840                                 unsigned int i_height );
841
842 /**
843  * Enable or disable deinterlace filter
844  *
845  * \param p_mi libvlc media player
846  * \param psz_mode type of deinterlace filter, NULL to disable
847  */
848 VLC_PUBLIC_API void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi,
849                                                   const char *psz_mode );
850
851 /**
852  * Get an integer marquee option value
853  *
854  * \param p_mi libvlc media player
855  * \param option marq option to get \see libvlc_video_marquee_int_option_t
856  */
857 VLC_PUBLIC_API int libvlc_video_get_marquee_int( libvlc_media_player_t *p_mi,
858                                                  unsigned option );
859
860 /**
861  * Get a string marquee option value
862  *
863  * \param p_mi libvlc media player
864  * \param option marq option to get \see libvlc_video_marquee_string_option_t
865  */
866 VLC_PUBLIC_API char *libvlc_video_get_marquee_string( libvlc_media_player_t *p_mi,
867                                                       unsigned option );
868
869 /**
870  * Enable, disable or set an integer marquee option
871  *
872  * Setting libvlc_marquee_Enable has the side effect of enabling (arg !0)
873  * or disabling (arg 0) the marq filter.
874  *
875  * \param p_mi libvlc media player
876  * \param option marq option to set \see libvlc_video_marquee_int_option_t
877  * \param i_val marq option value
878  */
879 VLC_PUBLIC_API void libvlc_video_set_marquee_int( libvlc_media_player_t *p_mi,
880                                                   unsigned option, int i_val );
881
882 /**
883  * Set a marquee string option
884  *
885  * \param p_mi libvlc media player
886  * \param option marq option to set \see libvlc_video_marquee_string_option_t
887  * \param psz_text marq option value
888  */
889 VLC_PUBLIC_API void libvlc_video_set_marquee_string( libvlc_media_player_t *p_mi,
890                                                      unsigned option, const char *psz_text );
891
892 /** option values for libvlc_video_{get,set}_logo_{int,string} */
893 enum libvlc_video_logo_option_t {
894     libvlc_logo_enable,
895     libvlc_logo_file,           /**< string argument, "file,d,t;file,d,t;..." */
896     libvlc_logo_x,
897     libvlc_logo_y,
898     libvlc_logo_delay,
899     libvlc_logo_repeat,
900     libvlc_logo_opacity,
901     libvlc_logo_position,
902 };
903
904 /**
905  * Get integer logo option.
906  *
907  * \param p_mi libvlc media player instance
908  * \param option logo option to get, values of libvlc_video_logo_option_t
909  */
910 VLC_PUBLIC_API int libvlc_video_get_logo_int( libvlc_media_player_t *p_mi,
911                                               unsigned option );
912
913 /**
914  * Set logo option as integer. Options that take a different type value
915  * are ignored.
916  * Passing libvlc_logo_enable as option value has the side effect of
917  * starting (arg !0) or stopping (arg 0) the logo filter.
918  *
919  * \param p_mi libvlc media player instance
920  * \param option logo option to set, values of libvlc_video_logo_option_t
921  * \param value logo option value
922  */
923 VLC_PUBLIC_API void libvlc_video_set_logo_int( libvlc_media_player_t *p_mi,
924                                                unsigned option, int value );
925
926 /**
927  * Set logo option as string. Options that take a different type value
928  * are ignored.
929  *
930  * \param p_mi libvlc media player instance
931  * \param option logo option to set, values of libvlc_video_logo_option_t
932  * \param psz_value logo option value
933  */
934 VLC_PUBLIC_API void libvlc_video_set_logo_string( libvlc_media_player_t *p_mi,
935                                       unsigned option, const char *psz_value );
936
937
938 /** option values for libvlc_video_{get,set}_adjust_{int,float,bool} */
939 enum libvlc_video_adjust_option_t {
940     libvlc_adjust_Enable = 0,
941     libvlc_adjust_Contrast,
942     libvlc_adjust_Brightness,
943     libvlc_adjust_Hue,
944     libvlc_adjust_Saturation,
945     libvlc_adjust_Gamma,
946 };
947
948 /**
949  * Get integer adjust option.
950  *
951  * \param p_mi libvlc media player instance
952  * \param option adjust option to get, values of libvlc_video_adjust_option_t
953  * \version LibVLC 1.1.1 and later.
954  */
955 VLC_PUBLIC_API int libvlc_video_get_adjust_int( libvlc_media_player_t *p_mi,
956                                                 unsigned option );
957
958 /**
959  * Set adjust option as integer. Options that take a different type value
960  * are ignored.
961  * Passing libvlc_adjust_enable as option value has the side effect of
962  * starting (arg !0) or stopping (arg 0) the adjust filter.
963  *
964  * \param p_mi libvlc media player instance
965  * \param option adust option to set, values of libvlc_video_adjust_option_t
966  * \param value adjust option value
967  * \version LibVLC 1.1.1 and later.
968  */
969 VLC_PUBLIC_API void libvlc_video_set_adjust_int( libvlc_media_player_t *p_mi,
970                                                  unsigned option, int value );
971
972 /**
973  * Get float adjust option.
974  *
975  * \param p_mi libvlc media player instance
976  * \param option adjust option to get, values of libvlc_video_adjust_option_t
977  * \version LibVLC 1.1.1 and later.
978  */
979 VLC_PUBLIC_API float libvlc_video_get_adjust_float( libvlc_media_player_t *p_mi,
980                                                     unsigned option );
981
982 /**
983  * Set adjust option as float. Options that take a different type value
984  * are ignored.
985  *
986  * \param p_mi libvlc media player instance
987  * \param option adust option to set, values of libvlc_video_adjust_option_t
988  * \param value adjust option value
989  * \version LibVLC 1.1.1 and later.
990  */
991 VLC_PUBLIC_API void libvlc_video_set_adjust_float( libvlc_media_player_t *p_mi,
992                                                    unsigned option, float value );
993
994 /** @} video */
995
996 /** \defgroup libvlc_audio LibVLC audio controls
997  * @{
998  */
999
1000 /**
1001  * Audio device types
1002  */
1003 typedef enum libvlc_audio_output_device_types_t {
1004     libvlc_AudioOutputDevice_Error  = -1,
1005     libvlc_AudioOutputDevice_Mono   =  1,
1006     libvlc_AudioOutputDevice_Stereo =  2,
1007     libvlc_AudioOutputDevice_2F2R   =  4,
1008     libvlc_AudioOutputDevice_3F2R   =  5,
1009     libvlc_AudioOutputDevice_5_1    =  6,
1010     libvlc_AudioOutputDevice_6_1    =  7,
1011     libvlc_AudioOutputDevice_7_1    =  8,
1012     libvlc_AudioOutputDevice_SPDIF  = 10
1013 } libvlc_audio_output_device_types_t;
1014
1015 /**
1016  * Audio channels
1017  */
1018 typedef enum libvlc_audio_output_channel_t {
1019     libvlc_AudioChannel_Error   = -1,
1020     libvlc_AudioChannel_Stereo  =  1,
1021     libvlc_AudioChannel_RStereo =  2,
1022     libvlc_AudioChannel_Left    =  3,
1023     libvlc_AudioChannel_Right   =  4,
1024     libvlc_AudioChannel_Dolbys  =  5
1025 } libvlc_audio_output_channel_t;
1026
1027
1028 /**
1029  * Get the list of available audio outputs
1030  *
1031  * \param p_instance libvlc instance
1032  * \return list of available audio outputs. It must be freed it with
1033 *          \see libvlc_audio_output_list_release \see libvlc_audio_output_t .
1034  *         In case of error, NULL is returned.
1035  */
1036 VLC_PUBLIC_API libvlc_audio_output_t *
1037         libvlc_audio_output_list_get( libvlc_instance_t *p_instance );
1038
1039 /**
1040  * Free the list of available audio outputs
1041  *
1042  * \param p_list list with audio outputs for release
1043  */
1044 VLC_PUBLIC_API void libvlc_audio_output_list_release( libvlc_audio_output_t *p_list );
1045
1046 /**
1047  * Set the audio output.
1048  * Change will be applied after stop and play.
1049  *
1050  * \param p_mi media player
1051  * \param psz_name name of audio output,
1052  *               use psz_name of \see libvlc_audio_output_t
1053  * \return true if function succeded
1054  */
1055 VLC_PUBLIC_API int libvlc_audio_output_set( libvlc_media_player_t *p_mi,
1056                                             const char *psz_name );
1057
1058 /**
1059  * Get count of devices for audio output, these devices are hardware oriented
1060  * like analor or digital output of sound card
1061  *
1062  * \param p_instance libvlc instance
1063  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1064  * \return number of devices
1065  */
1066 VLC_PUBLIC_API int libvlc_audio_output_device_count( libvlc_instance_t *p_instance,
1067                                                      const char *psz_audio_output );
1068
1069 /**
1070  * Get long name of device, if not available short name given
1071  *
1072  * \param p_instance libvlc instance
1073  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1074  * \param i_device device index
1075  * \return long name of device
1076  */
1077 VLC_PUBLIC_API char * libvlc_audio_output_device_longname( libvlc_instance_t *p_instance,
1078                                                            const char *psz_audio_output,
1079                                                            int i_device );
1080
1081 /**
1082  * Get id name of device
1083  *
1084  * \param p_instance libvlc instance
1085  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1086  * \param i_device device index
1087  * \return id name of device, use for setting device, need to be free after use
1088  */
1089 VLC_PUBLIC_API char * libvlc_audio_output_device_id( libvlc_instance_t *p_instance,
1090                                                      const char *psz_audio_output,
1091                                                      int i_device );
1092
1093 /**
1094  * Set audio output device. Changes are only effective after stop and play.
1095  *
1096  * \param p_mi media player
1097  * \param psz_audio_output - name of audio output, \see libvlc_audio_output_t
1098  * \param psz_device_id device
1099  */
1100 VLC_PUBLIC_API void libvlc_audio_output_device_set( libvlc_media_player_t *p_mi,
1101                                                     const char *psz_audio_output,
1102                                                     const char *psz_device_id );
1103
1104 /**
1105  * Get current audio device type. Device type describes something like
1106  * character of output sound - stereo sound, 2.1, 5.1 etc
1107  *
1108  * \param p_mi media player
1109  * \return the audio devices type \see libvlc_audio_output_device_types_t
1110  */
1111 VLC_PUBLIC_API int libvlc_audio_output_get_device_type( libvlc_media_player_t *p_mi );
1112
1113 /**
1114  * Set current audio device type.
1115  *
1116  * \param p_mi vlc instance
1117  * \param device_type the audio device type,
1118           according to \see libvlc_audio_output_device_types_t
1119  */
1120 VLC_PUBLIC_API void libvlc_audio_output_set_device_type( libvlc_media_player_t *p_mi,
1121                                                          int device_type );
1122
1123
1124 /**
1125  * Toggle mute status.
1126  *
1127  * \param p_mi media player
1128  */
1129 VLC_PUBLIC_API void libvlc_audio_toggle_mute( libvlc_media_player_t *p_mi );
1130
1131 /**
1132  * Get current mute status.
1133  *
1134  * \param p_mi media player
1135  * \return the mute status (boolean)
1136  */
1137 VLC_PUBLIC_API int libvlc_audio_get_mute( libvlc_media_player_t *p_mi );
1138
1139 /**
1140  * Set mute status.
1141  *
1142  * \param p_mi media player
1143  * \param status If status is true then mute, otherwise unmute
1144  */
1145 VLC_PUBLIC_API void libvlc_audio_set_mute( libvlc_media_player_t *p_mi, int status );
1146
1147 /**
1148  * Get current audio level.
1149  *
1150  * \param p_mi media player
1151  * \return the audio level (int)
1152  */
1153 VLC_PUBLIC_API int libvlc_audio_get_volume( libvlc_media_player_t *p_mi );
1154
1155 /**
1156  * Set current audio level.
1157  *
1158  * \param p_mi media player
1159  * \param i_volume the volume (int)
1160  * \return 0 if the volume was set, -1 if it was out of range
1161  */
1162 VLC_PUBLIC_API int libvlc_audio_set_volume( libvlc_media_player_t *p_mi, int i_volume );
1163
1164 /**
1165  * Get number of available audio tracks.
1166  *
1167  * \param p_mi media player
1168  * \return the number of available audio tracks (int), or -1 if unavailable
1169  */
1170 VLC_PUBLIC_API int libvlc_audio_get_track_count( libvlc_media_player_t *p_mi );
1171
1172 /**
1173  * Get the description of available audio tracks.
1174  *
1175  * \param p_mi media player
1176  * \return list with description of available audio tracks, or NULL
1177  */
1178 VLC_PUBLIC_API libvlc_track_description_t *
1179         libvlc_audio_get_track_description( libvlc_media_player_t *p_mi );
1180
1181 /**
1182  * Get current audio track.
1183  *
1184  * \param p_mi media player
1185  * \return the audio track (int), or -1 if none.
1186  */
1187 VLC_PUBLIC_API int libvlc_audio_get_track( libvlc_media_player_t *p_mi );
1188
1189 /**
1190  * Set current audio track.
1191  *
1192  * \param p_mi media player
1193  * \param i_track the track (int)
1194  * \return 0 on success, -1 on error
1195  */
1196 VLC_PUBLIC_API int libvlc_audio_set_track( libvlc_media_player_t *p_mi, int i_track );
1197
1198 /**
1199  * Get current audio channel.
1200  *
1201  * \param p_mi media player
1202  * \return the audio channel \see libvlc_audio_output_channel_t
1203  */
1204 VLC_PUBLIC_API int libvlc_audio_get_channel( libvlc_media_player_t *p_mi );
1205
1206 /**
1207  * Set current audio channel.
1208  *
1209  * \param p_mi media player
1210  * \param channel the audio channel, \see libvlc_audio_output_channel_t
1211  * \return 0 on success, -1 on error
1212  */
1213 VLC_PUBLIC_API int libvlc_audio_set_channel( libvlc_media_player_t *p_mi, int channel );
1214
1215 /** @} audio */
1216
1217 /** @} media_player */
1218
1219 # ifdef __cplusplus
1220 }
1221 # endif
1222
1223 #endif /* VLC_LIBVLC_MEDIA_PLAYER_H */