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 if (p_mi
->p_md
== NULL
)
178 libvlc_media_track_t
**tracks
;
179 unsigned count
= libvlc_media_tracks_get(p_mi
->p_md
, &tracks
);
182 for (unsigned i
= 0; i
< count
; i
++)
183 if (tracks
[i
]->i_type
== libvlc_track_video
&& num
-- == 0) {
184 *px
= tracks
[i
]->video
->i_width
;
185 *py
= tracks
[i
]->video
->i_height
;
190 libvlc_media_tracks_release(tracks
, count
);
194 int libvlc_video_get_cursor( libvlc_media_player_t
*mp
, unsigned num
,
195 int *restrict px
, int *restrict py
)
197 vout_thread_t
*p_vout
= GetVout (mp
, num
);
201 var_GetCoords (p_vout
, "mouse-moved", px
, py
);
202 vlc_object_release (p_vout
);
206 unsigned libvlc_media_player_has_vout( libvlc_media_player_t
*p_mi
)
209 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
210 for (size_t i
= 0; i
< n
; i
++)
211 vlc_object_release (pp_vouts
[i
]);
216 float libvlc_video_get_scale( libvlc_media_player_t
*mp
)
218 float f_scale
= var_GetFloat (mp
, "zoom");
219 if (var_GetBool (mp
, "autoscale"))
224 void libvlc_video_set_scale( libvlc_media_player_t
*p_mp
, float f_scale
)
226 if (isfinite(f_scale
) && f_scale
!= 0.f
)
227 var_SetFloat (p_mp
, "zoom", f_scale
);
228 var_SetBool (p_mp
, "autoscale", f_scale
== 0.f
);
230 /* Apply to current video outputs (if any) */
232 vout_thread_t
**pp_vouts
= GetVouts (p_mp
, &n
);
233 for (size_t i
= 0; i
< n
; i
++)
235 vout_thread_t
*p_vout
= pp_vouts
[i
];
237 if (isfinite(f_scale
) && f_scale
!= 0.f
)
238 var_SetFloat (p_vout
, "zoom", f_scale
);
239 var_SetBool (p_vout
, "autoscale", f_scale
== 0.f
);
240 vlc_object_release (p_vout
);
245 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t
*p_mi
)
247 return var_GetNonEmptyString (p_mi
, "aspect-ratio");
250 void libvlc_video_set_aspect_ratio( libvlc_media_player_t
*p_mi
,
251 const char *psz_aspect
)
253 if (psz_aspect
== NULL
)
255 var_SetString (p_mi
, "aspect-ratio", psz_aspect
);
258 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
259 for (size_t i
= 0; i
< n
; i
++)
261 vout_thread_t
*p_vout
= pp_vouts
[i
];
263 var_SetString (p_vout
, "aspect-ratio", psz_aspect
);
264 vlc_object_release (p_vout
);
269 libvlc_video_viewpoint_t
*libvlc_video_new_viewpoint(void)
271 libvlc_video_viewpoint_t
*p_vp
= malloc(sizeof *p_vp
);
272 if (unlikely(p_vp
== NULL
))
274 p_vp
->f_yaw
= p_vp
->f_pitch
= p_vp
->f_roll
= p_vp
->f_field_of_view
= 0.0f
;
278 int libvlc_video_update_viewpoint( libvlc_media_player_t
*p_mi
,
279 const libvlc_video_viewpoint_t
*p_viewpoint
,
282 vlc_viewpoint_t update
= {
283 .yaw
= p_viewpoint
->f_yaw
,
284 .pitch
= p_viewpoint
->f_pitch
,
285 .roll
= p_viewpoint
->f_roll
,
286 .fov
= p_viewpoint
->f_field_of_view
,
289 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
290 if( p_input_thread
!= NULL
)
292 if( input_UpdateViewpoint( p_input_thread
, &update
,
293 b_absolute
) != VLC_SUCCESS
)
295 vlc_object_release( p_input_thread
);
298 vlc_object_release( p_input_thread
);
302 /* Save the viewpoint in case the input is not created yet */
305 p_mi
->viewpoint
.yaw
+= update
.yaw
;
306 p_mi
->viewpoint
.pitch
+= update
.pitch
;
307 p_mi
->viewpoint
.roll
+= update
.roll
;
308 p_mi
->viewpoint
.fov
+= update
.fov
;
311 p_mi
->viewpoint
= update
;
313 vlc_viewpoint_clip( &p_mi
->viewpoint
);
318 int libvlc_video_get_spu( libvlc_media_player_t
*p_mi
)
320 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
322 if( !p_input_thread
)
324 libvlc_printerr( "No active input" );
328 int i_spu
= var_GetInteger( p_input_thread
, "spu-es" );
329 vlc_object_release( p_input_thread
);
333 int libvlc_video_get_spu_count( libvlc_media_player_t
*p_mi
)
335 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
338 if( !p_input_thread
)
341 i_spu_count
= var_CountChoices( p_input_thread
, "spu-es" );
342 vlc_object_release( p_input_thread
);
346 libvlc_track_description_t
*
347 libvlc_video_get_spu_description( libvlc_media_player_t
*p_mi
)
349 return libvlc_get_track_description( p_mi
, "spu-es" );
352 int libvlc_video_set_spu( libvlc_media_player_t
*p_mi
, int i_spu
)
354 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
359 if( !p_input_thread
)
362 var_Change(p_input_thread
, "spu-es", VLC_VAR_GETCHOICES
,
363 &count
, &list
, (char ***)NULL
);
364 for (size_t i
= 0; i
< count
; i
++)
366 if( i_spu
== list
[i
].i_int
)
368 if( var_SetInteger( p_input_thread
, "spu-es", i_spu
) < 0 )
374 libvlc_printerr( "Track identifier not found" );
376 vlc_object_release (p_input_thread
);
381 int64_t libvlc_video_get_spu_delay( libvlc_media_player_t
*p_mi
)
383 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
388 val
= US_FROM_VLC_TICK( var_GetInteger( p_input_thread
, "spu-delay" ) );
389 vlc_object_release( p_input_thread
);
393 libvlc_printerr( "No active input" );
399 int libvlc_video_set_spu_delay( libvlc_media_player_t
*p_mi
,
402 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
407 var_SetInteger( p_input_thread
, "spu-delay", VLC_TICK_FROM_US( i_delay
) );
408 vlc_object_release( p_input_thread
);
413 libvlc_printerr( "No active input" );
419 char *libvlc_video_get_crop_geometry (libvlc_media_player_t
*p_mi
)
421 return var_GetNonEmptyString (p_mi
, "crop");
424 void libvlc_video_set_crop_geometry( libvlc_media_player_t
*p_mi
,
425 const char *psz_geometry
)
427 if (psz_geometry
== NULL
)
430 var_SetString (p_mi
, "crop", psz_geometry
);
433 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
435 for (size_t i
= 0; i
< n
; i
++)
437 vout_thread_t
*p_vout
= pp_vouts
[i
];
439 var_SetString (p_vout
, "crop", psz_geometry
);
440 vlc_object_release (p_vout
);
445 int libvlc_video_get_teletext( libvlc_media_player_t
*p_mi
)
447 return var_GetInteger (p_mi
, "vbi-page");
450 static void teletext_enable( input_thread_t
*p_input_thread
, bool b_enable
)
457 if( !var_Change( p_input_thread
, "teletext-es", VLC_VAR_GETCHOICES
,
458 &count
, &list
, (char ***)NULL
) )
461 var_SetInteger( p_input_thread
, "spu-es", list
[0].i_int
);
467 var_SetInteger( p_input_thread
, "spu-es", -1 );
470 void libvlc_video_set_teletext( libvlc_media_player_t
*p_mi
, int i_page
)
472 input_thread_t
*p_input_thread
;
473 vlc_object_t
*p_zvbi
= NULL
;
477 if( i_page
>= 0 && i_page
< 1000 )
478 var_SetInteger( p_mi
, "vbi-page", i_page
);
479 else if( i_page
>= 1000 )
483 case libvlc_teletext_key_red
:
484 case libvlc_teletext_key_green
:
485 case libvlc_teletext_key_yellow
:
486 case libvlc_teletext_key_blue
:
487 case libvlc_teletext_key_index
:
491 libvlc_printerr("Invalid key action");
497 libvlc_printerr("Invalid page number");
501 p_input_thread
= libvlc_get_input_thread( p_mi
);
502 if( !p_input_thread
) return;
504 if( var_CountChoices( p_input_thread
, "teletext-es" ) <= 0 )
506 vlc_object_release( p_input_thread
);
512 teletext_enable( p_input_thread
, false );
516 telx
= var_GetInteger( p_input_thread
, "teletext-es" );
519 if( input_GetEsObjects( p_input_thread
, telx
, &p_zvbi
, NULL
, NULL
)
522 var_SetInteger( p_zvbi
, "vbi-page", i_page
);
523 vlc_object_release( p_zvbi
);
528 /* the "vbi-page" will be selected on es creation */
529 teletext_enable( p_input_thread
, true );
532 libvlc_printerr("Key action sent while the teletext is disabled");
534 vlc_object_release( p_input_thread
);
537 int libvlc_video_get_track_count( libvlc_media_player_t
*p_mi
)
539 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
542 if( !p_input_thread
)
545 i_track_count
= var_CountChoices( p_input_thread
, "video-es" );
547 vlc_object_release( p_input_thread
);
548 return i_track_count
;
551 libvlc_track_description_t
*
552 libvlc_video_get_track_description( libvlc_media_player_t
*p_mi
)
554 return libvlc_get_track_description( p_mi
, "video-es" );
557 int libvlc_video_get_track( libvlc_media_player_t
*p_mi
)
559 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
561 if( !p_input_thread
)
564 int id
= var_GetInteger( p_input_thread
, "video-es" );
565 vlc_object_release( p_input_thread
);
569 int libvlc_video_set_track( libvlc_media_player_t
*p_mi
, int i_track
)
571 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
572 vlc_value_t
*val_list
;
576 if( !p_input_thread
)
579 var_Change( p_input_thread
, "video-es", VLC_VAR_GETCHOICES
,
580 &count
, &val_list
, (char ***)NULL
);
581 for( size_t i
= 0; i
< count
; i
++ )
583 if( i_track
== val_list
[i
].i_int
)
585 if( var_SetInteger( p_input_thread
, "video-es", i_track
) < 0 )
591 libvlc_printerr( "Track identifier not found" );
594 vlc_object_release( p_input_thread
);
598 /******************************************************************************
599 * libvlc_video_set_deinterlace : enable/disable/auto deinterlace and filter
600 *****************************************************************************/
601 void libvlc_video_set_deinterlace( libvlc_media_player_t
*p_mi
, int deinterlace
,
602 const char *psz_mode
)
604 if (deinterlace
!= 0 && deinterlace
!= 1)
608 && strcmp (psz_mode
, "blend") && strcmp (psz_mode
, "bob")
609 && strcmp (psz_mode
, "discard") && strcmp (psz_mode
, "linear")
610 && strcmp (psz_mode
, "mean") && strcmp (psz_mode
, "x")
611 && strcmp (psz_mode
, "yadif") && strcmp (psz_mode
, "yadif2x")
612 && strcmp (psz_mode
, "phosphor") && strcmp (psz_mode
, "ivtc")
613 && strcmp (psz_mode
, "auto"))
616 if (psz_mode
&& deinterlace
!= 0)
617 var_SetString (p_mi
, "deinterlace-mode", psz_mode
);
619 var_SetInteger (p_mi
, "deinterlace", deinterlace
);
622 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
623 for (size_t i
= 0; i
< n
; i
++)
625 vout_thread_t
*p_vout
= pp_vouts
[i
];
627 if (psz_mode
&& deinterlace
!= 0)
628 var_SetString (p_vout
, "deinterlace-mode", psz_mode
);
630 var_SetInteger (p_vout
, "deinterlace", deinterlace
);
631 vlc_object_release (p_vout
);
640 static int get_filter_str( vlc_object_t
*p_parent
, const char *psz_name
,
641 bool b_add
, const char **ppsz_filter_type
,
642 char **ppsz_filter_value
)
646 const char *psz_filter_type
;
648 module_t
*p_obj
= module_find( psz_name
);
651 msg_Err( p_parent
, "Unable to find filter module \"%s\".", psz_name
);
655 if( module_provides( p_obj
, "video filter" ) )
657 psz_filter_type
= "video-filter";
659 else if( module_provides( p_obj
, "sub source" ) )
661 psz_filter_type
= "sub-source";
663 else if( module_provides( p_obj
, "sub filter" ) )
665 psz_filter_type
= "sub-filter";
669 msg_Err( p_parent
, "Unknown video filter type." );
673 psz_string
= var_GetString( p_parent
, psz_filter_type
);
675 /* Todo : Use some generic chain manipulation functions */
676 if( !psz_string
) psz_string
= strdup("");
678 psz_parser
= strstr( psz_string
, psz_name
);
683 psz_parser
= psz_string
;
684 if( asprintf( &psz_string
, (*psz_string
) ? "%s:%s" : "%s%s",
685 psz_string
, psz_name
) == -1 )
702 memmove( psz_parser
, psz_parser
+ strlen(psz_name
) +
703 (*(psz_parser
+ strlen(psz_name
)) == ':' ? 1 : 0 ),
704 strlen(psz_parser
+ strlen(psz_name
)) + 1 );
706 /* Remove trailing : : */
707 if( *(psz_string
+strlen(psz_string
) -1 ) == ':' )
708 *(psz_string
+strlen(psz_string
) -1 ) = '\0';
717 *ppsz_filter_type
= psz_filter_type
;
718 *ppsz_filter_value
= psz_string
;
722 static bool find_sub_source_by_name( libvlc_media_player_t
*p_mi
, const char *restrict name
)
724 vout_thread_t
*vout
= GetVout( p_mi
, 0 );
728 char *psz_sources
= var_GetString( vout
, "sub-source" );
731 libvlc_printerr( "%s not enabled", name
);
732 vlc_object_release( vout
);
737 char *p
= strstr( psz_sources
, name
);
739 vlc_object_release( vout
);
743 typedef const struct {
749 set_value( libvlc_media_player_t
*p_mi
, const char *restrict name
,
750 const opt_t
*restrict opt
, unsigned i_expected_type
,
751 const vlc_value_t
*val
, bool b_sub_source
)
755 int i_type
= opt
->type
;
756 vlc_value_t new_val
= *val
;
757 const char *psz_opt_name
= opt
->name
;
760 case 0: /* the enabler */
762 int i_ret
= get_filter_str( VLC_OBJECT( p_mi
), opt
->name
, val
->i_int
,
763 &psz_opt_name
, &new_val
.psz_string
);
764 if( i_ret
!= VLC_SUCCESS
)
766 i_type
= VLC_VAR_STRING
;
769 case VLC_VAR_INTEGER
:
772 if( i_expected_type
!= opt
->type
)
774 libvlc_printerr( "Invalid argument to %s", name
);
779 libvlc_printerr( "Invalid argument to %s", name
);
783 /* Set the new value to the media player. Next vouts created from this
784 * media player will inherit this new value */
785 var_SetChecked( p_mi
, psz_opt_name
, i_type
, new_val
);
787 /* Set the new value to every loaded vouts */
789 vout_thread_t
**pp_vouts
= GetVouts( p_mi
, &i_vout_count
);
790 for( size_t i
= 0; i
< i_vout_count
; ++i
)
792 var_SetChecked( pp_vouts
[i
], psz_opt_name
, i_type
, new_val
);
794 var_TriggerCallback( pp_vouts
[i
], "sub-source" );
795 vlc_object_release( pp_vouts
[i
] );
799 free( new_val
.psz_string
);
803 get_int( libvlc_media_player_t
*p_mi
, const char *restrict name
,
804 const opt_t
*restrict opt
)
810 case 0: /* the enabler */
812 bool b_enabled
= find_sub_source_by_name( p_mi
, name
);
813 return b_enabled
? 1 : 0;
815 case VLC_VAR_INTEGER
:
816 return var_GetInteger(p_mi
, opt
->name
);
818 return lroundf(var_GetFloat(p_mi
, opt
->name
));
820 libvlc_printerr( "Invalid argument to %s in %s", name
, "get int" );
826 get_float( libvlc_media_player_t
*p_mi
, const char *restrict name
,
827 const opt_t
*restrict opt
)
829 if( !opt
) return 0.0;
831 if( opt
->type
!= VLC_VAR_FLOAT
)
833 libvlc_printerr( "Invalid argument to %s in %s", name
, "get float" );
837 return var_GetFloat( p_mi
, opt
->name
);
841 get_string( libvlc_media_player_t
*p_mi
, const char *restrict name
,
842 const opt_t
*restrict opt
)
844 if( !opt
) return NULL
;
846 if( opt
->type
!= VLC_VAR_STRING
)
848 libvlc_printerr( "Invalid argument to %s in %s", name
, "get string" );
852 return var_GetString( p_mi
, opt
->name
);
856 marq_option_bynumber(unsigned option
)
858 static const opt_t optlist
[] =
861 { "marq-marquee", VLC_VAR_STRING
},
862 { "marq-color", VLC_VAR_INTEGER
},
863 { "marq-opacity", VLC_VAR_INTEGER
},
864 { "marq-position", VLC_VAR_INTEGER
},
865 { "marq-refresh", VLC_VAR_INTEGER
},
866 { "marq-size", VLC_VAR_INTEGER
},
867 { "marq-timeout", VLC_VAR_INTEGER
},
868 { "marq-x", VLC_VAR_INTEGER
},
869 { "marq-y", VLC_VAR_INTEGER
},
871 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
873 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
875 libvlc_printerr( "Unknown marquee option" );
879 /*****************************************************************************
880 * libvlc_video_get_marquee_int : get a marq option value
881 *****************************************************************************/
882 int libvlc_video_get_marquee_int( libvlc_media_player_t
*p_mi
,
885 return get_int( p_mi
, "marq", marq_option_bynumber(option
) );
888 /*****************************************************************************
889 * libvlc_video_get_marquee_string : get a marq option value
890 *****************************************************************************/
891 char * libvlc_video_get_marquee_string( libvlc_media_player_t
*p_mi
,
894 return get_string( p_mi
, "marq", marq_option_bynumber(option
) );
897 /*****************************************************************************
898 * libvlc_video_set_marquee_int: enable, disable or set an int option
899 *****************************************************************************/
900 void libvlc_video_set_marquee_int( libvlc_media_player_t
*p_mi
,
901 unsigned option
, int value
)
903 set_value( p_mi
, "marq", marq_option_bynumber(option
), VLC_VAR_INTEGER
,
904 &(vlc_value_t
) { .i_int
= value
}, true );
907 /*****************************************************************************
908 * libvlc_video_set_marquee_string: set a string option
909 *****************************************************************************/
910 void libvlc_video_set_marquee_string( libvlc_media_player_t
*p_mi
,
911 unsigned option
, const char * value
)
913 set_value( p_mi
, "marq", marq_option_bynumber(option
), VLC_VAR_STRING
,
914 &(vlc_value_t
){ .psz_string
= (char *)value
}, true );
918 /* logo module support */
921 logo_option_bynumber( unsigned option
)
923 static const opt_t vlogo_optlist
[] =
924 /* depends on libvlc_video_logo_option_t */
927 { "logo-file", VLC_VAR_STRING
},
928 { "logo-x", VLC_VAR_INTEGER
},
929 { "logo-y", VLC_VAR_INTEGER
},
930 { "logo-delay", VLC_VAR_INTEGER
},
931 { "logo-repeat", VLC_VAR_INTEGER
},
932 { "logo-opacity", VLC_VAR_INTEGER
},
933 { "logo-position", VLC_VAR_INTEGER
},
935 enum { num_vlogo_opts
= sizeof(vlogo_optlist
) / sizeof(*vlogo_optlist
) };
937 const opt_t
*r
= option
< num_vlogo_opts
? vlogo_optlist
+option
: NULL
;
939 libvlc_printerr( "Unknown logo option" );
943 void libvlc_video_set_logo_string( libvlc_media_player_t
*p_mi
,
944 unsigned option
, const char *psz_value
)
946 set_value( p_mi
,"logo",logo_option_bynumber(option
), VLC_VAR_STRING
,
947 &(vlc_value_t
){ .psz_string
= (char *)psz_value
}, true );
951 void libvlc_video_set_logo_int( libvlc_media_player_t
*p_mi
,
952 unsigned option
, int value
)
954 set_value( p_mi
, "logo", logo_option_bynumber(option
), VLC_VAR_INTEGER
,
955 &(vlc_value_t
) { .i_int
= value
}, true );
959 int libvlc_video_get_logo_int( libvlc_media_player_t
*p_mi
,
962 return get_int( p_mi
, "logo", logo_option_bynumber(option
) );
966 /* adjust module support */
970 adjust_option_bynumber( unsigned option
)
972 static const opt_t optlist
[] =
975 { "contrast", VLC_VAR_FLOAT
},
976 { "brightness", VLC_VAR_FLOAT
},
977 { "hue", VLC_VAR_FLOAT
},
978 { "saturation", VLC_VAR_FLOAT
},
979 { "gamma", VLC_VAR_FLOAT
},
981 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
983 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
985 libvlc_printerr( "Unknown adjust option" );
990 void libvlc_video_set_adjust_int( libvlc_media_player_t
*p_mi
,
991 unsigned option
, int value
)
993 set_value( p_mi
, "adjust", adjust_option_bynumber(option
), VLC_VAR_INTEGER
,
994 &(vlc_value_t
) { .i_int
= value
}, false );
998 int libvlc_video_get_adjust_int( libvlc_media_player_t
*p_mi
,
1001 return get_int( p_mi
, "adjust", adjust_option_bynumber(option
) );
1005 void libvlc_video_set_adjust_float( libvlc_media_player_t
*p_mi
,
1006 unsigned option
, float value
)
1008 set_value( p_mi
, "adjust", adjust_option_bynumber(option
), VLC_VAR_FLOAT
,
1009 &(vlc_value_t
) { .f_float
= value
}, false );
1013 float libvlc_video_get_adjust_float( libvlc_media_player_t
*p_mi
,
1016 return get_float( p_mi
, "adjust", adjust_option_bynumber(option
) );