1 /*****************************************************************************
2 * video.c: libvlc new API video functions
3 *****************************************************************************
4 * Copyright (C) 2005-2010 VLC authors and VideoLAN
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>
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU Lesser General Public License as published by
15 * the Free Software Foundation; either version 2.1 of the License, or
16 * (at your option) any later version.
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 Lesser General Public License for more details.
23 * You should have received a copy of the GNU Lesser General Public License
24 * along with this program; if not, write to the Free Software Foundation,
25 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26 *****************************************************************************/
32 #include <vlc/libvlc.h>
33 #include <vlc/libvlc_renderer_discoverer.h>
34 #include <vlc/libvlc_media.h>
35 #include <vlc/libvlc_media_player.h>
37 #include <vlc_common.h>
38 #include <vlc_modules.h>
39 #include <vlc_input.h>
43 #include "libvlc_internal.h"
44 #include "media_player_internal.h"
49 * Remember to release the returned vout_thread_t.
51 static vout_thread_t
**GetVouts( libvlc_media_player_t
*p_mi
, size_t *n
)
53 input_thread_t
*p_input
= libvlc_get_input_thread( p_mi
);
60 vout_thread_t
**pp_vouts
;
61 if (input_Control( p_input
, INPUT_GET_VOUTS
, &pp_vouts
, n
))
66 vlc_object_release (p_input
);
70 static vout_thread_t
*GetVout (libvlc_media_player_t
*mp
, size_t num
)
72 vout_thread_t
*p_vout
= NULL
;
74 vout_thread_t
**pp_vouts
= GetVouts (mp
, &n
);
79 p_vout
= pp_vouts
[num
];
81 for (size_t i
= 0; i
< n
; i
++)
83 vlc_object_release (pp_vouts
[i
]);
88 libvlc_printerr ("Video output not active");
92 /**********************************************************************
94 **********************************************************************/
96 void libvlc_set_fullscreen( libvlc_media_player_t
*p_mi
, int b_fullscreen
)
98 /* This will work even if the video is not currently active */
99 var_SetBool (p_mi
, "fullscreen", !!b_fullscreen
);
101 /* Apply to current video outputs (if any) */
103 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
104 for (size_t i
= 0; i
< n
; i
++)
106 var_SetBool (pp_vouts
[i
], "fullscreen", b_fullscreen
);
107 vlc_object_release (pp_vouts
[i
]);
112 int libvlc_get_fullscreen( libvlc_media_player_t
*p_mi
)
114 return var_GetBool (p_mi
, "fullscreen");
117 void libvlc_toggle_fullscreen( libvlc_media_player_t
*p_mi
)
119 bool b_fullscreen
= var_ToggleBool (p_mi
, "fullscreen");
121 /* Apply to current video outputs (if any) */
123 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
124 for (size_t i
= 0; i
< n
; i
++)
126 vout_thread_t
*p_vout
= pp_vouts
[i
];
128 var_SetBool (p_vout
, "fullscreen", b_fullscreen
);
129 vlc_object_release (p_vout
);
134 void libvlc_video_set_key_input( libvlc_media_player_t
*p_mi
, unsigned on
)
136 var_SetBool (p_mi
, "keyboard-events", !!on
);
139 void libvlc_video_set_mouse_input( libvlc_media_player_t
*p_mi
, unsigned on
)
141 var_SetBool (p_mi
, "mouse-events", !!on
);
145 libvlc_video_take_snapshot( libvlc_media_player_t
*p_mi
, unsigned num
,
146 const char *psz_filepath
,
147 unsigned int i_width
, unsigned int i_height
)
149 assert( psz_filepath
);
151 vout_thread_t
*p_vout
= GetVout (p_mi
, num
);
155 /* FIXME: This is not atomic. All parameters should be passed at once
156 * (obviously _not_ with var_*()). Also, the libvlc object should not be
157 * used for the callbacks: that breaks badly if there are concurrent
158 * media players in the instance. */
159 var_Create( p_vout
, "snapshot-width", VLC_VAR_INTEGER
);
160 var_SetInteger( p_vout
, "snapshot-width", i_width
);
161 var_Create( p_vout
, "snapshot-height", VLC_VAR_INTEGER
);
162 var_SetInteger( p_vout
, "snapshot-height", i_height
);
163 var_Create( p_vout
, "snapshot-path", VLC_VAR_STRING
);
164 var_SetString( p_vout
, "snapshot-path", psz_filepath
);
165 var_Create( p_vout
, "snapshot-format", VLC_VAR_STRING
);
166 var_SetString( p_vout
, "snapshot-format", "png" );
167 var_TriggerCallback( p_vout
, "video-snapshot" );
168 vlc_object_release( p_vout
);
172 int libvlc_video_get_size( libvlc_media_player_t
*p_mi
, unsigned num
,
173 unsigned *restrict px
, unsigned *restrict py
)
175 libvlc_media_track_info_t
*info
;
179 int infos
= libvlc_media_get_tracks_info(p_mi
->p_md
, &info
);
183 for (int i
= 0; i
< infos
; i
++)
184 if (info
[i
].i_type
== libvlc_track_video
&& num
-- == 0) {
185 *px
= info
[i
].u
.video
.i_width
;
186 *py
= info
[i
].u
.video
.i_height
;
195 int libvlc_video_get_cursor( libvlc_media_player_t
*mp
, unsigned num
,
196 int *restrict px
, int *restrict py
)
198 vout_thread_t
*p_vout
= GetVout (mp
, num
);
202 var_GetCoords (p_vout
, "mouse-moved", px
, py
);
203 vlc_object_release (p_vout
);
207 unsigned libvlc_media_player_has_vout( libvlc_media_player_t
*p_mi
)
210 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
211 for (size_t i
= 0; i
< n
; i
++)
212 vlc_object_release (pp_vouts
[i
]);
217 float libvlc_video_get_scale( libvlc_media_player_t
*mp
)
219 float f_scale
= var_GetFloat (mp
, "zoom");
220 if (var_GetBool (mp
, "autoscale"))
225 void libvlc_video_set_scale( libvlc_media_player_t
*p_mp
, float f_scale
)
227 if (isfinite(f_scale
) && f_scale
!= 0.f
)
228 var_SetFloat (p_mp
, "zoom", f_scale
);
229 var_SetBool (p_mp
, "autoscale", f_scale
== 0.f
);
231 /* Apply to current video outputs (if any) */
233 vout_thread_t
**pp_vouts
= GetVouts (p_mp
, &n
);
234 for (size_t i
= 0; i
< n
; i
++)
236 vout_thread_t
*p_vout
= pp_vouts
[i
];
238 if (isfinite(f_scale
) && f_scale
!= 0.f
)
239 var_SetFloat (p_vout
, "zoom", f_scale
);
240 var_SetBool (p_vout
, "autoscale", f_scale
== 0.f
);
241 vlc_object_release (p_vout
);
246 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t
*p_mi
)
248 return var_GetNonEmptyString (p_mi
, "aspect-ratio");
251 void libvlc_video_set_aspect_ratio( libvlc_media_player_t
*p_mi
,
252 const char *psz_aspect
)
254 if (psz_aspect
== NULL
)
256 var_SetString (p_mi
, "aspect-ratio", psz_aspect
);
259 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
260 for (size_t i
= 0; i
< n
; i
++)
262 vout_thread_t
*p_vout
= pp_vouts
[i
];
264 var_SetString (p_vout
, "aspect-ratio", psz_aspect
);
265 vlc_object_release (p_vout
);
270 libvlc_video_viewpoint_t
*libvlc_video_new_viewpoint(void)
272 libvlc_video_viewpoint_t
*p_vp
= malloc(sizeof *p_vp
);
273 if (unlikely(p_vp
== NULL
))
275 p_vp
->f_yaw
= p_vp
->f_pitch
= p_vp
->f_roll
= p_vp
->f_field_of_view
= 0.0f
;
279 int libvlc_video_update_viewpoint( libvlc_media_player_t
*p_mi
,
280 const libvlc_video_viewpoint_t
*p_viewpoint
,
283 vlc_viewpoint_t update
= {
284 .yaw
= p_viewpoint
->f_yaw
,
285 .pitch
= p_viewpoint
->f_pitch
,
286 .roll
= p_viewpoint
->f_roll
,
287 .fov
= p_viewpoint
->f_field_of_view
,
290 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
291 if( p_input_thread
!= NULL
)
293 if( input_UpdateViewpoint( p_input_thread
, &update
,
294 b_absolute
) != VLC_SUCCESS
)
296 vlc_object_release( p_input_thread
);
299 vlc_object_release( p_input_thread
);
303 /* Save the viewpoint in case the input is not created yet */
306 p_mi
->viewpoint
.yaw
+= update
.yaw
;
307 p_mi
->viewpoint
.pitch
+= update
.pitch
;
308 p_mi
->viewpoint
.roll
+= update
.roll
;
309 p_mi
->viewpoint
.fov
+= update
.fov
;
312 p_mi
->viewpoint
= update
;
314 vlc_viewpoint_clip( &p_mi
->viewpoint
);
319 int libvlc_video_get_spu( libvlc_media_player_t
*p_mi
)
321 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
323 if( !p_input_thread
)
325 libvlc_printerr( "No active input" );
329 int i_spu
= var_GetInteger( p_input_thread
, "spu-es" );
330 vlc_object_release( p_input_thread
);
334 int libvlc_video_get_spu_count( libvlc_media_player_t
*p_mi
)
336 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
339 if( !p_input_thread
)
342 i_spu_count
= var_CountChoices( p_input_thread
, "spu-es" );
343 vlc_object_release( p_input_thread
);
347 libvlc_track_description_t
*
348 libvlc_video_get_spu_description( libvlc_media_player_t
*p_mi
)
350 return libvlc_get_track_description( p_mi
, "spu-es" );
353 int libvlc_video_set_spu( libvlc_media_player_t
*p_mi
, int i_spu
)
355 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
360 if( !p_input_thread
)
363 var_Change(p_input_thread
, "spu-es", VLC_VAR_GETCHOICES
,
364 &count
, &list
, (char ***)NULL
);
365 for (size_t i
= 0; i
< count
; i
++)
367 if( i_spu
== list
[i
].i_int
)
369 if( var_SetInteger( p_input_thread
, "spu-es", i_spu
) < 0 )
375 libvlc_printerr( "Track identifier not found" );
377 vlc_object_release (p_input_thread
);
382 int64_t libvlc_video_get_spu_delay( libvlc_media_player_t
*p_mi
)
384 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
389 val
= US_FROM_VLC_TICK( var_GetInteger( p_input_thread
, "spu-delay" ) );
390 vlc_object_release( p_input_thread
);
394 libvlc_printerr( "No active input" );
400 int libvlc_video_set_spu_delay( libvlc_media_player_t
*p_mi
,
403 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
408 var_SetInteger( p_input_thread
, "spu-delay", VLC_TICK_FROM_US( i_delay
) );
409 vlc_object_release( p_input_thread
);
414 libvlc_printerr( "No active input" );
420 char *libvlc_video_get_crop_geometry (libvlc_media_player_t
*p_mi
)
422 return var_GetNonEmptyString (p_mi
, "crop");
425 void libvlc_video_set_crop_geometry( libvlc_media_player_t
*p_mi
,
426 const char *psz_geometry
)
428 if (psz_geometry
== NULL
)
431 var_SetString (p_mi
, "crop", psz_geometry
);
434 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
436 for (size_t i
= 0; i
< n
; i
++)
438 vout_thread_t
*p_vout
= pp_vouts
[i
];
440 var_SetString (p_vout
, "crop", psz_geometry
);
441 vlc_object_release (p_vout
);
446 int libvlc_video_get_teletext( libvlc_media_player_t
*p_mi
)
448 return var_GetInteger (p_mi
, "vbi-page");
451 static void teletext_enable( input_thread_t
*p_input_thread
, bool b_enable
)
458 if( !var_Change( p_input_thread
, "teletext-es", VLC_VAR_GETCHOICES
,
459 &count
, &list
, (char ***)NULL
) )
462 var_SetInteger( p_input_thread
, "spu-es", list
[0].i_int
);
468 var_SetInteger( p_input_thread
, "spu-es", -1 );
471 void libvlc_video_set_teletext( libvlc_media_player_t
*p_mi
, int i_page
)
473 input_thread_t
*p_input_thread
;
474 vlc_object_t
*p_zvbi
= NULL
;
478 if( i_page
>= 0 && i_page
< 1000 )
479 var_SetInteger( p_mi
, "vbi-page", i_page
);
480 else if( i_page
>= 1000 )
484 case libvlc_teletext_key_red
:
485 case libvlc_teletext_key_green
:
486 case libvlc_teletext_key_yellow
:
487 case libvlc_teletext_key_blue
:
488 case libvlc_teletext_key_index
:
492 libvlc_printerr("Invalid key action");
498 libvlc_printerr("Invalid page number");
502 p_input_thread
= libvlc_get_input_thread( p_mi
);
503 if( !p_input_thread
) return;
505 if( var_CountChoices( p_input_thread
, "teletext-es" ) <= 0 )
507 vlc_object_release( p_input_thread
);
513 teletext_enable( p_input_thread
, false );
517 telx
= var_GetInteger( p_input_thread
, "teletext-es" );
520 if( input_GetEsObjects( p_input_thread
, telx
, &p_zvbi
, NULL
, NULL
)
523 var_SetInteger( p_zvbi
, "vbi-page", i_page
);
524 vlc_object_release( p_zvbi
);
529 /* the "vbi-page" will be selected on es creation */
530 teletext_enable( p_input_thread
, true );
533 libvlc_printerr("Key action sent while the teletext is disabled");
535 vlc_object_release( p_input_thread
);
538 int libvlc_video_get_track_count( libvlc_media_player_t
*p_mi
)
540 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
543 if( !p_input_thread
)
546 i_track_count
= var_CountChoices( p_input_thread
, "video-es" );
548 vlc_object_release( p_input_thread
);
549 return i_track_count
;
552 libvlc_track_description_t
*
553 libvlc_video_get_track_description( libvlc_media_player_t
*p_mi
)
555 return libvlc_get_track_description( p_mi
, "video-es" );
558 int libvlc_video_get_track( libvlc_media_player_t
*p_mi
)
560 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
562 if( !p_input_thread
)
565 int id
= var_GetInteger( p_input_thread
, "video-es" );
566 vlc_object_release( p_input_thread
);
570 int libvlc_video_set_track( libvlc_media_player_t
*p_mi
, int i_track
)
572 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
573 vlc_value_t
*val_list
;
577 if( !p_input_thread
)
580 var_Change( p_input_thread
, "video-es", VLC_VAR_GETCHOICES
,
581 &count
, &val_list
, (char ***)NULL
);
582 for( size_t i
= 0; i
< count
; i
++ )
584 if( i_track
== val_list
[i
].i_int
)
586 if( var_SetInteger( p_input_thread
, "video-es", i_track
) < 0 )
592 libvlc_printerr( "Track identifier not found" );
595 vlc_object_release( p_input_thread
);
599 /******************************************************************************
600 * libvlc_video_set_deinterlace : enable/disable/auto deinterlace and filter
601 *****************************************************************************/
602 void libvlc_video_set_deinterlace( libvlc_media_player_t
*p_mi
, int deinterlace
,
603 const char *psz_mode
)
605 if (deinterlace
!= 0 && deinterlace
!= 1)
609 && strcmp (psz_mode
, "blend") && strcmp (psz_mode
, "bob")
610 && strcmp (psz_mode
, "discard") && strcmp (psz_mode
, "linear")
611 && strcmp (psz_mode
, "mean") && strcmp (psz_mode
, "x")
612 && strcmp (psz_mode
, "yadif") && strcmp (psz_mode
, "yadif2x")
613 && strcmp (psz_mode
, "phosphor") && strcmp (psz_mode
, "ivtc")
614 && strcmp (psz_mode
, "auto"))
617 if (psz_mode
&& deinterlace
!= 0)
618 var_SetString (p_mi
, "deinterlace-mode", psz_mode
);
620 var_SetInteger (p_mi
, "deinterlace", deinterlace
);
623 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
624 for (size_t i
= 0; i
< n
; i
++)
626 vout_thread_t
*p_vout
= pp_vouts
[i
];
628 if (psz_mode
&& deinterlace
!= 0)
629 var_SetString (p_vout
, "deinterlace-mode", psz_mode
);
631 var_SetInteger (p_vout
, "deinterlace", deinterlace
);
632 vlc_object_release (p_vout
);
641 static int get_filter_str( vlc_object_t
*p_parent
, const char *psz_name
,
642 bool b_add
, const char **ppsz_filter_type
,
643 char **ppsz_filter_value
)
647 const char *psz_filter_type
;
649 module_t
*p_obj
= module_find( psz_name
);
652 msg_Err( p_parent
, "Unable to find filter module \"%s\".", psz_name
);
656 if( module_provides( p_obj
, "video filter" ) )
658 psz_filter_type
= "video-filter";
660 else if( module_provides( p_obj
, "sub source" ) )
662 psz_filter_type
= "sub-source";
664 else if( module_provides( p_obj
, "sub filter" ) )
666 psz_filter_type
= "sub-filter";
670 msg_Err( p_parent
, "Unknown video filter type." );
674 psz_string
= var_GetString( p_parent
, psz_filter_type
);
676 /* Todo : Use some generic chain manipulation functions */
677 if( !psz_string
) psz_string
= strdup("");
679 psz_parser
= strstr( psz_string
, psz_name
);
684 psz_parser
= psz_string
;
685 if( asprintf( &psz_string
, (*psz_string
) ? "%s:%s" : "%s%s",
686 psz_string
, psz_name
) == -1 )
703 memmove( psz_parser
, psz_parser
+ strlen(psz_name
) +
704 (*(psz_parser
+ strlen(psz_name
)) == ':' ? 1 : 0 ),
705 strlen(psz_parser
+ strlen(psz_name
)) + 1 );
707 /* Remove trailing : : */
708 if( *(psz_string
+strlen(psz_string
) -1 ) == ':' )
709 *(psz_string
+strlen(psz_string
) -1 ) = '\0';
718 *ppsz_filter_type
= psz_filter_type
;
719 *ppsz_filter_value
= psz_string
;
723 static bool find_sub_source_by_name( libvlc_media_player_t
*p_mi
, const char *restrict name
)
725 vout_thread_t
*vout
= GetVout( p_mi
, 0 );
729 char *psz_sources
= var_GetString( vout
, "sub-source" );
732 libvlc_printerr( "%s not enabled", name
);
733 vlc_object_release( vout
);
738 char *p
= strstr( psz_sources
, name
);
740 vlc_object_release( vout
);
744 typedef const struct {
750 set_value( libvlc_media_player_t
*p_mi
, const char *restrict name
,
751 const opt_t
*restrict opt
, unsigned i_expected_type
,
752 const vlc_value_t
*val
, bool b_sub_source
)
756 int i_type
= opt
->type
;
757 vlc_value_t new_val
= *val
;
758 const char *psz_opt_name
= opt
->name
;
761 case 0: /* the enabler */
763 int i_ret
= get_filter_str( VLC_OBJECT( p_mi
), opt
->name
, val
->i_int
,
764 &psz_opt_name
, &new_val
.psz_string
);
765 if( i_ret
!= VLC_SUCCESS
)
767 i_type
= VLC_VAR_STRING
;
770 case VLC_VAR_INTEGER
:
773 if( i_expected_type
!= opt
->type
)
775 libvlc_printerr( "Invalid argument to %s", name
);
780 libvlc_printerr( "Invalid argument to %s", name
);
784 /* Set the new value to the media player. Next vouts created from this
785 * media player will inherit this new value */
786 var_SetChecked( p_mi
, psz_opt_name
, i_type
, new_val
);
788 /* Set the new value to every loaded vouts */
790 vout_thread_t
**pp_vouts
= GetVouts( p_mi
, &i_vout_count
);
791 for( size_t i
= 0; i
< i_vout_count
; ++i
)
793 var_SetChecked( pp_vouts
[i
], psz_opt_name
, i_type
, new_val
);
795 var_TriggerCallback( pp_vouts
[i
], "sub-source" );
796 vlc_object_release( pp_vouts
[i
] );
800 free( new_val
.psz_string
);
804 get_int( libvlc_media_player_t
*p_mi
, const char *restrict name
,
805 const opt_t
*restrict opt
)
811 case 0: /* the enabler */
813 bool b_enabled
= find_sub_source_by_name( p_mi
, name
);
814 return b_enabled
? 1 : 0;
816 case VLC_VAR_INTEGER
:
817 return var_GetInteger(p_mi
, opt
->name
);
819 return lroundf(var_GetFloat(p_mi
, opt
->name
));
821 libvlc_printerr( "Invalid argument to %s in %s", name
, "get int" );
827 get_float( libvlc_media_player_t
*p_mi
, const char *restrict name
,
828 const opt_t
*restrict opt
)
830 if( !opt
) return 0.0;
832 if( opt
->type
!= VLC_VAR_FLOAT
)
834 libvlc_printerr( "Invalid argument to %s in %s", name
, "get float" );
838 return var_GetFloat( p_mi
, opt
->name
);
842 get_string( libvlc_media_player_t
*p_mi
, const char *restrict name
,
843 const opt_t
*restrict opt
)
845 if( !opt
) return NULL
;
847 if( opt
->type
!= VLC_VAR_STRING
)
849 libvlc_printerr( "Invalid argument to %s in %s", name
, "get string" );
853 return var_GetString( p_mi
, opt
->name
);
857 marq_option_bynumber(unsigned option
)
859 static const opt_t optlist
[] =
862 { "marq-marquee", VLC_VAR_STRING
},
863 { "marq-color", VLC_VAR_INTEGER
},
864 { "marq-opacity", VLC_VAR_INTEGER
},
865 { "marq-position", VLC_VAR_INTEGER
},
866 { "marq-refresh", VLC_VAR_INTEGER
},
867 { "marq-size", VLC_VAR_INTEGER
},
868 { "marq-timeout", VLC_VAR_INTEGER
},
869 { "marq-x", VLC_VAR_INTEGER
},
870 { "marq-y", VLC_VAR_INTEGER
},
872 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
874 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
876 libvlc_printerr( "Unknown marquee option" );
880 /*****************************************************************************
881 * libvlc_video_get_marquee_int : get a marq option value
882 *****************************************************************************/
883 int libvlc_video_get_marquee_int( libvlc_media_player_t
*p_mi
,
886 return get_int( p_mi
, "marq", marq_option_bynumber(option
) );
889 /*****************************************************************************
890 * libvlc_video_get_marquee_string : get a marq option value
891 *****************************************************************************/
892 char * libvlc_video_get_marquee_string( libvlc_media_player_t
*p_mi
,
895 return get_string( p_mi
, "marq", marq_option_bynumber(option
) );
898 /*****************************************************************************
899 * libvlc_video_set_marquee_int: enable, disable or set an int option
900 *****************************************************************************/
901 void libvlc_video_set_marquee_int( libvlc_media_player_t
*p_mi
,
902 unsigned option
, int value
)
904 set_value( p_mi
, "marq", marq_option_bynumber(option
), VLC_VAR_INTEGER
,
905 &(vlc_value_t
) { .i_int
= value
}, true );
908 /*****************************************************************************
909 * libvlc_video_set_marquee_string: set a string option
910 *****************************************************************************/
911 void libvlc_video_set_marquee_string( libvlc_media_player_t
*p_mi
,
912 unsigned option
, const char * value
)
914 set_value( p_mi
, "marq", marq_option_bynumber(option
), VLC_VAR_STRING
,
915 &(vlc_value_t
){ .psz_string
= (char *)value
}, true );
919 /* logo module support */
922 logo_option_bynumber( unsigned option
)
924 static const opt_t vlogo_optlist
[] =
925 /* depends on libvlc_video_logo_option_t */
928 { "logo-file", VLC_VAR_STRING
},
929 { "logo-x", VLC_VAR_INTEGER
},
930 { "logo-y", VLC_VAR_INTEGER
},
931 { "logo-delay", VLC_VAR_INTEGER
},
932 { "logo-repeat", VLC_VAR_INTEGER
},
933 { "logo-opacity", VLC_VAR_INTEGER
},
934 { "logo-position", VLC_VAR_INTEGER
},
936 enum { num_vlogo_opts
= sizeof(vlogo_optlist
) / sizeof(*vlogo_optlist
) };
938 const opt_t
*r
= option
< num_vlogo_opts
? vlogo_optlist
+option
: NULL
;
940 libvlc_printerr( "Unknown logo option" );
944 void libvlc_video_set_logo_string( libvlc_media_player_t
*p_mi
,
945 unsigned option
, const char *psz_value
)
947 set_value( p_mi
,"logo",logo_option_bynumber(option
), VLC_VAR_STRING
,
948 &(vlc_value_t
){ .psz_string
= (char *)psz_value
}, true );
952 void libvlc_video_set_logo_int( libvlc_media_player_t
*p_mi
,
953 unsigned option
, int value
)
955 set_value( p_mi
, "logo", logo_option_bynumber(option
), VLC_VAR_INTEGER
,
956 &(vlc_value_t
) { .i_int
= value
}, true );
960 int libvlc_video_get_logo_int( libvlc_media_player_t
*p_mi
,
963 return get_int( p_mi
, "logo", logo_option_bynumber(option
) );
967 /* adjust module support */
971 adjust_option_bynumber( unsigned option
)
973 static const opt_t optlist
[] =
976 { "contrast", VLC_VAR_FLOAT
},
977 { "brightness", VLC_VAR_FLOAT
},
978 { "hue", VLC_VAR_FLOAT
},
979 { "saturation", VLC_VAR_FLOAT
},
980 { "gamma", VLC_VAR_FLOAT
},
982 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
984 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
986 libvlc_printerr( "Unknown adjust option" );
991 void libvlc_video_set_adjust_int( libvlc_media_player_t
*p_mi
,
992 unsigned option
, int value
)
994 set_value( p_mi
, "adjust", adjust_option_bynumber(option
), VLC_VAR_INTEGER
,
995 &(vlc_value_t
) { .i_int
= value
}, false );
999 int libvlc_video_get_adjust_int( libvlc_media_player_t
*p_mi
,
1002 return get_int( p_mi
, "adjust", adjust_option_bynumber(option
) );
1006 void libvlc_video_set_adjust_float( libvlc_media_player_t
*p_mi
,
1007 unsigned option
, float value
)
1009 set_value( p_mi
, "adjust", adjust_option_bynumber(option
), VLC_VAR_FLOAT
,
1010 &(vlc_value_t
) { .f_float
= value
}, false );
1014 float libvlc_video_get_adjust_float( libvlc_media_player_t
*p_mi
,
1017 return get_float( p_mi
, "adjust", adjust_option_bynumber(option
) );