VLC 4.0.0-dev
Loading...
Searching...
No Matches
vlc_variables.h
Go to the documentation of this file.
1/*****************************************************************************
2 * vlc_variables.h: variables handling
3 *****************************************************************************
4 * Copyright (C) 2002-2004 VLC authors and VideoLAN
5 *
6 * Authors: Samuel Hocevar <sam@zoy.org>
7 * Gildas Bazin <gbazin@netcourrier.com>
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU Lesser General Public License as published by
11 * the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this program; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
22 *****************************************************************************/
23
24#ifndef VLC_VARIABLES_H
25#define VLC_VARIABLES_H 1
26
27/**
28 * \defgroup variables Variables
29 * \ingroup vlc_object
30 *
31 * VLC object variables and callbacks
32 *
33 * @{
34 * \file
35 * VLC object variables and callbacks interface
36 */
37
38#define VLC_VAR_TYPE 0x00ff
39#define VLC_VAR_CLASS 0x00f0
40#define VLC_VAR_FLAGS 0xff00
42/**
43 * \defgroup var_type Variable types
44 * These are the different types a vlc variable can have.
45 * @{
46 */
47#define VLC_VAR_VOID 0x0010
48#define VLC_VAR_BOOL 0x0020
49#define VLC_VAR_INTEGER 0x0030
50#define VLC_VAR_STRING 0x0040
51#define VLC_VAR_FLOAT 0x0050
52#define VLC_VAR_ADDRESS 0x0070
53#define VLC_VAR_COORDS 0x00A0
54/**@}*/
55
56/** \defgroup var_flags Additive flags
57 * These flags are added to the type field of the variable. Most as a result of
58 * a var_Change() call, but some may be added at creation time
59 * @{
60 */
61#define VLC_VAR_HASCHOICE 0x0100
63#define VLC_VAR_ISCOMMAND 0x2000
65/** Creation flag */
66/* If the variable is not found on the current module
67 search all parents and finally module config until found */
68#define VLC_VAR_DOINHERIT 0x8000
69/**@}*/
70
71/**
72 * \defgroup var_action Variable actions
73 * These are the different actions that can be used with var_Change().
74 * The parameters given are the meaning of the two last parameters of
75 * var_Change() when this action is being used.
76 * @{
77 */
78
79#define VLC_VAR_SETSTEP 0x0012
81/**
82 * Set the value of this variable without triggering any callbacks
83 * \param p_val The new value
84 * \param p_val2 Unused
85 */
86#define VLC_VAR_SETVALUE 0x0013
88#define VLC_VAR_SETTEXT 0x0014
89#define VLC_VAR_GETTEXT 0x0015
91#define VLC_VAR_GETMIN 0x0016
92#define VLC_VAR_GETMAX 0x0017
93#define VLC_VAR_GETSTEP 0x0018
95#define VLC_VAR_ADDCHOICE 0x0020
96#define VLC_VAR_DELCHOICE 0x0021
97#define VLC_VAR_CLEARCHOICES 0x0022
98#define VLC_VAR_GETCHOICES 0x0024
100#define VLC_VAR_CHOICESCOUNT 0x0026
101#define VLC_VAR_SETMINMAX 0x0027
103/**@}*/
104
105/**
106 * Variable actions.
107 *
108 * These are the different actions that can be used with var_GetAndSet().
109 */
111 VLC_VAR_BOOL_TOGGLE, /**< Invert a boolean value (param ignored) */
112 VLC_VAR_INTEGER_ADD, /**< Add parameter to an integer value */
113 VLC_VAR_INTEGER_OR, /**< Binary OR over an integer bits field */
114 VLC_VAR_INTEGER_NAND,/**< Binary NAND over an integer bits field */
116
117/**
118 * VLC value structure
119 */
120typedef union
122 int64_t i_int;
123 bool b_bool;
124 float f_float;
125 char * psz_string;
126 void * p_address;
127 struct { int32_t x; int32_t y; } coords;
130
131/*****************************************************************************
132 * Variable callbacks: called when the value is modified
133 *****************************************************************************/
134typedef int ( * vlc_callback_t ) ( vlc_object_t *, /* variable's object */
135 char const *, /* variable name */
136 vlc_value_t, /* old value */
137 vlc_value_t, /* new value */
138 void * ); /* callback data */
139
140/*****************************************************************************
141 * List callbacks: called when elements are added/removed from the list
142 *****************************************************************************/
143typedef int ( * vlc_list_callback_t ) ( vlc_object_t *, /* variable's object */
144 char const *, /* variable name */
145 int, /* VLC_VAR_* action */
146 vlc_value_t *, /* new/deleted value */
147 void *); /* callback data */
148
149/**
150 * Creates a VLC object variable.
151 *
152 * This function creates a named variable within a VLC object.
153 * If a variable already exists with the same name within the same object, its
154 * reference count is incremented instead.
155 *
156 * \param obj Object to hold the variable
157 * \param name Variable name
158 * \param type Variable type. Must be one of \ref var_type combined with
159 * zero or more \ref var_flags
160 */
161VLC_API int var_Create(vlc_object_t *obj, const char *name, int type);
162
163/**
164 * Destroys a VLC object variable.
165 *
166 * This function decrements the reference count of a named variable within a
167 * VLC object. If the reference count reaches zero, the variable is destroyed.
168 *
169 * \param obj Object holding the variable
170 * \param name Variable name
171 */
172VLC_API void var_Destroy(vlc_object_t *obj, const char *name);
173
174/**
175 * Performs a special action on a variable.
176 *
177 * \param obj Object holding the variable
178 * \param name Variable name
179 * \param action Action to perform. Must be one of \ref var_action
180 */
181VLC_API int var_Change(vlc_object_t *obj, const char *name, int action, ...);
182
183/**
184 * Get the type of a variable.
185 *
186 * \see var_type
187 *
188 * \return The variable type if it exists
189 * or 0 if the variable could not be found.
190 */
191VLC_API int var_Type(vlc_object_t *obj, const char *name) VLC_USED;
192
193/**
194 * Sets a variable value.
195 *
196 * \param obj Object holding the variable
197 * \param name Variable name
198 * \param val Variable value to set
199 */
200VLC_API int var_Set(vlc_object_t *obj, const char *name, vlc_value_t val);
201
202/**
203 * Gets a variable value.
204 *
205 * \param obj Object holding the variable
206 * \param name Variable name
207 * \param valp Pointer to a \ref vlc_value_t object to hold the value [OUT]
208 */
209VLC_API int var_Get(vlc_object_t *obj, const char *name, vlc_value_t *valp);
210
211VLC_API int var_SetChecked( vlc_object_t *, const char *, int, vlc_value_t );
212VLC_API int var_GetChecked( vlc_object_t *, const char *, int, vlc_value_t * );
213
214/**
215 * Perform an atomic read-modify-write of a variable.
216 *
217 * \param obj object holding the variable
218 * \param name variable name
219 * \param op read-modify-write operation to perform
220 * (see \ref vlc_var_atomic_op)
221 * \param value value of the variable after the modification
222 * \retval VLC_SUCCESS Operation successful
223 * \retval VLC_ENOENT Variable not found
224 *
225 * \bug The modified value is returned rather than the original value.
226 * As such, the original value cannot be known in the case of non-reversible
227 * operation such as \ref VLC_VAR_INTEGER_OR and \ref VLC_VAR_INTEGER_NAND.
228 */
229VLC_API int var_GetAndSet(vlc_object_t *obj, const char *name, int op,
230 vlc_value_t *value);
231
232/**
233 * Finds the value of a variable.
234 *
235 * If the specified object does not hold a variable with the specified name,
236 * try the parent object, and iterate until the top of the objects tree. If no
237 * match is found, the value is read from the configuration.
238 */
239VLC_API int var_Inherit( vlc_object_t *, const char *, int, vlc_value_t * );
240
241
242/*****************************************************************************
243 * Variable callbacks
244 *****************************************************************************
245 * int MyCallback( vlc_object_t *p_this,
246 * char const *psz_variable,
247 * vlc_value_t oldvalue,
248 * vlc_value_t newvalue,
249 * void *p_data);
250 *****************************************************************************/
251
252/**
253 * Registers a callback for a variable.
254 *
255 * We store a function pointer that will be called upon variable
256 * modification.
257 *
258 * \param obj Object holding the variable
259 * \param name Variable name
260 * \param callback Callback function pointer
261 * \param opaque Opaque data pointer for use by the callback.
262 *
263 * \warning The callback function is run in the thread that calls var_Set() on
264 * the variable. Use proper locking. This thread may not have much
265 * time to spare, so keep callback functions short.
266 *
267 * \bug It is not possible to atomically retrieve the current value and
268 * register a callback. As a consequence, extreme care must be taken to ensure
269 * that the variable value cannot change before the callback is registered.
270 * Failure to do so will result in intractable race conditions.
271 */
272VLC_API void var_AddCallback(vlc_object_t *obj, const char *name,
273 vlc_callback_t callback, void *opaque);
274
275/**
276 * Deregisters a callback from a variable.
277 *
278 * The callback and opaque pointer must be supplied again, as the same callback
279 * function might have been registered more than once.
280 */
281VLC_API void var_DelCallback(vlc_object_t *obj, const char *name,
282 vlc_callback_t callback, void *opaque);
283
284/**
285 * Triggers callbacks on a variable.
286 *
287 * This triggers any callbacks registered on the named variable without
288 * actually modifying the variable value. This is primarily useful for
289 * variables with \ref VLC_VAR_VOID type (which do not have a value).
290 *
291 * \param obj Object holding the variable
292 * \param name Variable name
293 */
294VLC_API void var_TriggerCallback(vlc_object_t *obj, const char *name);
295
296/**
297 * Register a callback for a list variable
298 *
299 * The callback is triggered when an element is added/removed from the
300 * list or when the list is cleared.
301 *
302 * See var_AddCallback().
303 */
304VLC_API void var_AddListCallback( vlc_object_t *, const char *, vlc_list_callback_t, void * );
305
306/**
307 * Remove a callback from a list variable
308 *
309 * See var_DelCallback().
310 */
311VLC_API void var_DelListCallback( vlc_object_t *, const char *, vlc_list_callback_t, void * );
312
313/*****************************************************************************
314 * helpers functions
315 *****************************************************************************/
316
317/**
318 * Set the value of an integer variable
319 *
320 * \param p_obj The object that holds the variable
321 * \param psz_name The name of the variable
322 * \param i The new integer value of this variable
323 */
324static inline int var_SetInteger( vlc_object_t *p_obj, const char *psz_name,
325 int64_t i )
326{
327 vlc_value_t val;
328 val.i_int = i;
329 return var_SetChecked( p_obj, psz_name, VLC_VAR_INTEGER, val );
330}
331
332/**
333 * Set the value of an boolean variable
334 *
335 * \param p_obj The object that holds the variable
336 * \param psz_name The name of the variable
337 * \param b The new boolean value of this variable
338 */
339static inline int var_SetBool( vlc_object_t *p_obj, const char *psz_name, bool b )
341 vlc_value_t val;
342 val.b_bool = b;
343 return var_SetChecked( p_obj, psz_name, VLC_VAR_BOOL, val );
344}
345
346static inline int var_SetCoords( vlc_object_t *obj, const char *name,
347 int32_t x, int32_t y )
348{
349 vlc_value_t val;
350 val.coords.x = x;
351 val.coords.y = y;
352 return var_SetChecked (obj, name, VLC_VAR_COORDS, val);
353}
354
355/**
356 * Set the value of a float variable
357 *
358 * \param p_obj The object that holds the variable
359 * \param psz_name The name of the variable
360 * \param f The new float value of this variable
361 */
362static inline int var_SetFloat( vlc_object_t *p_obj, const char *psz_name, float f )
364 vlc_value_t val;
365 val.f_float = f;
366 return var_SetChecked( p_obj, psz_name, VLC_VAR_FLOAT, val );
367}
368
369/**
370 * Set the value of a string variable
371 *
372 * \param p_obj The object that holds the variable
373 * \param psz_name The name of the variable
374 * \param psz_string The new string value of this variable
375 */
376static inline int var_SetString( vlc_object_t *p_obj, const char *psz_name, const char *psz_string )
378 vlc_value_t val;
379 val.psz_string = (char *)psz_string;
380 return var_SetChecked( p_obj, psz_name, VLC_VAR_STRING, val );
381}
382
383/**
384 * Set the value of a pointer variable
385 *
386 * \param p_obj The object that holds the variable
387 * \param psz_name The name of the variable
388 * \param ptr The new pointer value of this variable
389 */
390static inline
391int var_SetAddress( vlc_object_t *p_obj, const char *psz_name, void *ptr )
393 vlc_value_t val;
394 val.p_address = ptr;
395 return var_SetChecked( p_obj, psz_name, VLC_VAR_ADDRESS, val );
396}
397
398/**
399 * Get an integer value
400*
401 * \param p_obj The object that holds the variable
402 * \param psz_name The name of the variable
403 */
405static inline int64_t var_GetInteger( vlc_object_t *p_obj, const char *psz_name )
407 vlc_value_t val;
408 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_INTEGER, &val ) )
409 return val.i_int;
410 else
411 return 0;
412}
413
414/**
415 * Get a boolean value
416 *
417 * \param p_obj The object that holds the variable
418 * \param psz_name The name of the variable
419 */
421static inline bool var_GetBool( vlc_object_t *p_obj, const char *psz_name )
423 vlc_value_t val; val.b_bool = false;
424
425 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_BOOL, &val ) )
426 return val.b_bool;
427 else
428 return false;
429}
430
431static inline void var_GetCoords( vlc_object_t *obj, const char *name,
432 int32_t *px, int32_t *py )
433{
434 vlc_value_t val;
435
436 if (likely(!var_GetChecked (obj, name, VLC_VAR_COORDS, &val)))
437 {
438 *px = val.coords.x;
439 *py = val.coords.y;
440 }
441 else
442 *px = *py = 0;
443}
444
445/**
446 * Get a float value
447 *
448 * \param p_obj The object that holds the variable
449 * \param psz_name The name of the variable
450 */
452static inline float var_GetFloat( vlc_object_t *p_obj, const char *psz_name )
454 vlc_value_t val; val.f_float = 0.0;
455 if( !var_GetChecked( p_obj, psz_name, VLC_VAR_FLOAT, &val ) )
456 return val.f_float;
457 else
458 return 0.0;
459}
460
461/**
462 * Get a string value
463 *
464 * \param p_obj The object that holds the variable
465 * \param psz_name The name of the variable
466 */
468static inline char *var_GetString( vlc_object_t *p_obj, const char *psz_name )
470 vlc_value_t val; val.psz_string = NULL;
471 if( var_GetChecked( p_obj, psz_name, VLC_VAR_STRING, &val ) )
472 return NULL;
473 else
474 return val.psz_string;
475}
476
478static inline char *var_GetNonEmptyString( vlc_object_t *p_obj, const char *psz_name )
480 vlc_value_t val;
481 if( var_GetChecked( p_obj, psz_name, VLC_VAR_STRING, &val ) )
482 return NULL;
483 if( val.psz_string && *val.psz_string )
484 return val.psz_string;
485 free( val.psz_string );
486 return NULL;
487}
488
490static inline void *var_GetAddress( vlc_object_t *p_obj, const char *psz_name )
492 vlc_value_t val;
493 if( var_GetChecked( p_obj, psz_name, VLC_VAR_ADDRESS, &val ) )
494 return NULL;
495 else
496 return val.p_address;
497}
498
499/**
500 * Increment an integer variable
501 * \param p_obj the object that holds the variable
502 * \param psz_name the name of the variable
503 */
504static inline int64_t var_IncInteger( vlc_object_t *p_obj, const char *psz_name )
506 vlc_value_t val;
507 val.i_int = 1;
508 if( var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val ) )
509 return 0;
510 return val.i_int;
511}
512
513/**
514 * Decrement an integer variable
515 * \param p_obj the object that holds the variable
516 * \param psz_name the name of the variable
517 */
518static inline int64_t var_DecInteger( vlc_object_t *p_obj, const char *psz_name )
520 vlc_value_t val;
521 val.i_int = -1;
522 if( var_GetAndSet( p_obj, psz_name, VLC_VAR_INTEGER_ADD, &val ) )
523 return 0;
524 return val.i_int;
525}
526
527static inline uint64_t var_OrInteger( vlc_object_t *obj, const char *name,
528 unsigned v )
529{
530 vlc_value_t val;
531 val.i_int = v;
532 if( var_GetAndSet( obj, name, VLC_VAR_INTEGER_OR, &val ) )
533 return 0;
534 return val.i_int;
535}
536
537static inline uint64_t var_NAndInteger( vlc_object_t *obj, const char *name,
538 unsigned v )
539{
540 vlc_value_t val;
541 val.i_int = v;
542 if( var_GetAndSet( obj, name, VLC_VAR_INTEGER_NAND, &val ) )
543 return 0;
544 return val.i_int;
545}
546
547/**
548 * Create a integer variable with inherit and get its value.
549 *
550 * \param p_obj The object that holds the variable
551 * \param psz_name The name of the variable
552 */
554static inline int64_t var_CreateGetInteger( vlc_object_t *p_obj, const char *psz_name )
557 return var_GetInteger( p_obj, psz_name );
558}
559
560/**
561 * Create a boolean variable with inherit and get its value.
562 *
563 * \param p_obj The object that holds the variable
564 * \param psz_name The name of the variable
565 */
567static inline bool var_CreateGetBool( vlc_object_t *p_obj, const char *psz_name )
570 return var_GetBool( p_obj, psz_name );
571}
572
573/**
574 * Create a float variable with inherit and get its value.
575 *
576 * \param p_obj The object that holds the variable
577 * \param psz_name The name of the variable
578 */
580static inline float var_CreateGetFloat( vlc_object_t *p_obj, const char *psz_name )
583 return var_GetFloat( p_obj, psz_name );
584}
585
586/**
587 * Create a string variable with inherit and get its value.
588 *
589 * \param p_obj The object that holds the variable
590 * \param psz_name The name of the variable
591 */
593static inline char *var_CreateGetString( vlc_object_t *p_obj,
594 const char *psz_name )
595{
597 return var_GetString( p_obj, psz_name );
598}
599
601static inline char *var_CreateGetNonEmptyString( vlc_object_t *p_obj,
602 const char *psz_name )
603{
605 return var_GetNonEmptyString( p_obj, psz_name );
606}
607
608/**
609 * Create an address variable with inherit and get its value.
610 *
611 * \param p_obj The object that holds the variable
612 * \param psz_name The name of the variable
613 */
615static inline void *var_CreateGetAddress( vlc_object_t *p_obj,
616 const char *psz_name )
617{
619 return var_GetAddress( p_obj, psz_name );
620}
621
622/**
623 * Create a integer command variable with inherit and get its value.
624 *
625 * \param p_obj The object that holds the variable
626 * \param psz_name The name of the variable
627 */
629static inline int64_t var_CreateGetIntegerCommand( vlc_object_t *p_obj, const char *psz_name )
633 return var_GetInteger( p_obj, psz_name );
634}
635
636/**
637 * Create a boolean command variable with inherit and get its value.
638 *
639 * \param p_obj The object that holds the variable
640 * \param psz_name The name of the variable
641 */
643static inline bool var_CreateGetBoolCommand( vlc_object_t *p_obj, const char *psz_name )
647 return var_GetBool( p_obj, psz_name );
648}
649
650/**
651 * Create a float command variable with inherit and get its value.
652 *
653 * \param p_obj The object that holds the variable
654 * \param psz_name The name of the variable
655 */
657static inline float var_CreateGetFloatCommand( vlc_object_t *p_obj, const char *psz_name )
661 return var_GetFloat( p_obj, psz_name );
662}
663
664/**
665 * Create a string command variable with inherit and get its value.
666 *
667 * \param p_obj The object that holds the variable
668 * \param psz_name The name of the variable
669 */
671static inline char *var_CreateGetStringCommand( vlc_object_t *p_obj,
672 const char *psz_name )
673{
676 return var_GetString( p_obj, psz_name );
677}
678
680static inline char *var_CreateGetNonEmptyStringCommand( vlc_object_t *p_obj,
681 const char *psz_name )
682{
685 return var_GetNonEmptyString( p_obj, psz_name );
686}
687
689static inline size_t var_CountChoices( vlc_object_t *p_obj, const char *psz_name )
691 size_t count;
693 return 0;
694 return count;
695}
696
697static inline bool var_ToggleBool( vlc_object_t *p_obj, const char *psz_name )
699 vlc_value_t val;
700 if( var_GetAndSet( p_obj, psz_name, VLC_VAR_BOOL_TOGGLE, &val ) )
701 return false;
702 return val.b_bool;
703}
704
706static inline bool var_InheritBool( vlc_object_t *obj, const char *name )
708 vlc_value_t val;
709
710 if( var_Inherit( obj, name, VLC_VAR_BOOL, &val ) )
711 val.b_bool = false;
712 return val.b_bool;
713}
714
716static inline int64_t var_InheritInteger( vlc_object_t *obj, const char *name )
718 vlc_value_t val;
719
720 if( var_Inherit( obj, name, VLC_VAR_INTEGER, &val ) )
721 val.i_int = 0;
722 return val.i_int;
723}
724
726static inline float var_InheritFloat( vlc_object_t *obj, const char *name )
728 vlc_value_t val;
729
730 if( var_Inherit( obj, name, VLC_VAR_FLOAT, &val ) )
731 val.f_float = 0.;
732 return val.f_float;
733}
734
736static inline char *var_InheritString( vlc_object_t *obj, const char *name )
738 vlc_value_t val;
739
740 if( var_Inherit( obj, name, VLC_VAR_STRING, &val ) )
741 val.psz_string = NULL;
742 else if( val.psz_string && !*val.psz_string )
743 {
744 free( val.psz_string );
745 val.psz_string = NULL;
746 }
747 return val.psz_string;
748}
749
751static inline void *var_InheritAddress( vlc_object_t *obj, const char *name )
753 vlc_value_t val;
754
755 if( var_Inherit( obj, name, VLC_VAR_ADDRESS, &val ) )
756 val.p_address = NULL;
757 return val.p_address;
758}
759
760
761/**
762 * Inherit a string as a fractional value.
763 *
764 * This function inherits a string, and interprets it as an unsigned rational
765 * number, i.e. a fraction. It also accepts a normally formatted floating point
766 * number.
767 *
768 * \warning The caller shall perform any and all necessary boundary checks.
769 *
770 * \note The rational number is always reduced,
771 * i.e. the returned numerator and denominator are always co-prime numbers.
772 *
773 * \note Fraction with zero as denominator are considered valid,
774 * including the undefined form zero-by-zero.
775 *
776 * \return Zero on success, an error if parsing fails.
777 */
778VLC_API int var_InheritURational(vlc_object_t *obj, unsigned *num,
779 unsigned *den, const char *name);
780
781/**
782 * Parses a string with multiple options.
783 *
784 * Parses a set of colon-separated or semicolon-separated
785 * <code>name=value</code> pairs.
786 * Some access (or access_demux) plugins uses this scheme
787 * in media resource location.
788 * @note Only trusted/safe variables are allowed. This is intended.
789 *
790 * @warning Only use this for plugins implementing VLC-specific resource
791 * location schemes. This would not make any sense for standardized ones.
792 *
793 * @param obj VLC object on which to set variables (and emit error messages)
794 * @param mrl string to parse
795 * @param prefix prefix to prepend to option names in the string
796 *
797 * @return VLC_ENOMEM on error, VLC_SUCCESS on success.
798 */
799VLC_API int var_LocationParse(vlc_object_t *obj, const char *mrl, const char *prefix);
800
801#ifndef DOC
802#define var_Create(a,b,c) var_Create(VLC_OBJECT(a), b, c)
803#define var_Destroy(a,b) var_Destroy(VLC_OBJECT(a), b)
804#define var_Change(a,b,...) var_Change(VLC_OBJECT(a), b, __VA_ARGS__)
805#define var_Type(a,b) var_Type(VLC_OBJECT(a), b)
806#define var_Set(a,b,c) var_Set(VLC_OBJECT(a), b, c)
807#define var_Get(a,b,c) var_Get(VLC_OBJECT(a), b, c)
808#define var_SetChecked(o,n,t,v) var_SetChecked(VLC_OBJECT(o), n, t, v)
809#define var_GetChecked(o,n,t,v) var_GetChecked(VLC_OBJECT(o), n, t, v)
810
811#define var_AddCallback(a,b,c,d) var_AddCallback(VLC_OBJECT(a), b, c, d)
812#define var_DelCallback(a,b,c,d) var_DelCallback(VLC_OBJECT(a), b, c, d)
813#define var_TriggerCallback(a,b) var_TriggerCallback(VLC_OBJECT(a), b)
814#define var_AddListCallback(a,b,c,d) \
815 var_AddListCallback(VLC_OBJECT(a), b, c, d)
816#define var_DelListCallback(a,b,c,d) \
817 var_DelListCallback(VLC_OBJECT(a), b, c, d)
818
819#define var_SetInteger(a,b,c) var_SetInteger(VLC_OBJECT(a), b, c)
820#define var_SetBool(a,b,c) var_SetBool(VLC_OBJECT(a), b, c)
821#define var_SetCoords(o,n,x,y) var_SetCoords(VLC_OBJECT(o), n, x, y)
822#define var_SetFloat(a,b,c) var_SetFloat(VLC_OBJECT(a), b, c)
823#define var_SetString(a,b,c) var_SetString(VLC_OBJECT(a), b, c)
824#define var_SetAddress(o, n, p) var_SetAddress(VLC_OBJECT(o), n, p)
825
826#define var_GetCoords(o,n,x,y) var_GetCoords(VLC_OBJECT(o), n, x, y)
827
828#define var_IncInteger(a,b) var_IncInteger(VLC_OBJECT(a), b)
829#define var_DecInteger(a,b) var_DecInteger(VLC_OBJECT(a), b)
830#define var_OrInteger(a,b,c) var_OrInteger(VLC_OBJECT(a), b, c)
831#define var_NAndInteger(a,b,c) var_NAndInteger(VLC_OBJECT(a), b, c)
832
833#define var_CreateGetInteger(a,b) var_CreateGetInteger(VLC_OBJECT(a), b)
834#define var_CreateGetBool(a,b) var_CreateGetBool(VLC_OBJECT(a), b)
835#define var_CreateGetFloat(a,b) var_CreateGetFloat(VLC_OBJECT(a), b)
836#define var_CreateGetString(a,b) var_CreateGetString(VLC_OBJECT(a), b)
837#define var_CreateGetNonEmptyString(a,b) \
838 var_CreateGetNonEmptyString(VLC_OBJECT(a), b)
839#define var_CreateGetAddress(a,b) var_CreateGetAddress( VLC_OBJECT(a), b)
840
841#define var_CreateGetIntegerCommand(a,b) var_CreateGetIntegerCommand( VLC_OBJECT(a),b)
842#define var_CreateGetBoolCommand(a,b) var_CreateGetBoolCommand( VLC_OBJECT(a),b)
843#define var_CreateGetFloatCommand(a,b) var_CreateGetFloatCommand( VLC_OBJECT(a),b)
844#define var_CreateGetStringCommand(a,b) var_CreateGetStringCommand( VLC_OBJECT(a),b)
845#define var_CreateGetNonEmptyStringCommand(a,b) var_CreateGetNonEmptyStringCommand( VLC_OBJECT(a),b)
846
847#define var_CountChoices(a,b) var_CountChoices(VLC_OBJECT(a),b)
848#define var_ToggleBool(a,b) var_ToggleBool(VLC_OBJECT(a),b )
849
850#define var_InheritBool(o, n) var_InheritBool(VLC_OBJECT(o), n)
851#define var_InheritInteger(o, n) var_InheritInteger(VLC_OBJECT(o), n)
852#define var_InheritFloat(o, n) var_InheritFloat(VLC_OBJECT(o), n)
853#define var_InheritString(o, n) var_InheritString(VLC_OBJECT(o), n)
854#define var_InheritAddress(o, n) var_InheritAddress(VLC_OBJECT(o), n)
855#define var_InheritURational(a,b,c,d) var_InheritURational(VLC_OBJECT(a), b, c, d)
856
857#define var_GetInteger(a,b) var_GetInteger(VLC_OBJECT(a),b)
858#define var_GetBool(a,b) var_GetBool(VLC_OBJECT(a),b)
859#define var_GetFloat(a,b) var_GetFloat(VLC_OBJECT(a),b)
860#define var_GetString(a,b) var_GetString(VLC_OBJECT(a),b)
861#define var_GetNonEmptyString(a,b) var_GetNonEmptyString( VLC_OBJECT(a),b)
862#define var_GetAddress(a,b) var_GetAddress(VLC_OBJECT(a),b)
863
864#define var_LocationParse(o, m, p) var_LocationParse(VLC_OBJECT(o), m, p)
865#endif
866
867/**
868 * @}
869 */
870#endif /* _VLC_VARIABLES_H */
size_t count
Definition core.c:403
#define VLC_USED
Definition fourcc_gen.c:32
#define VLC_API
Definition fourcc_gen.c:31
#define VLC_MALLOC
Definition vlc_common.h:157
#define likely(p)
Predicted true condition.
Definition vlc_common.h:237
#define VLC_VAR_CHOICESCOUNT
Definition vlc_variables.h:101
#define VLC_VAR_ISCOMMAND
Definition vlc_variables.h:64
#define VLC_VAR_DOINHERIT
Creation flag.
Definition vlc_variables.h:69
#define VLC_VAR_COORDS
Definition vlc_variables.h:54
#define VLC_VAR_FLOAT
Definition vlc_variables.h:52
#define VLC_VAR_BOOL
Definition vlc_variables.h:49
#define VLC_VAR_INTEGER
Definition vlc_variables.h:50
#define VLC_VAR_STRING
Definition vlc_variables.h:51
#define VLC_VAR_ADDRESS
Definition vlc_variables.h:53
static char * var_InheritString(vlc_object_t *obj, const char *name)
Definition vlc_variables.h:737
static void var_GetCoords(vlc_object_t *obj, const char *name, int32_t *px, int32_t *py)
Definition vlc_variables.h:432
static float var_GetFloat(vlc_object_t *p_obj, const char *psz_name)
Get a float value.
Definition vlc_variables.h:453
static char * var_GetNonEmptyString(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:479
int var_InheritURational(vlc_object_t *obj, unsigned *num, unsigned *den, const char *name)
Inherit a string as a fractional value.
Definition variables.c:1071
static int var_SetString(vlc_object_t *p_obj, const char *psz_name, const char *psz_string)
Set the value of a string variable.
Definition vlc_variables.h:377
int var_Set(vlc_object_t *obj, const char *name, vlc_value_t val)
Sets a variable value.
Definition variables.c:721
int var_Inherit(vlc_object_t *, const char *, int, vlc_value_t *)
Finds the value of a variable.
Definition variables.c:1038
static uint64_t var_OrInteger(vlc_object_t *obj, const char *name, unsigned v)
Definition vlc_variables.h:528
static int var_SetInteger(vlc_object_t *p_obj, const char *psz_name, int64_t i)
Set the value of an integer variable.
Definition vlc_variables.h:325
static char * var_CreateGetNonEmptyString(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:602
void var_Destroy(vlc_object_t *obj, const char *name)
Destroys a VLC object variable.
Definition variables.c:382
int var_Type(vlc_object_t *obj, const char *name)
Get the type of a variable.
Definition variables.c:655
static int64_t var_GetInteger(vlc_object_t *p_obj, const char *psz_name)
Get an integer value.
Definition vlc_variables.h:406
static float var_InheritFloat(vlc_object_t *obj, const char *name)
Definition vlc_variables.h:727
static bool var_ToggleBool(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:698
int(* vlc_list_callback_t)(vlc_object_t *, char const *, int, vlc_value_t *, void *)
Definition vlc_variables.h:144
int var_Create(vlc_object_t *obj, const char *name, int type)
Creates a VLC object variable.
Definition variables.c:289
int var_SetChecked(vlc_object_t *, const char *, int, vlc_value_t)
Definition variables.c:676
static int64_t var_CreateGetInteger(vlc_object_t *p_obj, const char *psz_name)
Create a integer variable with inherit and get its value.
Definition vlc_variables.h:555
int var_Get(vlc_object_t *obj, const char *name, vlc_value_t *valp)
Gets a variable value.
Definition variables.c:755
static int var_SetBool(vlc_object_t *p_obj, const char *psz_name, bool b)
Set the value of an boolean variable.
Definition vlc_variables.h:340
static bool var_InheritBool(vlc_object_t *obj, const char *name)
Definition vlc_variables.h:707
int(* vlc_callback_t)(vlc_object_t *, char const *, vlc_value_t, vlc_value_t, void *)
Definition vlc_variables.h:135
static int var_SetFloat(vlc_object_t *p_obj, const char *psz_name, float f)
Set the value of a float variable.
Definition vlc_variables.h:363
static bool var_CreateGetBoolCommand(vlc_object_t *p_obj, const char *psz_name)
Create a boolean command variable with inherit and get its value.
Definition vlc_variables.h:644
static void * var_GetAddress(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:491
static int64_t var_DecInteger(vlc_object_t *p_obj, const char *psz_name)
Decrement an integer variable.
Definition vlc_variables.h:519
static int var_SetCoords(vlc_object_t *obj, const char *name, int32_t x, int32_t y)
Definition vlc_variables.h:347
static int64_t var_InheritInteger(vlc_object_t *obj, const char *name)
Definition vlc_variables.h:717
static char * var_CreateGetStringCommand(vlc_object_t *p_obj, const char *psz_name)
Create a string command variable with inherit and get its value.
Definition vlc_variables.h:672
void var_AddListCallback(vlc_object_t *, const char *, vlc_list_callback_t, void *)
Register a callback for a list variable.
Definition variables.c:879
static void * var_CreateGetAddress(vlc_object_t *p_obj, const char *psz_name)
Create an address variable with inherit and get its value.
Definition vlc_variables.h:616
static float var_CreateGetFloat(vlc_object_t *p_obj, const char *psz_name)
Create a float variable with inherit and get its value.
Definition vlc_variables.h:581
static uint64_t var_NAndInteger(vlc_object_t *obj, const char *name, unsigned v)
Definition vlc_variables.h:538
static size_t var_CountChoices(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:690
int var_LocationParse(vlc_object_t *obj, const char *mrl, const char *prefix)
Parses a string with multiple options.
Definition variables.c:1009
static int var_SetAddress(vlc_object_t *p_obj, const char *psz_name, void *ptr)
Set the value of a pointer variable.
Definition vlc_variables.h:392
int var_GetAndSet(vlc_object_t *obj, const char *name, int op, vlc_value_t *value)
Perform an atomic read-modify-write of a variable.
Definition variables.c:594
static char * var_GetString(vlc_object_t *p_obj, const char *psz_name)
Get a string value.
Definition vlc_variables.h:469
static int64_t var_IncInteger(vlc_object_t *p_obj, const char *psz_name)
Increment an integer variable.
Definition vlc_variables.h:505
static bool var_GetBool(vlc_object_t *p_obj, const char *psz_name)
Get a boolean value.
Definition vlc_variables.h:422
static char * var_CreateGetString(vlc_object_t *p_obj, const char *psz_name)
Create a string variable with inherit and get its value.
Definition vlc_variables.h:594
int var_Change(vlc_object_t *obj, const char *name, int action,...)
Performs a special action on a variable.
Definition variables.c:423
vlc_var_atomic_op
Variable actions.
Definition vlc_variables.h:111
int var_GetChecked(vlc_object_t *, const char *, int, vlc_value_t *)
Definition variables.c:726
void var_DelListCallback(vlc_object_t *, const char *, vlc_list_callback_t, void *)
Remove a callback from a list variable.
Definition variables.c:889
void var_AddCallback(vlc_object_t *obj, const char *name, vlc_callback_t callback, void *opaque)
Registers a callback for a variable.
Definition variables.c:801
void var_DelCallback(vlc_object_t *obj, const char *name, vlc_callback_t callback, void *opaque)
Deregisters a callback from a variable.
Definition variables.c:854
static int64_t var_CreateGetIntegerCommand(vlc_object_t *p_obj, const char *psz_name)
Create a integer command variable with inherit and get its value.
Definition vlc_variables.h:630
static bool var_CreateGetBool(vlc_object_t *p_obj, const char *psz_name)
Create a boolean variable with inherit and get its value.
Definition vlc_variables.h:568
static float var_CreateGetFloatCommand(vlc_object_t *p_obj, const char *psz_name)
Create a float command variable with inherit and get its value.
Definition vlc_variables.h:658
static void * var_InheritAddress(vlc_object_t *obj, const char *name)
Definition vlc_variables.h:752
void var_TriggerCallback(vlc_object_t *obj, const char *name)
Triggers callbacks on a variable.
Definition variables.c:864
static char * var_CreateGetNonEmptyStringCommand(vlc_object_t *p_obj, const char *psz_name)
Definition vlc_variables.h:681
@ VLC_VAR_INTEGER_OR
Binary OR over an integer bits field.
Definition vlc_variables.h:114
@ VLC_VAR_BOOL_TOGGLE
Invert a boolean value (param ignored)
Definition vlc_variables.h:112
@ VLC_VAR_INTEGER_NAND
Binary NAND over an integer bits field.
Definition vlc_variables.h:115
@ VLC_VAR_INTEGER_ADD
Add parameter to an integer value.
Definition vlc_variables.h:113
const char name[16]
Definition httpd.c:1298
VLC object common members.
Definition vlc_objects.h:53
const char * psz_name
Definition text_style.c:33
VLC value structure.
Definition vlc_variables.h:122
int64_t i_int
Definition vlc_variables.h:123
int32_t x
Definition vlc_variables.h:128
struct vlc_value_t::@294 coords
void * p_address
Definition vlc_variables.h:127
bool b_bool
Definition vlc_variables.h:124
char * psz_string
Definition vlc_variables.h:126
float f_float
Definition vlc_variables.h:125
int32_t y
Definition vlc_variables.h:128
This file is a collection of common definitions and types.