]> git.sesse.net Git - vlc/blob - src/control/video.c
ba1ae88cb3379e773fc2fd493b82827482cd4b41
[vlc] / src / control / video.c
1 /*****************************************************************************
2  * video.c: libvlc new API video functions
3  *****************************************************************************
4  * Copyright (C) 2005 the VideoLAN team
5  *
6  * $Id$
7  *
8  * Authors: Cl�ent Stenac <zorglub@videolan.org>
9  *          Filippo Carone <littlejohn@videolan.org>
10  *          Jean-Paul Saman <jpsaman _at_ m2x _dot_ nl>
11  *          Damien Fouilleul <damienf a_t videolan dot org>
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26  *****************************************************************************/
27
28 #include "libvlc_internal.h"
29
30 #include <vlc/libvlc.h>
31 #include <vlc_input.h>
32 #include <vlc_vout.h>
33
34 /*
35  * Remember to release the returned vout_thread_t.
36  */
37 static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
38                                libvlc_exception_t *p_exception )
39 {
40     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_exception );
41     vout_thread_t *p_vout = NULL;
42
43     if( p_input_thread )
44     {
45         p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
46         if( !p_vout )
47         {
48             libvlc_exception_raise( p_exception, "No active video output" );
49         }
50         vlc_object_release( p_input_thread );
51     }
52     return p_vout;
53 }
54
55 /**********************************************************************
56  * Exported functions
57  **********************************************************************/
58
59 void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen,
60                             libvlc_exception_t *p_e )
61 {
62     /* We only work on the first vout */
63     vout_thread_t *p_vout = GetVout( p_mi, p_e );
64
65     /* GetVout will raise the exception for us */
66     if( !p_vout ) return;
67
68     var_SetBool( p_vout, "fullscreen", b_fullscreen );
69
70     vlc_object_release( p_vout );
71 }
72
73 int libvlc_get_fullscreen( libvlc_media_player_t *p_mi,
74                             libvlc_exception_t *p_e )
75 {
76     /* We only work on the first vout */
77     vout_thread_t *p_vout = GetVout( p_mi, p_e );
78     int i_ret;
79
80     /* GetVout will raise the exception for us */
81     if( !p_vout ) return 0;
82
83     i_ret = var_GetBool( p_vout, "fullscreen" );
84
85     vlc_object_release( p_vout );
86
87     return i_ret;
88 }
89
90 void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi,
91                                libvlc_exception_t *p_e )
92 {
93     /* We only work on the first vout */
94     vout_thread_t *p_vout = GetVout( p_mi, p_e );
95     bool ret;
96
97     /* GetVout will raise the exception for us */
98     if( !p_vout ) return;
99
100     ret = var_GetBool( p_vout, "fullscreen" );
101     var_SetBool( p_vout, "fullscreen", !ret );
102
103     vlc_object_release( p_vout );
104 }
105
106 void
107 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, char *psz_filepath,
108         unsigned int i_width, unsigned int i_height, libvlc_exception_t *p_e )
109 {
110     vout_thread_t *p_vout = GetVout( p_mi, p_e );
111     input_thread_t *p_input_thread;
112
113     /* GetVout will raise the exception for us */
114     if( !p_vout ) return;
115
116     if( !psz_filepath )
117     {
118         libvlc_exception_raise( p_e, "filepath is null" );
119         return;
120     }
121
122     var_SetInteger( p_vout, "snapshot-width", i_width );
123     var_SetInteger( p_vout, "snapshot-height", i_height );
124
125     p_input_thread = p_mi->p_input_thread;
126     if( !p_mi->p_input_thread )
127     {
128         libvlc_exception_raise( p_e, "Input does not exist" );
129         return;
130     }
131
132     var_SetString( p_vout, "snapshot-path", psz_filepath );
133     var_SetString( p_vout, "snapshot-format", "png" );
134
135     var_TriggerCallback( p_vout, "video-snapshot" );
136     vlc_object_release( p_vout );
137 }
138
139 int libvlc_video_get_height( libvlc_media_player_t *p_mi,
140                              libvlc_exception_t *p_e )
141 {
142     int height;
143
144     vout_thread_t *p_vout = GetVout( p_mi, p_e );
145     if( !p_vout ) return 0;
146
147     height = p_vout->i_window_height;
148
149     vlc_object_release( p_vout );
150
151     return height;
152 }
153
154 int libvlc_video_get_width( libvlc_media_player_t *p_mi,
155                             libvlc_exception_t *p_e )
156 {
157     int width;
158
159     vout_thread_t *p_vout = GetVout( p_mi, p_e );
160     if( !p_vout ) return 0;
161
162     width = p_vout->i_window_width;
163
164     vlc_object_release( p_vout );
165
166     return width;
167 }
168
169 int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,
170                                      libvlc_exception_t *p_e )
171 {
172     input_thread_t *p_input_thread = libvlc_get_input_thread(p_mi, p_e);
173     bool has_vout = false;
174
175     if( p_input_thread )
176     {
177         vout_thread_t *p_vout;
178
179         p_vout = vlc_object_find( p_input_thread, VLC_OBJECT_VOUT, FIND_CHILD );
180         if( p_vout )
181         {
182             has_vout = true;
183             vlc_object_release( p_vout );
184         }
185         vlc_object_release( p_input_thread );
186     }
187     return has_vout;
188 }
189
190 int libvlc_video_reparent( libvlc_media_player_t *p_mi, libvlc_drawable_t d,
191                            libvlc_exception_t *p_e )
192 {
193     vout_thread_t *p_vout = GetVout( p_mi, p_e );
194
195     if( p_vout )
196     {
197         vout_Control( p_vout , VOUT_REPARENT, d);
198         vlc_object_release( p_vout );
199     }
200     return 0;
201 }
202
203 void libvlc_video_resize( libvlc_media_player_t *p_mi, int width, int height, libvlc_exception_t *p_e )
204 {
205     vout_thread_t *p_vout = GetVout( p_mi, p_e );
206     if( p_vout )
207     {
208         vout_Control( p_vout, VOUT_SET_SIZE, width, height );
209         vlc_object_release( p_vout );
210     }
211 }
212
213 void libvlc_video_redraw_rectangle( libvlc_media_player_t *p_mi,
214                            const libvlc_rectangle_t *area,
215                            libvlc_exception_t *p_e )
216 {
217 #ifdef __APPLE__
218     if( (NULL != area)
219      && ((area->bottom - area->top) > 0)
220      && ((area->right - area->left) > 0) )
221     {
222         vout_thread_t *p_vout = GetVout( p_mi, p_e );
223         if( p_vout )
224         {
225             /* tell running vout to redraw area */
226             vout_Control( p_vout , VOUT_REDRAW_RECT,
227                                area->top, area->left, area->bottom, area->right );
228             vlc_object_release( p_vout );
229         }
230     }
231 #else
232     (void) p_mi; (void) area; (void) p_e;
233 #endif
234 }
235
236 /* global video settings */
237
238 /* Deprecated use libvlc_media_player_set_drawable() */
239 void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
240                               libvlc_exception_t *p_e )
241 {
242     /* set as default for future vout instances */
243 #ifdef WIN32
244     vlc_value_t val;
245
246     if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
247         return; /* BOOM! we told you not to use this function! */
248     val.p_address = (void *)(uintptr_t)d;
249     var_Set( p_instance->p_libvlc_int, "drawable-hwnd", val );
250 #else
251     var_SetInteger( p_instance->p_libvlc_int, "drawable-xid", d );
252 #endif
253
254     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
255     if( p_mi )
256     {
257         libvlc_media_player_set_drawable( p_mi, d, p_e );
258         libvlc_media_player_release(p_mi);
259     }
260 }
261
262 /* Deprecated use libvlc_media_player_get_drawable() */
263 libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
264 {
265     VLC_UNUSED(p_e);
266
267 #ifdef WIN32
268     vlc_value_t val;
269
270     if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
271         return 0;
272     var_Get( p_instance->p_libvlc_int, "drawable-hwnd", &val );
273     return (uintptr_t)val.p_address;
274 #else
275     return var_GetInteger( p_instance->p_libvlc_int, "drawable-xid" );
276 #endif
277 }
278
279
280 void libvlc_video_set_size( libvlc_instance_t *p_instance, int width, int height,
281                            libvlc_exception_t *p_e )
282 {
283     /* set as default for future vout instances */
284     config_PutInt(p_instance->p_libvlc_int, "width", width);
285     config_PutInt(p_instance->p_libvlc_int, "height", height);
286
287     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
288     if( p_mi )
289     {
290         vout_thread_t *p_vout = GetVout( p_mi, p_e );
291         if( p_vout )
292         {
293             /* tell running vout to re-size */
294             vout_Control( p_vout , VOUT_SET_SIZE, width, height);
295             vlc_object_release( p_vout );
296         }
297         libvlc_media_player_release(p_mi);
298     }
299 }
300
301 void libvlc_video_set_viewport( libvlc_instance_t *p_instance,
302                             const libvlc_rectangle_t *view, const libvlc_rectangle_t *clip,
303                            libvlc_exception_t *p_e )
304 {
305 #ifdef __APPLE__
306     if( !view )
307     {
308         libvlc_exception_raise( p_e, "viewport is NULL" );
309         return;
310     }
311
312     /* if clip is NULL, then use view rectangle as clip */
313     if( !clip )
314         clip = view;
315
316     /* set as default for future vout instances */
317     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-top", view->top );
318     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-left", view->left );
319     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-bottom", view->bottom );
320     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-right", view->right );
321     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-top", clip->top );
322     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-left", clip->left );
323     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-bottom", clip->bottom );
324     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-right", clip->right );
325
326     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
327     if( p_mi )
328     {
329         vout_thread_t *p_vout = GetVout( p_mi, p_e );
330         if( p_vout )
331         {
332             /* change viewport for running vout */
333             vout_Control( p_vout , VOUT_SET_VIEWPORT,
334                                view->top, view->left, view->bottom, view->right,
335                                clip->top, clip->left, clip->bottom, clip->right );
336             vlc_object_release( p_vout );
337         }
338         libvlc_media_player_release(p_mi);
339     }
340 #else
341     (void) p_instance; (void) view; (void) clip; (void) p_e;
342 #endif
343 }
344
345 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi,
346                                      libvlc_exception_t *p_e )
347 {
348     char *psz_aspect = 0;
349     vout_thread_t *p_vout = GetVout( p_mi, p_e );
350
351     if( !p_vout ) return 0;
352
353     psz_aspect = var_GetNonEmptyString( p_vout, "aspect-ratio" );
354     vlc_object_release( p_vout );
355     return psz_aspect ? psz_aspect : strdup("");
356 }
357
358 void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
359                                     char *psz_aspect, libvlc_exception_t *p_e )
360 {
361     vout_thread_t *p_vout = GetVout( p_mi, p_e );
362     int i_ret = -1;
363
364     if( !p_vout ) return;
365
366     i_ret = var_SetString( p_vout, "aspect-ratio", psz_aspect );
367     if( i_ret )
368         libvlc_exception_raise( p_e,
369                         "Unexpected error while setting aspect-ratio value" );
370
371     vlc_object_release( p_vout );
372 }
373
374 int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
375                           libvlc_exception_t *p_e )
376 {
377     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
378     vlc_value_t val_list;
379     vlc_value_t val;
380     int i_spu = -1;
381     int i_ret = -1;
382     int i;
383
384     if( !p_input_thread ) return -1;
385
386     i_ret = var_Get( p_input_thread, "spu-es", &val );
387     if( i_ret < 0 )
388     {
389         libvlc_exception_raise( p_e, "Getting subtitle information failed" );
390         vlc_object_release( p_input_thread );
391         return i_ret;
392     }
393
394     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
395     for( i = 0; i < val_list.p_list->i_count; i++ )
396     {
397         vlc_value_t spu_val = val_list.p_list->p_values[i];
398         if( val.i_int == spu_val.i_int )
399         {
400             i_spu = i;
401             break;
402         }
403     }
404     vlc_object_release( p_input_thread );
405     return i_spu;
406 }
407
408 int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi,
409                                 libvlc_exception_t *p_e )
410 {
411     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
412     vlc_value_t val_list;
413
414     if( !p_input_thread )
415         return -1;
416
417     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
418     vlc_object_release( p_input_thread );
419     return val_list.p_list->i_count;
420 }
421
422 libvlc_track_description_t *
423         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
424                                           libvlc_exception_t *p_e )
425 {
426     return libvlc_get_track_description( p_mi, "spu-es", p_e);
427 }
428
429 void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
430                            libvlc_exception_t *p_e )
431 {
432     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
433     vlc_value_t val_list;
434     vlc_value_t newval;
435     int i_ret = -1;
436
437     if( !p_input_thread ) return;
438
439     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
440     if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
441     {
442         libvlc_exception_raise( p_e, "Subtitle value out of range" );
443         vlc_object_release( p_input_thread );
444         return;
445     }
446
447     newval = val_list.p_list->p_values[i_spu];
448     i_ret = var_Set( p_input_thread, "spu-es", newval );
449     if( i_ret < 0 )
450     {
451         libvlc_exception_raise( p_e, "Setting subtitle value failed" );
452     }
453     vlc_object_release( p_input_thread );
454 }
455
456 int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
457                                     char *psz_subtitle,
458                                     libvlc_exception_t *p_e )
459 {
460     input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
461     bool b_ret = false;
462
463     if( p_input_thread )
464     {
465         if( !input_AddSubtitle( p_input_thread, psz_subtitle, true ) )
466             b_ret = true;
467         vlc_object_release( p_input_thread );
468     }
469     return b_ret;
470 }
471
472 libvlc_track_description_t *
473         libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
474                                             libvlc_exception_t * p_e )
475 {
476     return libvlc_get_track_description( p_mi, "title", p_e);
477 }
478
479 libvlc_track_description_t *
480         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi,
481                                               int i_title,
482                                               libvlc_exception_t *p_e )
483 {
484     char psz_title[12];
485     sprintf( psz_title,  "title %2i", i_title );
486     return libvlc_get_track_description( p_mi, psz_title, p_e);
487 }
488
489 char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
490                                    libvlc_exception_t *p_e )
491 {
492     char *psz_geometry = 0;
493     vout_thread_t *p_vout = GetVout( p_mi, p_e );
494
495     if( !p_vout ) return 0;
496
497     psz_geometry = var_GetNonEmptyString( p_vout, "crop" );
498     vlc_object_release( p_vout );
499     return psz_geometry ? psz_geometry : strdup("");
500 }
501
502 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
503                                     char *psz_geometry, libvlc_exception_t *p_e )
504 {
505     vout_thread_t *p_vout = GetVout( p_mi, p_e );
506     int i_ret = -1;
507
508     if( !p_vout ) return;
509
510     i_ret = var_SetString( p_vout, "crop", psz_geometry );
511     if( i_ret )
512         libvlc_exception_raise( p_e,
513                         "Unexpected error while setting crop geometry" );
514
515     vlc_object_release( p_vout );
516 }
517
518 int libvlc_video_get_teletext( libvlc_media_player_t *p_mi,
519                                libvlc_exception_t *p_e )
520 {
521     vout_thread_t *p_vout = GetVout( p_mi, p_e );
522     vlc_object_t *p_vbi;
523     int i_ret = -1;
524
525     if( !p_vout ) return i_ret;
526
527     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
528                                                    FIND_CHILD );
529     if( p_vbi )
530     {
531         i_ret = var_GetInteger( p_vbi, "vbi-page" );
532         vlc_object_release( p_vbi );
533     }
534
535     vlc_object_release( p_vout );
536     return i_ret;
537 }
538
539 void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
540                                 libvlc_exception_t *p_e )
541 {
542     vout_thread_t *p_vout = GetVout( p_mi, p_e );
543     vlc_object_t *p_vbi;
544     int i_ret = -1;
545
546     if( !p_vout ) return;
547
548     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
549                                                    FIND_CHILD );
550     if( p_vbi )
551     {
552         i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
553         vlc_object_release( p_vbi );
554         if( i_ret )
555             libvlc_exception_raise( p_e,
556                             "Unexpected error while setting teletext page" );
557     }
558     vlc_object_release( p_vout );
559 }
560
561 void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
562                              libvlc_exception_t *p_e )
563 {
564     input_thread_t *p_input_thread;
565     vlc_object_t *p_vbi;
566     int i_ret;
567
568     p_input_thread = libvlc_get_input_thread(p_mi, p_e);
569     if( !p_input_thread ) return;
570
571     if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
572     {
573         vlc_object_release( p_input_thread );
574         return;
575     }
576     const bool b_selected = var_GetInteger( p_input_thread, "teletext-es" ) >= 0;
577
578     p_vbi = (vlc_object_t *)vlc_object_find_name( p_input_thread, "zvbi",
579                                                   FIND_CHILD );
580     if( p_vbi )
581     {
582         if( b_selected )
583         {
584             /* FIXME Gni, why that ? */
585             i_ret = var_SetInteger( p_vbi, "vbi-page",
586                                     var_GetInteger( p_vbi, "vbi-page" ) );
587             if( i_ret )
588                 libvlc_exception_raise( p_e,
589                                 "Unexpected error while setting teletext page" );
590         }
591         else
592         {
593             /* FIXME Gni^2 */
594             i_ret = var_SetBool( p_vbi, "vbi-opaque",
595                                  !var_GetBool( p_vbi, "vbi-opaque" ) );
596             if( i_ret )
597                 libvlc_exception_raise( p_e,
598                                 "Unexpected error while setting teletext transparency" );
599         }
600         vlc_object_release( p_vbi );
601     }
602     else if( b_selected )
603     {
604         var_SetInteger( p_input_thread, "spu-es", -1 );
605     }
606     else
607     {
608         vlc_value_t list;
609         if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) )
610         {
611             if( list.p_list->i_count > 0 )
612                 var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
613
614             var_Change( p_input_thread, "teletext-es", VLC_VAR_FREELIST, &list, NULL );
615         }
616     }
617     vlc_object_release( p_input_thread );
618 }
619
620 int libvlc_video_get_track_count( libvlc_media_player_t *p_mi,
621                                   libvlc_exception_t *p_e )
622 {
623     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
624     vlc_value_t val_list;
625
626     if( !p_input_thread )
627         return -1;
628
629     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
630     vlc_object_release( p_input_thread );
631     return val_list.p_list->i_count;
632 }
633
634 libvlc_track_description_t *
635         libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
636                                             libvlc_exception_t *p_e )
637 {
638     return libvlc_get_track_description( p_mi, "video-es", p_e);
639 }
640
641 int libvlc_video_get_track( libvlc_media_player_t *p_mi,
642                             libvlc_exception_t *p_e )
643 {
644     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
645     vlc_value_t val_list;
646     vlc_value_t val;
647     int i_track = -1;
648     int i_ret = -1;
649     int i;
650
651     if( !p_input_thread )
652         return -1;
653
654     i_ret = var_Get( p_input_thread, "video-es", &val );
655     if( i_ret < 0 )
656     {
657         libvlc_exception_raise( p_e, "Getting Video track information failed" );
658         vlc_object_release( p_input_thread );
659         return i_ret;
660     }
661
662     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
663     for( i = 0; i < val_list.p_list->i_count; i++ )
664     {
665         vlc_value_t track_val = val_list.p_list->p_values[i];
666         if( track_val.i_int == val.i_int )
667         {
668             i_track = i;
669             break;
670        }
671     }
672     vlc_object_release( p_input_thread );
673     return i_track;
674 }
675
676 void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
677                              libvlc_exception_t *p_e )
678 {
679     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
680     vlc_value_t val_list;
681     int i_ret = -1;
682     int i;
683
684     if( !p_input_thread )
685         return;
686
687     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
688     for( i = 0; i < val_list.p_list->i_count; i++ )
689     {
690         vlc_value_t val = val_list.p_list->p_values[i];
691         if( i_track == val.i_int )
692         {
693             i_ret = var_Set( p_input_thread, "audio-es", val );
694             if( i_ret < 0 )
695                 libvlc_exception_raise( p_e, "Setting video track failed" );
696             vlc_object_release( p_input_thread );
697             return;
698         }
699     }
700     libvlc_exception_raise( p_e, "Video track out of range" );
701     vlc_object_release( p_input_thread );
702 }
703
704 int libvlc_video_destroy( libvlc_media_player_t *p_mi,
705                           libvlc_exception_t *p_e )
706 {
707     vout_thread_t *p_vout = GetVout( p_mi, p_e );
708     vlc_object_detach( p_vout );
709     vlc_object_release( p_vout );
710     vlc_object_release( p_vout );
711
712     return 0;
713 }