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_media.h>
34 #include <vlc/libvlc_media_player.h>
36 #include <vlc_common.h>
37 #include <vlc_input.h>
40 #include "media_player_internal.h"
45 * Remember to release the returned vout_thread_t.
47 static vout_thread_t
**GetVouts( libvlc_media_player_t
*p_mi
, size_t *n
)
49 input_thread_t
*p_input
= libvlc_get_input_thread( p_mi
);
56 vout_thread_t
**pp_vouts
;
57 if (input_Control( p_input
, INPUT_GET_VOUTS
, &pp_vouts
, n
))
62 vlc_object_release (p_input
);
66 static vout_thread_t
*GetVout (libvlc_media_player_t
*mp
, size_t num
)
68 vout_thread_t
*p_vout
= NULL
;
70 vout_thread_t
**pp_vouts
= GetVouts (mp
, &n
);
75 p_vout
= pp_vouts
[num
];
77 for (size_t i
= 0; i
< n
; i
++)
79 vlc_object_release (pp_vouts
[i
]);
84 libvlc_printerr ("Video output not active");
88 /**********************************************************************
90 **********************************************************************/
92 void libvlc_set_fullscreen( libvlc_media_player_t
*p_mi
, int b_fullscreen
)
94 /* This will work even if the video is not currently active */
95 var_SetBool (p_mi
, "fullscreen", !!b_fullscreen
);
97 /* Apply to current video outputs (if any) */
99 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
100 for (size_t i
= 0; i
< n
; i
++)
102 var_SetBool (pp_vouts
[i
], "fullscreen", b_fullscreen
);
103 vlc_object_release (pp_vouts
[i
]);
108 int libvlc_get_fullscreen( libvlc_media_player_t
*p_mi
)
110 return var_GetBool (p_mi
, "fullscreen");
113 void libvlc_toggle_fullscreen( libvlc_media_player_t
*p_mi
)
115 bool b_fullscreen
= var_ToggleBool (p_mi
, "fullscreen");
117 /* Apply to current video outputs (if any) */
119 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
120 for (size_t i
= 0; i
< n
; i
++)
122 vout_thread_t
*p_vout
= pp_vouts
[i
];
124 var_SetBool (p_vout
, "fullscreen", b_fullscreen
);
125 vlc_object_release (p_vout
);
130 void libvlc_video_set_key_input( libvlc_media_player_t
*p_mi
, unsigned on
)
132 var_SetBool (p_mi
, "keyboard-events", !!on
);
135 void libvlc_video_set_mouse_input( libvlc_media_player_t
*p_mi
, unsigned on
)
137 var_SetBool (p_mi
, "mouse-events", !!on
);
141 libvlc_video_take_snapshot( libvlc_media_player_t
*p_mi
, unsigned num
,
142 const char *psz_filepath
,
143 unsigned int i_width
, unsigned int i_height
)
145 assert( psz_filepath
);
147 vout_thread_t
*p_vout
= GetVout (p_mi
, num
);
151 /* FIXME: This is not atomic. All parameters should be passed at once
152 * (obviously _not_ with var_*()). Also, the libvlc object should not be
153 * used for the callbacks: that breaks badly if there are concurrent
154 * media players in the instance. */
155 var_Create( p_vout
, "snapshot-width", VLC_VAR_INTEGER
);
156 var_SetInteger( p_vout
, "snapshot-width", i_width
);
157 var_Create( p_vout
, "snapshot-height", VLC_VAR_INTEGER
);
158 var_SetInteger( p_vout
, "snapshot-height", i_height
);
159 var_Create( p_vout
, "snapshot-path", VLC_VAR_STRING
);
160 var_SetString( p_vout
, "snapshot-path", psz_filepath
);
161 var_Create( p_vout
, "snapshot-format", VLC_VAR_STRING
);
162 var_SetString( p_vout
, "snapshot-format", "png" );
163 var_TriggerCallback( p_vout
, "video-snapshot" );
164 vlc_object_release( p_vout
);
168 int libvlc_video_get_size( libvlc_media_player_t
*p_mi
, unsigned num
,
169 unsigned *restrict px
, unsigned *restrict py
)
171 libvlc_media_track_info_t
*info
;
175 int infos
= libvlc_media_get_tracks_info(p_mi
->p_md
, &info
);
179 for (int i
= 0; i
< infos
; i
++)
180 if (info
[i
].i_type
== libvlc_track_video
&& num
-- == 0) {
181 *px
= info
[i
].u
.video
.i_width
;
182 *py
= info
[i
].u
.video
.i_height
;
191 int libvlc_video_get_height( libvlc_media_player_t
*p_mi
)
193 unsigned width
, height
;
195 if (libvlc_video_get_size (p_mi
, 0, &width
, &height
))
200 int libvlc_video_get_width( libvlc_media_player_t
*p_mi
)
202 unsigned width
, height
;
204 if (libvlc_video_get_size (p_mi
, 0, &width
, &height
))
209 int libvlc_video_get_cursor( libvlc_media_player_t
*mp
, unsigned num
,
210 int *restrict px
, int *restrict py
)
212 vout_thread_t
*p_vout
= GetVout (mp
, num
);
216 var_GetCoords (p_vout
, "mouse-moved", px
, py
);
217 vlc_object_release (p_vout
);
221 unsigned libvlc_media_player_has_vout( libvlc_media_player_t
*p_mi
)
224 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
225 for (size_t i
= 0; i
< n
; i
++)
226 vlc_object_release (pp_vouts
[i
]);
231 float libvlc_video_get_scale( libvlc_media_player_t
*mp
)
233 float f_scale
= var_GetFloat (mp
, "zoom");
234 if (var_GetBool (mp
, "autoscale"))
239 void libvlc_video_set_scale( libvlc_media_player_t
*p_mp
, float f_scale
)
241 if (isfinite(f_scale
) && f_scale
!= 0.f
)
242 var_SetFloat (p_mp
, "zoom", f_scale
);
243 var_SetBool (p_mp
, "autoscale", f_scale
== 0.f
);
245 /* Apply to current video outputs (if any) */
247 vout_thread_t
**pp_vouts
= GetVouts (p_mp
, &n
);
248 for (size_t i
= 0; i
< n
; i
++)
250 vout_thread_t
*p_vout
= pp_vouts
[i
];
252 if (isfinite(f_scale
) && f_scale
!= 0.f
)
253 var_SetFloat (p_vout
, "zoom", f_scale
);
254 var_SetBool (p_vout
, "autoscale", f_scale
== 0.f
);
255 vlc_object_release (p_vout
);
260 char *libvlc_video_get_aspect_ratio( libvlc_media_player_t
*p_mi
)
262 return var_GetNonEmptyString (p_mi
, "aspect-ratio");
265 void libvlc_video_set_aspect_ratio( libvlc_media_player_t
*p_mi
,
266 const char *psz_aspect
)
268 if (psz_aspect
== NULL
)
270 var_SetString (p_mi
, "aspect-ratio", psz_aspect
);
273 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
274 for (size_t i
= 0; i
< n
; i
++)
276 vout_thread_t
*p_vout
= pp_vouts
[i
];
278 var_SetString (p_vout
, "aspect-ratio", psz_aspect
);
279 vlc_object_release (p_vout
);
284 int libvlc_video_get_spu( libvlc_media_player_t
*p_mi
)
286 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
288 if( !p_input_thread
)
290 libvlc_printerr( "No active input" );
294 int i_spu
= var_GetInteger( p_input_thread
, "spu-es" );
295 vlc_object_release( p_input_thread
);
299 int libvlc_video_get_spu_count( libvlc_media_player_t
*p_mi
)
301 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
304 if( !p_input_thread
)
307 i_spu_count
= var_CountChoices( p_input_thread
, "spu-es" );
308 vlc_object_release( p_input_thread
);
312 libvlc_track_description_t
*
313 libvlc_video_get_spu_description( libvlc_media_player_t
*p_mi
)
315 return libvlc_get_track_description( p_mi
, "spu-es" );
318 int libvlc_video_set_spu( libvlc_media_player_t
*p_mi
, int i_spu
)
320 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
324 if( !p_input_thread
)
327 var_Change (p_input_thread
, "spu-es", VLC_VAR_GETCHOICES
, &list
, NULL
);
328 for (int i
= 0; i
< list
.p_list
->i_count
; i
++)
330 if( i_spu
== list
.p_list
->p_values
[i
].i_int
)
332 if( var_SetInteger( p_input_thread
, "spu-es", i_spu
) < 0 )
338 libvlc_printerr( "Track identifier not found" );
340 vlc_object_release (p_input_thread
);
341 var_FreeList (&list
, NULL
);
345 int libvlc_video_set_subtitle_file( libvlc_media_player_t
*p_mi
,
346 const char *psz_subtitle
)
348 input_thread_t
*p_input_thread
= libvlc_get_input_thread ( p_mi
);
353 if( !input_AddSubtitle( p_input_thread
, psz_subtitle
, true ) )
355 vlc_object_release( p_input_thread
);
360 int64_t libvlc_video_get_spu_delay( libvlc_media_player_t
*p_mi
)
362 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
367 val
= var_GetInteger( p_input_thread
, "spu-delay" );
368 vlc_object_release( p_input_thread
);
372 libvlc_printerr( "No active input" );
378 int libvlc_video_set_spu_delay( libvlc_media_player_t
*p_mi
,
381 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
386 var_SetInteger( p_input_thread
, "spu-delay", i_delay
);
387 vlc_object_release( p_input_thread
);
392 libvlc_printerr( "No active input" );
398 libvlc_track_description_t
*
399 libvlc_video_get_title_description( libvlc_media_player_t
*p_mi
)
401 return libvlc_get_track_description( p_mi
, "title" );
404 libvlc_track_description_t
*
405 libvlc_video_get_chapter_description( libvlc_media_player_t
*p_mi
,
408 char psz_title
[sizeof ("title ") + 3 * sizeof (int)];
409 sprintf( psz_title
, "title %2u", i_title
);
410 return libvlc_get_track_description( p_mi
, psz_title
);
413 char *libvlc_video_get_crop_geometry (libvlc_media_player_t
*p_mi
)
415 return var_GetNonEmptyString (p_mi
, "crop");
418 void libvlc_video_set_crop_geometry( libvlc_media_player_t
*p_mi
,
419 const char *psz_geometry
)
421 if (psz_geometry
== NULL
)
424 var_SetString (p_mi
, "crop", psz_geometry
);
427 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
429 for (size_t i
= 0; i
< n
; i
++)
431 vout_thread_t
*p_vout
= pp_vouts
[i
];
434 /* Make sure the geometry is in the choice list */
435 /* Earlier choices are removed to not grow a long list over time. */
436 /* FIXME: not atomic - lock? */
437 val
.psz_string
= (char *)psz_geometry
;
438 var_Change (p_vout
, "crop", VLC_VAR_CLEARCHOICES
, NULL
, NULL
);
439 var_Change (p_vout
, "crop", VLC_VAR_ADDCHOICE
, &val
, &val
);
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 void libvlc_video_set_teletext( libvlc_media_player_t
*p_mi
, int i_page
)
453 input_thread_t
*p_input_thread
;
454 vlc_object_t
*p_zvbi
= NULL
;
457 var_SetInteger (p_mi
, "vbi-page", i_page
);
459 p_input_thread
= libvlc_get_input_thread( p_mi
);
460 if( !p_input_thread
) return;
462 if( var_CountChoices( p_input_thread
, "teletext-es" ) <= 0 )
464 vlc_object_release( p_input_thread
);
468 telx
= var_GetInteger( p_input_thread
, "teletext-es" );
469 if( input_GetEsObjects( p_input_thread
, telx
, &p_zvbi
, NULL
, NULL
)
472 var_SetInteger( p_zvbi
, "vbi-page", i_page
);
473 vlc_object_release( p_zvbi
);
475 vlc_object_release( p_input_thread
);
478 void libvlc_toggle_teletext( libvlc_media_player_t
*p_mi
)
480 input_thread_t
*p_input_thread
;
482 p_input_thread
= libvlc_get_input_thread(p_mi
);
483 if( !p_input_thread
) return;
485 if( var_CountChoices( p_input_thread
, "teletext-es" ) <= 0 )
487 vlc_object_release( p_input_thread
);
490 const bool b_selected
= var_GetInteger( p_input_thread
, "teletext-es" ) >= 0;
493 var_SetInteger( p_input_thread
, "spu-es", -1 );
498 if( !var_Change( p_input_thread
, "teletext-es", VLC_VAR_GETCHOICES
, &list
, NULL
) )
500 if( list
.p_list
->i_count
> 0 )
501 var_SetInteger( p_input_thread
, "spu-es", list
.p_list
->p_values
[0].i_int
);
503 var_FreeList( &list
, NULL
);
506 vlc_object_release( p_input_thread
);
509 int libvlc_video_get_track_count( libvlc_media_player_t
*p_mi
)
511 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
514 if( !p_input_thread
)
517 i_track_count
= var_CountChoices( p_input_thread
, "video-es" );
519 vlc_object_release( p_input_thread
);
520 return i_track_count
;
523 libvlc_track_description_t
*
524 libvlc_video_get_track_description( libvlc_media_player_t
*p_mi
)
526 return libvlc_get_track_description( p_mi
, "video-es" );
529 int libvlc_video_get_track( libvlc_media_player_t
*p_mi
)
531 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
533 if( !p_input_thread
)
536 int id
= var_GetInteger( p_input_thread
, "video-es" );
537 vlc_object_release( p_input_thread
);
541 int libvlc_video_set_track( libvlc_media_player_t
*p_mi
, int i_track
)
543 input_thread_t
*p_input_thread
= libvlc_get_input_thread( p_mi
);
544 vlc_value_t val_list
;
547 if( !p_input_thread
)
550 var_Change( p_input_thread
, "video-es", VLC_VAR_GETCHOICES
, &val_list
, NULL
);
551 for( int i
= 0; i
< val_list
.p_list
->i_count
; i
++ )
553 if( i_track
== val_list
.p_list
->p_values
[i
].i_int
)
555 if( var_SetBool( p_input_thread
, "video", true ) < 0)
557 if( var_SetInteger( p_input_thread
, "video-es", i_track
) < 0 )
563 libvlc_printerr( "Track identifier not found" );
565 var_FreeList( &val_list
, NULL
);
566 vlc_object_release( p_input_thread
);
570 /******************************************************************************
571 * libvlc_video_set_deinterlace : enable deinterlace
572 *****************************************************************************/
573 void libvlc_video_set_deinterlace( libvlc_media_player_t
*p_mi
,
574 const char *psz_mode
)
576 if (psz_mode
== NULL
)
579 && strcmp (psz_mode
, "blend") && strcmp (psz_mode
, "bob")
580 && strcmp (psz_mode
, "discard") && strcmp (psz_mode
, "linear")
581 && strcmp (psz_mode
, "mean") && strcmp (psz_mode
, "x")
582 && strcmp (psz_mode
, "yadif") && strcmp (psz_mode
, "yadif2x")
583 && strcmp (psz_mode
, "phosphor") && strcmp (psz_mode
, "ivtc"))
588 var_SetString (p_mi
, "deinterlace-mode", psz_mode
);
589 var_SetInteger (p_mi
, "deinterlace", 1);
592 var_SetInteger (p_mi
, "deinterlace", 0);
595 vout_thread_t
**pp_vouts
= GetVouts (p_mi
, &n
);
596 for (size_t i
= 0; i
< n
; i
++)
598 vout_thread_t
*p_vout
= pp_vouts
[i
];
602 var_SetString (p_vout
, "deinterlace-mode", psz_mode
);
603 var_SetInteger (p_vout
, "deinterlace", 1);
606 var_SetInteger (p_vout
, "deinterlace", 0);
607 vlc_object_release (p_vout
);
616 static bool find_sub_source_by_name( libvlc_media_player_t
*p_mi
, const char *restrict name
)
618 vout_thread_t
*vout
= GetVout( p_mi
, 0 );
622 char *psz_sources
= var_GetString( vout
, "sub-source" );
625 libvlc_printerr( "%s not enabled", name
);
626 vlc_object_release( vout
);
631 char *p
= strstr( psz_sources
, name
);
633 vlc_object_release( vout
);
637 typedef const struct {
643 set_int( libvlc_media_player_t
*p_mi
, const char *restrict name
,
644 const opt_t
*restrict opt
, int value
)
650 case 0: /* the enabler */
652 vout_thread_t
*vout
= GetVout( p_mi
, 0 );
654 { /* Fill sub-source */
655 vout_EnableFilter( vout
, opt
->name
, value
, false );
656 var_TriggerCallback( vout
, "sub-source" );
657 vlc_object_release( vout
);
661 case VLC_VAR_INTEGER
:
662 var_SetInteger( p_mi
, opt
->name
, value
);
665 var_SetFloat( p_mi
, opt
->name
, value
);
668 libvlc_printerr( "Invalid argument to %s in %s", name
, "set int" );
674 get_int( libvlc_media_player_t
*p_mi
, const char *restrict name
,
675 const opt_t
*restrict opt
)
681 case 0: /* the enabler */
683 bool b_enabled
= find_sub_source_by_name( p_mi
, name
);
684 return b_enabled
? 1 : 0;
686 case VLC_VAR_INTEGER
:
687 return var_GetInteger(p_mi
, opt
->name
);
689 return lroundf(var_GetFloat(p_mi
, opt
->name
));
691 libvlc_printerr( "Invalid argument to %s in %s", name
, "get int" );
697 set_float( libvlc_media_player_t
*p_mi
, const char *restrict name
,
698 const opt_t
*restrict opt
, float value
)
702 if( opt
->type
!= VLC_VAR_FLOAT
)
704 libvlc_printerr( "Invalid argument to %s in %s", name
, "set float" );
708 var_SetFloat( p_mi
, opt
->name
, value
);
712 get_float( libvlc_media_player_t
*p_mi
, const char *restrict name
,
713 const opt_t
*restrict opt
)
715 if( !opt
) return 0.0;
717 if( opt
->type
!= VLC_VAR_FLOAT
)
719 libvlc_printerr( "Invalid argument to %s in %s", name
, "get float" );
723 return var_GetFloat( p_mi
, opt
->name
);
727 set_string( libvlc_media_player_t
*p_mi
, const char *restrict name
,
728 const opt_t
*restrict opt
, const char *restrict psz_value
)
732 if( opt
->type
!= VLC_VAR_STRING
)
734 libvlc_printerr( "Invalid argument to %s in %s", name
, "set string" );
738 var_SetString( p_mi
, opt
->name
, psz_value
);
742 get_string( libvlc_media_player_t
*p_mi
, const char *restrict name
,
743 const opt_t
*restrict opt
)
745 if( !opt
) return NULL
;
747 if( opt
->type
!= VLC_VAR_STRING
)
749 libvlc_printerr( "Invalid argument to %s in %s", name
, "get string" );
753 return var_GetString( p_mi
, opt
->name
);
757 marq_option_bynumber(unsigned option
)
759 static const opt_t optlist
[] =
762 { "marq-marquee", VLC_VAR_STRING
},
763 { "marq-color", VLC_VAR_INTEGER
},
764 { "marq-opacity", VLC_VAR_INTEGER
},
765 { "marq-position", VLC_VAR_INTEGER
},
766 { "marq-refresh", VLC_VAR_INTEGER
},
767 { "marq-size", VLC_VAR_INTEGER
},
768 { "marq-timeout", VLC_VAR_INTEGER
},
769 { "marq-x", VLC_VAR_INTEGER
},
770 { "marq-y", VLC_VAR_INTEGER
},
772 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
774 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
776 libvlc_printerr( "Unknown marquee option" );
780 /*****************************************************************************
781 * libvlc_video_get_marquee_int : get a marq option value
782 *****************************************************************************/
783 int libvlc_video_get_marquee_int( libvlc_media_player_t
*p_mi
,
786 return get_int( p_mi
, "marq", marq_option_bynumber(option
) );
789 /*****************************************************************************
790 * libvlc_video_get_marquee_string : get a marq option value
791 *****************************************************************************/
792 char * libvlc_video_get_marquee_string( libvlc_media_player_t
*p_mi
,
795 return get_string( p_mi
, "marq", marq_option_bynumber(option
) );
798 /*****************************************************************************
799 * libvlc_video_set_marquee_int: enable, disable or set an int option
800 *****************************************************************************/
801 void libvlc_video_set_marquee_int( libvlc_media_player_t
*p_mi
,
802 unsigned option
, int value
)
804 set_int( p_mi
, "marq", marq_option_bynumber(option
), value
);
807 /*****************************************************************************
808 * libvlc_video_set_marquee_string: set a string option
809 *****************************************************************************/
810 void libvlc_video_set_marquee_string( libvlc_media_player_t
*p_mi
,
811 unsigned option
, const char * value
)
813 set_string( p_mi
, "marq", marq_option_bynumber(option
), value
);
817 /* logo module support */
820 logo_option_bynumber( unsigned option
)
822 static const opt_t vlogo_optlist
[] =
823 /* depends on libvlc_video_logo_option_t */
826 { "logo-file", VLC_VAR_STRING
},
827 { "logo-x", VLC_VAR_INTEGER
},
828 { "logo-y", VLC_VAR_INTEGER
},
829 { "logo-delay", VLC_VAR_INTEGER
},
830 { "logo-repeat", VLC_VAR_INTEGER
},
831 { "logo-opacity", VLC_VAR_INTEGER
},
832 { "logo-position", VLC_VAR_INTEGER
},
834 enum { num_vlogo_opts
= sizeof(vlogo_optlist
) / sizeof(*vlogo_optlist
) };
836 const opt_t
*r
= option
< num_vlogo_opts
? vlogo_optlist
+option
: NULL
;
838 libvlc_printerr( "Unknown logo option" );
842 void libvlc_video_set_logo_string( libvlc_media_player_t
*p_mi
,
843 unsigned option
, const char *psz_value
)
845 set_string( p_mi
,"logo",logo_option_bynumber(option
), psz_value
);
849 void libvlc_video_set_logo_int( libvlc_media_player_t
*p_mi
,
850 unsigned option
, int value
)
852 set_int( p_mi
, "logo", logo_option_bynumber(option
), value
);
856 int libvlc_video_get_logo_int( libvlc_media_player_t
*p_mi
,
859 return get_int( p_mi
, "logo", logo_option_bynumber(option
) );
863 /* adjust module support */
867 adjust_option_bynumber( unsigned option
)
869 static const opt_t optlist
[] =
872 { "contrast", VLC_VAR_FLOAT
},
873 { "brightness", VLC_VAR_FLOAT
},
874 { "hue", VLC_VAR_FLOAT
},
875 { "saturation", VLC_VAR_FLOAT
},
876 { "gamma", VLC_VAR_FLOAT
},
878 enum { num_opts
= sizeof(optlist
) / sizeof(*optlist
) };
880 const opt_t
*r
= option
< num_opts
? optlist
+option
: NULL
;
882 libvlc_printerr( "Unknown adjust option" );
887 void libvlc_video_set_adjust_int( libvlc_media_player_t
*p_mi
,
888 unsigned option
, int value
)
890 set_int( p_mi
, "adjust", adjust_option_bynumber(option
), value
);
894 int libvlc_video_get_adjust_int( libvlc_media_player_t
*p_mi
,
897 return get_int( p_mi
, "adjust", adjust_option_bynumber(option
) );
901 void libvlc_video_set_adjust_float( libvlc_media_player_t
*p_mi
,
902 unsigned option
, float value
)
904 set_float( p_mi
, "adjust", adjust_option_bynumber(option
), value
);
908 float libvlc_video_get_adjust_float( libvlc_media_player_t
*p_mi
,
911 return get_float( p_mi
, "adjust", adjust_option_bynumber(option
) );