]> git.sesse.net Git - vlc/blob - src/control/video.c
Remove invalid VOUT_REPARENT uses
[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Ă©ment 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     (void) p_mi; (void) d;
194     libvlc_exception_raise(p_e, "Reparenting not supported");
195     return -1;
196 }
197
198 void libvlc_video_resize( libvlc_media_player_t *p_mi, int width, int height, libvlc_exception_t *p_e )
199 {
200     vout_thread_t *p_vout = GetVout( p_mi, p_e );
201     if( p_vout )
202     {
203         vout_Control( p_vout, VOUT_SET_SIZE, width, height );
204         vlc_object_release( p_vout );
205     }
206 }
207
208 void libvlc_video_redraw_rectangle( libvlc_media_player_t *p_mi,
209                            const libvlc_rectangle_t *area,
210                            libvlc_exception_t *p_e )
211 {
212 #ifdef __APPLE__
213     if( (NULL != area)
214      && ((area->bottom - area->top) > 0)
215      && ((area->right - area->left) > 0) )
216     {
217         vout_thread_t *p_vout = GetVout( p_mi, p_e );
218         if( p_vout )
219         {
220             /* tell running vout to redraw area */
221             vout_Control( p_vout , VOUT_REDRAW_RECT,
222                                area->top, area->left, area->bottom, area->right );
223             vlc_object_release( p_vout );
224         }
225     }
226 #else
227     (void) p_mi; (void) area; (void) p_e;
228 #endif
229 }
230
231 /* global video settings */
232
233 /* Deprecated use libvlc_media_player_set_drawable() */
234 void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d,
235                               libvlc_exception_t *p_e )
236 {
237     /* set as default for future vout instances */
238 #ifdef WIN32
239     vlc_value_t val;
240
241     if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
242         return; /* BOOM! we told you not to use this function! */
243     val.p_address = (void *)(uintptr_t)d;
244     var_Set( p_instance->p_libvlc_int, "drawable-hwnd", val );
245 #else
246     var_SetInteger( p_instance->p_libvlc_int, "drawable-xid", d );
247 #endif
248
249     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
250     if( p_mi )
251     {
252         libvlc_media_player_set_drawable( p_mi, d, p_e );
253         libvlc_media_player_release(p_mi);
254     }
255 }
256
257 /* Deprecated use libvlc_media_player_get_drawable() */
258 libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc_exception_t *p_e )
259 {
260     VLC_UNUSED(p_e);
261
262 #ifdef WIN32
263     vlc_value_t val;
264
265     if( sizeof(HWND) > sizeof(libvlc_drawable_t) )
266         return 0;
267     var_Get( p_instance->p_libvlc_int, "drawable-hwnd", &val );
268     return (uintptr_t)val.p_address;
269 #else
270     return var_GetInteger( p_instance->p_libvlc_int, "drawable-xid" );
271 #endif
272 }
273
274
275 void libvlc_video_set_size( libvlc_instance_t *p_instance, int width, int height,
276                            libvlc_exception_t *p_e )
277 {
278     /* set as default for future vout instances */
279     config_PutInt(p_instance->p_libvlc_int, "width", width);
280     config_PutInt(p_instance->p_libvlc_int, "height", height);
281
282     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
283     if( p_mi )
284     {
285         vout_thread_t *p_vout = GetVout( p_mi, p_e );
286         if( p_vout )
287         {
288             /* tell running vout to re-size */
289             vout_Control( p_vout , VOUT_SET_SIZE, width, height);
290             vlc_object_release( p_vout );
291         }
292         libvlc_media_player_release(p_mi);
293     }
294 }
295
296 void libvlc_video_set_viewport( libvlc_instance_t *p_instance,
297                             const libvlc_rectangle_t *view, const libvlc_rectangle_t *clip,
298                            libvlc_exception_t *p_e )
299 {
300 #ifdef __APPLE__
301     if( !view )
302     {
303         libvlc_exception_raise( p_e, "viewport is NULL" );
304         return;
305     }
306
307     /* if clip is NULL, then use view rectangle as clip */
308     if( !clip )
309         clip = view;
310
311     /* set as default for future vout instances */
312     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-top", view->top );
313     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-left", view->left );
314     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-bottom", view->bottom );
315     var_SetInteger( p_instance->p_libvlc_int, "drawable-view-right", view->right );
316     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-top", clip->top );
317     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-left", clip->left );
318     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-bottom", clip->bottom );
319     var_SetInteger( p_instance->p_libvlc_int, "drawable-clip-right", clip->right );
320
321     libvlc_media_player_t *p_mi = libvlc_playlist_get_media_player(p_instance, p_e);
322     if( p_mi )
323     {
324         vout_thread_t *p_vout = GetVout( p_mi, p_e );
325         if( p_vout )
326         {
327             /* change viewport for running vout */
328             vout_Control( p_vout , VOUT_SET_VIEWPORT,
329                                view->top, view->left, view->bottom, view->right,
330                                clip->top, clip->left, clip->bottom, clip->right );
331             vlc_object_release( p_vout );
332         }
333         libvlc_media_player_release(p_mi);
334     }
335 #else
336     (void) p_instance; (void) view; (void) clip; (void) p_e;
337 #endif
338 }
339
340 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi,
341                                      libvlc_exception_t *p_e )
342 {
343     char *psz_aspect = 0;
344     vout_thread_t *p_vout = GetVout( p_mi, p_e );
345
346     if( !p_vout ) return 0;
347
348     psz_aspect = var_GetNonEmptyString( p_vout, "aspect-ratio" );
349     vlc_object_release( p_vout );
350     return psz_aspect ? psz_aspect : strdup("");
351 }
352
353 void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
354                                     char *psz_aspect, libvlc_exception_t *p_e )
355 {
356     vout_thread_t *p_vout = GetVout( p_mi, p_e );
357     int i_ret = -1;
358
359     if( !p_vout ) return;
360
361     i_ret = var_SetString( p_vout, "aspect-ratio", psz_aspect );
362     if( i_ret )
363         libvlc_exception_raise( p_e,
364                         "Unexpected error while setting aspect-ratio value" );
365
366     vlc_object_release( p_vout );
367 }
368
369 int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
370                           libvlc_exception_t *p_e )
371 {
372     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
373     vlc_value_t val_list;
374     vlc_value_t val;
375     int i_spu = -1;
376     int i_ret = -1;
377     int i;
378
379     if( !p_input_thread ) return -1;
380
381     i_ret = var_Get( p_input_thread, "spu-es", &val );
382     if( i_ret < 0 )
383     {
384         libvlc_exception_raise( p_e, "Getting subtitle information failed" );
385         vlc_object_release( p_input_thread );
386         return i_ret;
387     }
388
389     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
390     for( i = 0; i < val_list.p_list->i_count; i++ )
391     {
392         vlc_value_t spu_val = val_list.p_list->p_values[i];
393         if( val.i_int == spu_val.i_int )
394         {
395             i_spu = i;
396             break;
397         }
398     }
399     vlc_object_release( p_input_thread );
400     return i_spu;
401 }
402
403 int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi,
404                                 libvlc_exception_t *p_e )
405 {
406     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
407     vlc_value_t val_list;
408
409     if( !p_input_thread )
410         return -1;
411
412     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
413     vlc_object_release( p_input_thread );
414     return val_list.p_list->i_count;
415 }
416
417 libvlc_track_description_t *
418         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
419                                           libvlc_exception_t *p_e )
420 {
421     return libvlc_get_track_description( p_mi, "spu-es", p_e);
422 }
423
424 void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
425                            libvlc_exception_t *p_e )
426 {
427     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
428     vlc_value_t val_list;
429     vlc_value_t newval;
430     int i_ret = -1;
431
432     if( !p_input_thread ) return;
433
434     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
435     if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
436     {
437         libvlc_exception_raise( p_e, "Subtitle value out of range" );
438         vlc_object_release( p_input_thread );
439         return;
440     }
441
442     newval = val_list.p_list->p_values[i_spu];
443     i_ret = var_Set( p_input_thread, "spu-es", newval );
444     if( i_ret < 0 )
445     {
446         libvlc_exception_raise( p_e, "Setting subtitle value failed" );
447     }
448     vlc_object_release( p_input_thread );
449 }
450
451 int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
452                                     char *psz_subtitle,
453                                     libvlc_exception_t *p_e )
454 {
455     input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
456     bool b_ret = false;
457
458     if( p_input_thread )
459     {
460         if( !input_AddSubtitle( p_input_thread, psz_subtitle, true ) )
461             b_ret = true;
462         vlc_object_release( p_input_thread );
463     }
464     return b_ret;
465 }
466
467 libvlc_track_description_t *
468         libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
469                                             libvlc_exception_t * p_e )
470 {
471     return libvlc_get_track_description( p_mi, "title", p_e);
472 }
473
474 libvlc_track_description_t *
475         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi,
476                                               int i_title,
477                                               libvlc_exception_t *p_e )
478 {
479     char psz_title[12];
480     sprintf( psz_title,  "title %2i", i_title );
481     return libvlc_get_track_description( p_mi, psz_title, p_e);
482 }
483
484 char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
485                                    libvlc_exception_t *p_e )
486 {
487     char *psz_geometry = 0;
488     vout_thread_t *p_vout = GetVout( p_mi, p_e );
489
490     if( !p_vout ) return 0;
491
492     psz_geometry = var_GetNonEmptyString( p_vout, "crop" );
493     vlc_object_release( p_vout );
494     return psz_geometry ? psz_geometry : strdup("");
495 }
496
497 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
498                                     char *psz_geometry, libvlc_exception_t *p_e )
499 {
500     vout_thread_t *p_vout = GetVout( p_mi, p_e );
501     int i_ret = -1;
502
503     if( !p_vout ) return;
504
505     i_ret = var_SetString( p_vout, "crop", psz_geometry );
506     if( i_ret )
507         libvlc_exception_raise( p_e,
508                         "Unexpected error while setting crop geometry" );
509
510     vlc_object_release( p_vout );
511 }
512
513 int libvlc_video_get_teletext( libvlc_media_player_t *p_mi,
514                                libvlc_exception_t *p_e )
515 {
516     vout_thread_t *p_vout = GetVout( p_mi, p_e );
517     vlc_object_t *p_vbi;
518     int i_ret = -1;
519
520     if( !p_vout ) return i_ret;
521
522     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
523                                                    FIND_CHILD );
524     if( p_vbi )
525     {
526         i_ret = var_GetInteger( p_vbi, "vbi-page" );
527         vlc_object_release( p_vbi );
528     }
529
530     vlc_object_release( p_vout );
531     return i_ret;
532 }
533
534 void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
535                                 libvlc_exception_t *p_e )
536 {
537     vout_thread_t *p_vout = GetVout( p_mi, p_e );
538     vlc_object_t *p_vbi;
539     int i_ret = -1;
540
541     if( !p_vout ) return;
542
543     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
544                                                    FIND_CHILD );
545     if( p_vbi )
546     {
547         i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
548         vlc_object_release( p_vbi );
549         if( i_ret )
550             libvlc_exception_raise( p_e,
551                             "Unexpected error while setting teletext page" );
552     }
553     vlc_object_release( p_vout );
554 }
555
556 void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
557                              libvlc_exception_t *p_e )
558 {
559     input_thread_t *p_input_thread;
560     vlc_object_t *p_vbi;
561     int i_ret;
562
563     p_input_thread = libvlc_get_input_thread(p_mi, p_e);
564     if( !p_input_thread ) return;
565
566     if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
567     {
568         vlc_object_release( p_input_thread );
569         return;
570     }
571     const bool b_selected = var_GetInteger( p_input_thread, "teletext-es" ) >= 0;
572
573     p_vbi = (vlc_object_t *)vlc_object_find_name( p_input_thread, "zvbi",
574                                                   FIND_CHILD );
575     if( p_vbi )
576     {
577         if( b_selected )
578         {
579             /* FIXME Gni, why that ? */
580             i_ret = var_SetInteger( p_vbi, "vbi-page",
581                                     var_GetInteger( p_vbi, "vbi-page" ) );
582             if( i_ret )
583                 libvlc_exception_raise( p_e,
584                                 "Unexpected error while setting teletext page" );
585         }
586         else
587         {
588             /* FIXME Gni^2 */
589             i_ret = var_SetBool( p_vbi, "vbi-opaque",
590                                  !var_GetBool( p_vbi, "vbi-opaque" ) );
591             if( i_ret )
592                 libvlc_exception_raise( p_e,
593                                 "Unexpected error while setting teletext transparency" );
594         }
595         vlc_object_release( p_vbi );
596     }
597     else if( b_selected )
598     {
599         var_SetInteger( p_input_thread, "spu-es", -1 );
600     }
601     else
602     {
603         vlc_value_t list;
604         if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) )
605         {
606             if( list.p_list->i_count > 0 )
607                 var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
608
609             var_Change( p_input_thread, "teletext-es", VLC_VAR_FREELIST, &list, NULL );
610         }
611     }
612     vlc_object_release( p_input_thread );
613 }
614
615 int libvlc_video_get_track_count( libvlc_media_player_t *p_mi,
616                                   libvlc_exception_t *p_e )
617 {
618     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
619     vlc_value_t val_list;
620
621     if( !p_input_thread )
622         return -1;
623
624     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
625     vlc_object_release( p_input_thread );
626     return val_list.p_list->i_count;
627 }
628
629 libvlc_track_description_t *
630         libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
631                                             libvlc_exception_t *p_e )
632 {
633     return libvlc_get_track_description( p_mi, "video-es", p_e);
634 }
635
636 int libvlc_video_get_track( libvlc_media_player_t *p_mi,
637                             libvlc_exception_t *p_e )
638 {
639     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
640     vlc_value_t val_list;
641     vlc_value_t val;
642     int i_track = -1;
643     int i_ret = -1;
644     int i;
645
646     if( !p_input_thread )
647         return -1;
648
649     i_ret = var_Get( p_input_thread, "video-es", &val );
650     if( i_ret < 0 )
651     {
652         libvlc_exception_raise( p_e, "Getting Video track information failed" );
653         vlc_object_release( p_input_thread );
654         return i_ret;
655     }
656
657     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
658     for( i = 0; i < val_list.p_list->i_count; i++ )
659     {
660         vlc_value_t track_val = val_list.p_list->p_values[i];
661         if( track_val.i_int == val.i_int )
662         {
663             i_track = i;
664             break;
665        }
666     }
667     vlc_object_release( p_input_thread );
668     return i_track;
669 }
670
671 void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
672                              libvlc_exception_t *p_e )
673 {
674     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
675     vlc_value_t val_list;
676     int i_ret = -1;
677     int i;
678
679     if( !p_input_thread )
680         return;
681
682     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
683     for( i = 0; i < val_list.p_list->i_count; i++ )
684     {
685         vlc_value_t val = val_list.p_list->p_values[i];
686         if( i_track == val.i_int )
687         {
688             i_ret = var_Set( p_input_thread, "audio-es", val );
689             if( i_ret < 0 )
690                 libvlc_exception_raise( p_e, "Setting video track failed" );
691             vlc_object_release( p_input_thread );
692             return;
693         }
694     }
695     libvlc_exception_raise( p_e, "Video track out of range" );
696     vlc_object_release( p_input_thread );
697 }
698
699 int libvlc_video_destroy( libvlc_media_player_t *p_mi,
700                           libvlc_exception_t *p_e )
701 {
702     vout_thread_t *p_vout = GetVout( p_mi, p_e );
703     vlc_object_detach( p_vout );
704     vlc_object_release( p_vout );
705     vlc_object_release( p_vout );
706
707     return 0;
708 }