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