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