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