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