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