]> git.sesse.net Git - vlc/blob - src/control/video.c
liblc_video: use var_ToggleBool when applicable.
[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 <vlc/libvlc.h>
29 #include <vlc/libvlc_media.h>
30 #include <vlc/libvlc_media_player.h>
31
32 #include <vlc_common.h>
33 #include <vlc_input.h>
34 #include <vlc_vout.h>
35
36 #include "media_player_internal.h"
37 #include <vlc_osd.h>
38
39 /*
40  * Remember to release the returned vout_thread_t.
41  */
42 static vout_thread_t *GetVout( libvlc_media_player_t *p_mi,
43                                libvlc_exception_t *p_exception )
44 {
45     input_thread_t *p_input = libvlc_get_input_thread( p_mi, p_exception );
46     vout_thread_t *p_vout = NULL;
47
48     if( p_input )
49     {
50         p_vout = input_GetVout( p_input );
51         if( !p_vout )
52         {
53             libvlc_exception_raise( p_exception, "No active video output" );
54         }
55         vlc_object_release( p_input );
56     }
57     return p_vout;
58 }
59
60 /**********************************************************************
61  * Exported functions
62  **********************************************************************/
63
64 void libvlc_set_fullscreen( libvlc_media_player_t *p_mi, int b_fullscreen,
65                             libvlc_exception_t *p_e )
66 {
67     /* We only work on the first vout */
68     vout_thread_t *p_vout = GetVout( p_mi, p_e );
69
70     /* GetVout will raise the exception for us */
71     if( !p_vout ) return;
72
73     var_SetBool( p_vout, "fullscreen", b_fullscreen );
74
75     vlc_object_release( p_vout );
76 }
77
78 int libvlc_get_fullscreen( libvlc_media_player_t *p_mi,
79                             libvlc_exception_t *p_e )
80 {
81     /* We only work on the first vout */
82     vout_thread_t *p_vout = GetVout( p_mi, p_e );
83     int i_ret;
84
85     /* GetVout will raise the exception for us */
86     if( !p_vout ) return 0;
87
88     i_ret = var_GetBool( p_vout, "fullscreen" );
89
90     vlc_object_release( p_vout );
91
92     return i_ret;
93 }
94
95 void libvlc_toggle_fullscreen( libvlc_media_player_t *p_mi,
96                                libvlc_exception_t *p_e )
97 {
98     /* We only work on the first vout */
99     vout_thread_t *p_vout = GetVout( p_mi, p_e );
100
101     /* GetVout will raise the exception for us */
102     if( !p_vout ) return;
103
104     var_ToggleBool( p_vout, "fullscreen" );
105
106     vlc_object_release( p_vout );
107 }
108
109 void
110 libvlc_video_take_snapshot( libvlc_media_player_t *p_mi, const char *psz_filepath,
111         unsigned int i_width, unsigned int i_height, libvlc_exception_t *p_e )
112 {
113     vout_thread_t *p_vout;
114
115     /* The filepath must be not NULL */
116     if( !psz_filepath )
117     {
118         libvlc_exception_raise( p_e, "filepath is null" );
119         return;
120     }
121     /* We must have an input */
122     if( !p_mi->p_input_thread )
123     {
124         libvlc_exception_raise( p_e, "Input does not exist" );
125         return;
126     }
127
128     /* GetVout will raise the exception for us */
129     p_vout = GetVout( p_mi, p_e );
130     if( !p_vout ) return;
131
132     var_SetInteger( p_vout, "snapshot-width", i_width );
133     var_SetInteger( p_vout, "snapshot-height", i_height );
134
135     var_SetString( p_vout, "snapshot-path", psz_filepath );
136     var_SetString( p_vout, "snapshot-format", "png" );
137
138     var_TriggerCallback( p_vout, "video-snapshot" );
139     vlc_object_release( p_vout );
140 }
141
142 int libvlc_video_get_height( libvlc_media_player_t *p_mi,
143                              libvlc_exception_t *p_e )
144 {
145     int height;
146
147     vout_thread_t *p_vout = GetVout( p_mi, p_e );
148     if( !p_vout ) return 0;
149
150     height = p_vout->i_window_height;
151
152     vlc_object_release( p_vout );
153
154     return height;
155 }
156
157 int libvlc_video_get_width( libvlc_media_player_t *p_mi,
158                             libvlc_exception_t *p_e )
159 {
160     int width;
161
162     vout_thread_t *p_vout = GetVout( p_mi, p_e );
163     if( !p_vout ) return 0;
164
165     width = p_vout->i_window_width;
166
167     vlc_object_release( p_vout );
168
169     return width;
170 }
171
172 int libvlc_media_player_has_vout( libvlc_media_player_t *p_mi,
173                                      libvlc_exception_t *p_e )
174 {
175     input_thread_t *p_input_thread = libvlc_get_input_thread(p_mi, p_e);
176     bool has_vout = false;
177
178     if( p_input_thread )
179     {
180         vout_thread_t *p_vout;
181
182         p_vout = input_GetVout( p_input_thread );
183         if( p_vout )
184         {
185             has_vout = true;
186             vlc_object_release( p_vout );
187         }
188         vlc_object_release( p_input_thread );
189     }
190     return has_vout;
191 }
192
193 float libvlc_video_get_scale( libvlc_media_player_t *p_mp,
194                               libvlc_exception_t *p_e )
195 {
196     vout_thread_t *p_vout = GetVout( p_mp, p_e );
197     if( !p_vout )
198         return 0.;
199
200     float f_scale = var_GetFloat( p_vout, "scale" );
201     if( var_GetBool( p_vout, "autoscale" ) )
202         f_scale = 0.;
203     vlc_object_release( p_vout );
204     return f_scale;
205 }
206
207 void libvlc_video_set_scale( libvlc_media_player_t *p_mp, float f_scale,
208                              libvlc_exception_t *p_e )
209 {
210     vout_thread_t *p_vout = GetVout( p_mp, p_e );
211     if( !p_vout )
212         return;
213
214     if( f_scale != 0. )
215         var_SetFloat( p_vout, "scale", f_scale );
216     var_SetBool( p_vout, "autoscale", f_scale != 0. );
217     vlc_object_release( p_vout );
218 }
219
220 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t *p_mi,
221                                      libvlc_exception_t *p_e )
222 {
223     char *psz_aspect = NULL;
224     vout_thread_t *p_vout = GetVout( p_mi, p_e );
225
226     if( !p_vout ) return NULL;
227
228     psz_aspect = var_GetNonEmptyString( p_vout, "aspect-ratio" );
229     vlc_object_release( p_vout );
230     return psz_aspect ? psz_aspect : strdup("");
231 }
232
233 void libvlc_video_set_aspect_ratio( libvlc_media_player_t *p_mi,
234                                     const char *psz_aspect, libvlc_exception_t *p_e )
235 {
236     vout_thread_t *p_vout = GetVout( p_mi, p_e );
237     int i_ret = -1;
238
239     if( !p_vout ) return;
240
241     i_ret = var_SetString( p_vout, "aspect-ratio", psz_aspect );
242     if( i_ret )
243         libvlc_exception_raise( p_e,
244                         "Unexpected error while setting aspect-ratio value" );
245
246     vlc_object_release( p_vout );
247 }
248
249 int libvlc_video_get_spu( libvlc_media_player_t *p_mi,
250                           libvlc_exception_t *p_e )
251 {
252     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
253     vlc_value_t val_list;
254     vlc_value_t val;
255     int i_spu = -1;
256     int i_ret = -1;
257     int i;
258
259     if( !p_input_thread ) return -1;
260
261     i_ret = var_Get( p_input_thread, "spu-es", &val );
262     if( i_ret < 0 )
263     {
264         libvlc_exception_raise( p_e, "Getting subtitle information failed" );
265         vlc_object_release( p_input_thread );
266         return i_ret;
267     }
268
269     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
270     for( i = 0; i < val_list.p_list->i_count; i++ )
271     {
272         if( val.i_int == val_list.p_list->p_values[i].i_int )
273         {
274             i_spu = i;
275             break;
276         }
277     }
278     var_FreeList( &val_list, NULL );
279     vlc_object_release( p_input_thread );
280     return i_spu;
281 }
282
283 int libvlc_video_get_spu_count( libvlc_media_player_t *p_mi,
284                                 libvlc_exception_t *p_e )
285 {
286     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
287     int i_spu_count;
288
289     if( !p_input_thread )
290         return -1;
291
292     i_spu_count = var_CountChoices( p_input_thread, "spu-es" );
293
294     vlc_object_release( p_input_thread );
295     return i_spu_count;
296 }
297
298 libvlc_track_description_t *
299         libvlc_video_get_spu_description( libvlc_media_player_t *p_mi,
300                                           libvlc_exception_t *p_e )
301 {
302     return libvlc_get_track_description( p_mi, "spu-es", p_e);
303 }
304
305 void libvlc_video_set_spu( libvlc_media_player_t *p_mi, int i_spu,
306                            libvlc_exception_t *p_e )
307 {
308     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
309     vlc_value_t val_list;
310     vlc_value_t newval;
311     int i_ret = -1;
312
313     if( !p_input_thread ) return;
314
315     var_Change( p_input_thread, "spu-es", VLC_VAR_GETCHOICES, &val_list, NULL );
316
317     if( val_list.p_list->i_count == 0 )
318     {
319         libvlc_exception_raise( p_e, "Subtitle value out of range" );
320         goto end;
321     }
322
323     if( (i_spu < 0) && (i_spu > val_list.p_list->i_count) )
324     {
325         libvlc_exception_raise( p_e, "Subtitle value out of range" );
326         goto end;
327     }
328
329     newval = val_list.p_list->p_values[i_spu];
330     i_ret = var_Set( p_input_thread, "spu-es", newval );
331     if( i_ret < 0 )
332     {
333         libvlc_exception_raise( p_e, "Setting subtitle value failed" );
334     }
335
336 end:
337     var_FreeList( &val_list, NULL );
338     vlc_object_release( p_input_thread );
339 }
340
341 int libvlc_video_set_subtitle_file( libvlc_media_player_t *p_mi,
342                                     const char *psz_subtitle,
343                                     libvlc_exception_t *p_e )
344 {
345     input_thread_t *p_input_thread = libvlc_get_input_thread ( p_mi, p_e );
346     bool b_ret = false;
347
348     if( p_input_thread )
349     {
350         if( !input_AddSubtitle( p_input_thread, psz_subtitle, true ) )
351             b_ret = true;
352         vlc_object_release( p_input_thread );
353     }
354     return b_ret;
355 }
356
357 libvlc_track_description_t *
358         libvlc_video_get_title_description( libvlc_media_player_t *p_mi,
359                                             libvlc_exception_t * p_e )
360 {
361     return libvlc_get_track_description( p_mi, "title", p_e);
362 }
363
364 libvlc_track_description_t *
365         libvlc_video_get_chapter_description( libvlc_media_player_t *p_mi,
366                                               int i_title,
367                                               libvlc_exception_t *p_e )
368 {
369     char psz_title[12];
370     sprintf( psz_title,  "title %2i", i_title );
371     return libvlc_get_track_description( p_mi, psz_title, p_e);
372 }
373
374 char *libvlc_video_get_crop_geometry( libvlc_media_player_t *p_mi,
375                                    libvlc_exception_t *p_e )
376 {
377     char *psz_geometry = 0;
378     vout_thread_t *p_vout = GetVout( p_mi, p_e );
379
380     if( !p_vout ) return 0;
381
382     psz_geometry = var_GetNonEmptyString( p_vout, "crop" );
383     vlc_object_release( p_vout );
384     return psz_geometry ? psz_geometry : strdup("");
385 }
386
387 void libvlc_video_set_crop_geometry( libvlc_media_player_t *p_mi,
388                                      const char *psz_geometry, libvlc_exception_t *p_e )
389 {
390     vout_thread_t *p_vout = GetVout( p_mi, p_e );
391     int i_ret = -1;
392
393     if( !p_vout ) return;
394
395     i_ret = var_SetString( p_vout, "crop", psz_geometry );
396     if( i_ret )
397         libvlc_exception_raise( p_e,
398                         "Unexpected error while setting crop geometry" );
399
400     vlc_object_release( p_vout );
401 }
402
403 int libvlc_video_get_teletext( libvlc_media_player_t *p_mi,
404                                libvlc_exception_t *p_e )
405 {
406     vout_thread_t *p_vout = GetVout( p_mi, p_e );
407     vlc_object_t *p_vbi;
408     int i_ret = -1;
409
410     if( !p_vout ) return i_ret;
411
412     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
413                                                    FIND_CHILD );
414     if( p_vbi )
415     {
416         i_ret = var_GetInteger( p_vbi, "vbi-page" );
417         vlc_object_release( p_vbi );
418     }
419
420     vlc_object_release( p_vout );
421     return i_ret;
422 }
423
424 void libvlc_video_set_teletext( libvlc_media_player_t *p_mi, int i_page,
425                                 libvlc_exception_t *p_e )
426 {
427     vout_thread_t *p_vout = GetVout( p_mi, p_e );
428     vlc_object_t *p_vbi;
429     int i_ret = -1;
430
431     if( !p_vout ) return;
432
433     p_vbi = (vlc_object_t *) vlc_object_find_name( p_vout, "zvbi",
434                                                    FIND_CHILD );
435     if( p_vbi )
436     {
437         i_ret = var_SetInteger( p_vbi, "vbi-page", i_page );
438         vlc_object_release( p_vbi );
439         if( i_ret )
440             libvlc_exception_raise( p_e,
441                             "Unexpected error while setting teletext page" );
442     }
443     vlc_object_release( p_vout );
444 }
445
446 void libvlc_toggle_teletext( libvlc_media_player_t *p_mi,
447                              libvlc_exception_t *p_e )
448 {
449     input_thread_t *p_input_thread;
450     vlc_object_t *p_vbi;
451     int i_ret;
452
453     p_input_thread = libvlc_get_input_thread(p_mi, p_e);
454     if( !p_input_thread ) return;
455
456     if( var_CountChoices( p_input_thread, "teletext-es" ) <= 0 )
457     {
458         vlc_object_release( p_input_thread );
459         return;
460     }
461     const bool b_selected = var_GetInteger( p_input_thread, "teletext-es" ) >= 0;
462
463     p_vbi = (vlc_object_t *)vlc_object_find_name( p_input_thread, "zvbi",
464                                                   FIND_CHILD );
465     if( p_vbi )
466     {
467         if( b_selected )
468         {
469             /* FIXME Gni, why that ? */
470             i_ret = var_SetInteger( p_vbi, "vbi-page",
471                                     var_GetInteger( p_vbi, "vbi-page" ) );
472             if( i_ret )
473                 libvlc_exception_raise( p_e,
474                                 "Unexpected error while setting teletext page" );
475         }
476         else
477         {
478             /* FIXME Gni^2 */
479             i_ret = var_SetBool( p_vbi, "vbi-opaque",
480                                  !var_GetBool( p_vbi, "vbi-opaque" ) );
481             if( i_ret )
482                 libvlc_exception_raise( p_e,
483                                 "Unexpected error while setting teletext transparency" );
484         }
485         vlc_object_release( p_vbi );
486     }
487     else if( b_selected )
488     {
489         var_SetInteger( p_input_thread, "spu-es", -1 );
490     }
491     else
492     {
493         vlc_value_t list;
494         if( !var_Change( p_input_thread, "teletext-es", VLC_VAR_GETLIST, &list, NULL ) )
495         {
496             if( list.p_list->i_count > 0 )
497                 var_SetInteger( p_input_thread, "spu-es", list.p_list->p_values[0].i_int );
498
499             var_FreeList( &list, NULL );
500         }
501     }
502     vlc_object_release( p_input_thread );
503 }
504
505 int libvlc_video_get_track_count( libvlc_media_player_t *p_mi,
506                                   libvlc_exception_t *p_e )
507 {
508     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
509     int i_track_count;
510
511     if( !p_input_thread )
512         return -1;
513
514     i_track_count = var_CountChoices( p_input_thread, "video-es" );
515
516     vlc_object_release( p_input_thread );
517     return i_track_count;
518 }
519
520 libvlc_track_description_t *
521         libvlc_video_get_track_description( libvlc_media_player_t *p_mi,
522                                             libvlc_exception_t *p_e )
523 {
524     return libvlc_get_track_description( p_mi, "video-es", p_e);
525 }
526
527 int libvlc_video_get_track( libvlc_media_player_t *p_mi,
528                             libvlc_exception_t *p_e )
529 {
530     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
531     vlc_value_t val_list;
532     vlc_value_t val;
533     int i_track = -1;
534     int i_ret = -1;
535     int i;
536
537     if( !p_input_thread )
538         return -1;
539
540     i_ret = var_Get( p_input_thread, "video-es", &val );
541     if( i_ret < 0 )
542     {
543         libvlc_exception_raise( p_e, "Getting Video track information failed" );
544         vlc_object_release( p_input_thread );
545         return i_ret;
546     }
547
548     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
549     for( i = 0; i < val_list.p_list->i_count; i++ )
550     {
551         if( val_list.p_list->p_values[i].i_int == val.i_int )
552         {
553             i_track = i;
554             break;
555         }
556     }
557     var_FreeList( &val_list, NULL );
558     vlc_object_release( p_input_thread );
559     return i_track;
560 }
561
562 void libvlc_video_set_track( libvlc_media_player_t *p_mi, int i_track,
563                              libvlc_exception_t *p_e )
564 {
565     input_thread_t *p_input_thread = libvlc_get_input_thread( p_mi, p_e );
566     vlc_value_t val_list;
567     int i_ret = -1;
568     int i;
569
570     if( !p_input_thread )
571         return;
572
573     var_Change( p_input_thread, "video-es", VLC_VAR_GETCHOICES, &val_list, NULL );
574     for( i = 0; i < val_list.p_list->i_count; i++ )
575     {
576         vlc_value_t val = val_list.p_list->p_values[i];
577         if( i_track == val.i_int )
578         {
579             i_ret = var_Set( p_input_thread, "video-es", val );
580             if( i_ret < 0 )
581                 libvlc_exception_raise( p_e, "Setting video track failed" );
582             goto end;
583         }
584     }
585     libvlc_exception_raise( p_e, "Video track out of range" );
586
587 end:
588     var_FreeList( &val_list, NULL );
589     vlc_object_release( p_input_thread );
590 }
591
592 /******************************************************************************
593  * libvlc_video_set_deinterlace : enable deinterlace
594  *****************************************************************************/
595 void libvlc_video_set_deinterlace( libvlc_media_player_t *p_mi, int b_enable,
596                                    const char *psz_mode,
597                                    libvlc_exception_t *p_e )
598 {
599     vout_thread_t *p_vout = GetVout( p_mi, p_e );
600
601     if( !p_vout )
602     {
603         libvlc_exception_raise( p_e, "Unable to get video output" );
604         return;
605     }
606
607     if( b_enable )
608     {
609         /* be sure that the filter name given is supported */
610         if( !strcmp(psz_mode, "blend")   || !strcmp(psz_mode, "bob")
611          || !strcmp(psz_mode, "discard") || !strcmp(psz_mode, "linear")
612          || !strcmp(psz_mode, "mean")    || !strcmp(psz_mode, "x") )
613         {
614             /* set deinterlace filter chosen */
615             var_SetString( p_vout, "deinterlace", psz_mode );
616         }
617         else
618         {
619             libvlc_exception_raise( p_e, "Unsuported or bad deinterlace filter name" );
620         }
621     }
622     else
623     {
624         /* disable deinterlace filter */
625         var_SetString( p_vout, "deinterlace", "" );
626     }
627
628     vlc_object_release( p_vout );
629 }
630
631 /*****************************************************************************
632  * Marquee: FIXME: That implementation has no persistent state and requires
633  * a vout
634  *****************************************************************************/
635
636 static const char *get_marquee_int_option_identifier(unsigned option)
637 {
638     static const char tab[][16] =
639     {
640         "marq",
641         "marq-color",
642         "marq-opacity",
643         "marq-position",
644         "marq-refresh",
645         "marq-size",
646         "marq-timeout",
647         "marq-x",
648         "marq-y",
649     };
650     if( option >= sizeof( tab ) / sizeof( tab[0] ) )
651         return NULL;
652     return tab[option];
653 }
654
655 static const char *get_marquee_string_option_identifier(unsigned option)
656 {
657     static const char tab[][16] =
658     {
659         "marq-marquee",
660     };
661     if( option >= sizeof( tab ) / sizeof( tab[0] ) )
662         return NULL;
663     return tab[option];
664 }
665
666
667 static vlc_object_t *get_marquee_object( libvlc_media_player_t * p_mi )
668 {
669     libvlc_exception_t e;
670     libvlc_exception_init(&e);
671     vout_thread_t * vout = GetVout( p_mi, &e );
672     libvlc_exception_clear(&e);
673     if( !vout )
674         return NULL;
675     vlc_object_t * object = vlc_object_find_name( vout, "marq", FIND_CHILD );
676     vlc_object_release(vout);
677     return object;
678 }
679
680 /*****************************************************************************
681  * libvlc_video_get_marquee_option_as_int : get a marq option value
682  *****************************************************************************/
683 int libvlc_video_get_marquee_option_as_int( libvlc_media_player_t *p_mi,
684                                             libvlc_video_marquee_int_option_t option,
685                                             libvlc_exception_t *p_e )
686 {
687     const char * identifier = get_marquee_int_option_identifier(option);
688     if(!identifier)
689     {
690         libvlc_exception_raise( p_e, "This option is not available" );
691         return 0;
692     }
693     vlc_object_t * marquee = get_marquee_object(p_mi);
694
695     /* Handle the libvlc_marquee_Enabled separately */
696     if(option == libvlc_marquee_Enabled)
697     {
698         bool isEnabled = marquee != NULL;
699         vlc_object_release(marquee);
700         return isEnabled;
701     }
702     
703     /* Generic case */
704     if(!identifier)
705     {
706         libvlc_exception_raise( p_e, "Marquee is not enabled" );
707         return 0;
708     }
709     int ret = var_GetInteger(marquee, identifier);
710     vlc_object_release(marquee);
711     return ret;
712 }
713
714 /*****************************************************************************
715  * libvlc_video_get_marquee_option_as_string : get a marq option value
716  *****************************************************************************/
717 char * libvlc_video_get_marquee_option_as_string( libvlc_media_player_t *p_mi,
718                                                   libvlc_video_marquee_string_option_t option,
719                                                   libvlc_exception_t *p_e )
720 {
721     const char * identifier = get_marquee_string_option_identifier(option);
722     if(!identifier)
723     {
724         libvlc_exception_raise( p_e, "This option is not available" );
725         return 0;
726     }
727     
728     vlc_object_t * marquee = get_marquee_object(p_mi);
729     if(!marquee)
730     {
731         libvlc_exception_raise( p_e, "Marquee is not enabled" );
732         return 0;
733     }
734     char *ret = var_GetString(marquee, identifier);
735     vlc_object_release(marquee);
736     return ret;
737 }
738
739 /*****************************************************************************
740  * libvlc_video_set_marquee_option_as_int: enable, disable or set an int option
741  *****************************************************************************/
742 void libvlc_video_set_marquee_option_as_int( libvlc_media_player_t *p_mi,
743                                           libvlc_video_marquee_int_option_t option,
744                                           int value, libvlc_exception_t *p_e )
745 {
746     const char * identifier = get_marquee_int_option_identifier(option);
747     if(!identifier)
748     {
749         libvlc_exception_raise( p_e, "This option is not available" );
750         return;
751     }
752
753     /* Handle the libvlc_marquee_Enabled separately */
754     if(option == libvlc_marquee_Enabled)
755     {
756         libvlc_exception_t e;
757         libvlc_exception_init(&e);
758         vout_thread_t * vout = GetVout( p_mi, &e );
759         libvlc_exception_clear(&e);
760         if (vout)
761         {
762             vout_EnableFilter(vout, identifier, value, false);
763             vlc_object_release(vout);
764         }
765         else
766         {
767             libvlc_exception_raise( p_e, "No Vout" );
768         }
769         return;
770     }
771
772     vlc_object_t * marquee = get_marquee_object(p_mi);
773     if(!marquee)
774     {
775         libvlc_exception_raise( p_e, "Marquee is not enabled" );
776         return;
777     }
778     var_SetInteger(marquee, identifier, value);
779     vlc_object_release(marquee);
780 }
781
782 /*****************************************************************************
783  * libvlc_video_set_marquee_option_as_string: set a string option
784  *****************************************************************************/
785 void libvlc_video_set_marquee_option_as_string( libvlc_media_player_t *p_mi,
786                                              libvlc_video_marquee_string_option_t option,
787                                              const char * value,
788                                              libvlc_exception_t *p_e )
789 {
790     const char * identifier = get_marquee_string_option_identifier(option);
791     if(!identifier)
792     {
793         libvlc_exception_raise( p_e, "This option is not available" );
794         return;
795     }
796     vlc_object_t * marquee = get_marquee_object(p_mi);
797     if(!marquee)
798     {
799         libvlc_exception_raise( p_e, "Marquee is not enabled" );
800         return;
801     }
802     var_SetString(marquee, identifier, value);
803     vlc_object_release(marquee);
804 }