VLC  4.0.0-dev
Modules | Files | Data Structures | Macros | Functions
Collaboration diagram for VLC objects:


 Object resources
 The object resource functions tie resource allocation to an instance of a module through a VLC object. Such resource will be automatically freed, in first in last out order, when the module instance associated with the VLC object is terminated.


file  vlc_objects.h

Data Structures

struct  vlc_object_t
 VLC object common members. More...
struct  libvlc_int_t


#define VLC_OBJECT(x)
 Type-safe vlc_object_t cast. More...
#define vlc_object_cast(t)
#define vlc_object_delete(obj)   vlc_object_delete(VLC_OBJECT(obj))
#define vlc_object_parent(o)   vlc_object_parent(VLC_OBJECT(o))
#define vlc_object_logger(o)   vlc_object_logger(VLC_OBJECT(o))
#define vlc_object_get_name(obj)   var_GetString(obj, "module-name")
 Tries to get the name of module bound to an object. More...
#define vlc_object_create(a, b)   vlc_object_create( VLC_OBJECT(a), b )
#define vlc_object_find_name(a, b)   vlc_object_find_name( VLC_OBJECT(a),b)
#define vlc_object_instance(o)   vlc_object_instance(VLC_OBJECT(o))


VLC_EXPORT void * vlc_object_create (_Generic((vlc_object_t *) ->obj, struct vlc_object_marker *:(vlc_object_t *), default:(&((vlc_object_t *) ->obj))), size_t)
 Allocates and initializes a vlc object. More...
VLC_EXPORT void vlc_object_delete (_Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj))))
 Drops the strong reference to an object. More...
VLC_EXPORT size_t vlc_list_children (vlc_object_t *, vlc_object_t **, size_t)
const VLC_EXPORT char * vlc_object_typename (const vlc_object_t *obj)
 Returns the object type name. More...
VLC_EXPORT vlc_object_tvlc_object_parent (_Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj))))
 Gets the parent of an object. More...
static struct vlc_loggervlc_object_logger (_Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj))))
static libvlc_int_tvlc_object_instance (_Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj))))
VLC_EXPORT vout_thread_tvout_Hold (vout_thread_t *vout)
VLC_EXPORT void vout_Release (vout_thread_t *vout)
VLC_EXPORT audio_output_taout_Hold (audio_output_t *aout)
VLC_EXPORT void aout_Release (audio_output_t *aout)
static void * vlc_object_hold (vlc_object_t *o)
static void vlc_object_release (vlc_object_t *o)

Detailed Description

Macro Definition Documentation


#define VLC_OBJECT (   x)
_Generic((x)->obj, \
struct vlc_object_marker *: (x), \
default: (&((x)->obj)) \

Type-safe vlc_object_t cast.

This macro attempts to cast a pointer to a compound type to a vlc_object_t pointer in a type-safe manner. It checks if the compound type actually starts with an embedded vlc_object_t structure.

◆ vlc_object_cast

#define vlc_object_cast (   t)

◆ vlc_object_create

#define vlc_object_create (   a,
)    vlc_object_create( VLC_OBJECT(a), b )

◆ vlc_object_delete

#define vlc_object_delete (   obj)    vlc_object_delete(VLC_OBJECT(obj))

◆ vlc_object_find_name

#define vlc_object_find_name (   a,
)    vlc_object_find_name( VLC_OBJECT(a),b)

◆ vlc_object_get_name

#define vlc_object_get_name (   obj)    var_GetString(obj, "module-name")

Tries to get the name of module bound to an object.

This function is intrinsically race-prone, as a module may be bound or unbound asynchronously by another thread. Do not trust the result for any purpose other than debugging/tracing.
Normally, this returns a heap-allocated nul-terminated string which is the name of the module. If no module are bound to the object, it returns NULL. It also returns NULL on error.

◆ vlc_object_instance

#define vlc_object_instance (   o)    vlc_object_instance(VLC_OBJECT(o))

◆ vlc_object_logger

#define vlc_object_logger (   o)    vlc_object_logger(VLC_OBJECT(o))

◆ vlc_object_parent

#define vlc_object_parent (   o)    vlc_object_parent(VLC_OBJECT(o))

Function Documentation

◆ aout_Hold()

VLC_EXPORT audio_output_t* aout_Hold ( audio_output_t aout)

◆ aout_Release()

VLC_EXPORT void aout_Release ( audio_output_t aout)

◆ vlc_list_children()

VLC_EXPORT size_t vlc_list_children ( vlc_object_t ,
vlc_object_t **  ,

◆ vlc_object_create()

VLC_EXPORT void* vlc_object_create ( _Generic((vlc_object_t *) ->obj, struct vlc_object_marker *:(vlc_object_t *), default:(&((vlc_object_t *) ->obj)))  ,

Allocates and initializes a vlc object.

i_sizeobject byte size
the new object, or NULL on error.

◆ vlc_object_delete()

VLC_EXPORT void vlc_object_delete ( _Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj)))  )

Drops the strong reference to an object.

This removes the initial strong reference to a given object. This must be called exactly once per allocated object after it is no longer needed, matching vlc_object_create() or vlc_custom_create().

◆ vlc_object_hold()

static void* vlc_object_hold ( vlc_object_t o)

◆ vlc_object_instance()

static libvlc_int_t* vlc_object_instance ( _Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj)))  )

References vlc_object_parent.

◆ vlc_object_logger()

static struct vlc_logger* vlc_object_logger ( _Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj)))  )

References vlc_object_t::logger.

◆ vlc_object_parent()

VLC_EXPORT vlc_object_t* vlc_object_parent ( _Generic((vlc_object_t *obj) ->obj, struct vlc_object_marker *:(vlc_object_t *obj), default:(&((vlc_object_t *obj) ->obj)))  )

Gets the parent of an object.

the parent object (NULL if none)
The returned parent object pointer is valid as long as the child is.

◆ vlc_object_release()

static void vlc_object_release ( vlc_object_t o)

◆ vlc_object_typename()

const VLC_EXPORT char* vlc_object_typename ( const vlc_object_t obj)

Returns the object type name.

This returns a nul-terminated string identifying the object type. The string is valid for at least as long as the object reference.

objobject whose type name to get

References vlc_internals.

Referenced by vlc_object_hold(), vlc_object_release(), and vlc_object_vaLog().

◆ vout_Hold()

VLC_EXPORT vout_thread_t* vout_Hold ( vout_thread_t vout)

◆ vout_Release()

VLC_EXPORT void vout_Release ( vout_thread_t vout)