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