VLC 4.0.0-dev
objects.c File Reference

This file contains the functions to handle the vlc_object_t type. More...

Include dependency graph for objects.c:

Macros

#define vlc_children_foreach(pos, priv)    while (((void)(pos), (void)(priv), 0))
 

Functions

int vlc_object_init (vlc_object_t *restrict obj, vlc_object_t *parent, const char *typename)
 
void *() vlc_custom_create (vlc_object_t *parent, size_t length, const char *typename)
 Creates a VLC object. More...
 
void *() vlc_object_create (vlc_object_t *p_this, size_t i_size)
 
const char * vlc_object_typename (const vlc_object_t *obj)
 Returns the object type name. More...
 
vlc_object_t *() vlc_object_parent (vlc_object_t *obj)
 
struct vlc_tracervlc_object_get_tracer (vlc_object_t *obj)
 Get tracer of a vlc instance from an object. More...
 
void vlc_object_deinit (vlc_object_t *obj)
 Deinitializes a VLC object. More...
 
void() vlc_object_delete (vlc_object_t *obj)
 
void vlc_object_vaLog (vlc_object_t *obj, int prio, const char *module, const char *file, unsigned line, const char *func, const char *format, va_list ap)
 Emit a log message. More...
 
void vlc_object_Log (vlc_object_t *obj, int prio, const char *module, const char *file, unsigned line, const char *func, const char *format,...)
 Emit a log message. More...
 
size_t vlc_list_children (vlc_object_t *obj, vlc_object_t **restrict tab, size_t max)
 Lists the children of an object. More...
 

Detailed Description

This file contains the functions to handle the vlc_object_t type.

Unless otherwise stated, functions in this file are not cancellation point. All functions in this file are safe w.r.t. deferred cancellation.

Macro Definition Documentation

◆ vlc_children_foreach

#define vlc_children_foreach (   pos,
  priv 
)     while (((void)(pos), (void)(priv), 0))

Function Documentation

◆ vlc_custom_create()

void *() vlc_custom_create ( vlc_object_t p_this,
size_t  i_size,
const char *  psz_type 
)

Creates a VLC object.

Note that because the object name pointer must remain valid, potentially even after the destruction of the object (through the message queues), this function CANNOT be exported to plugins as is. In this case, the old vlc_object_create() must be used instead.

Parameters
p_thisan existing VLC object
i_sizebyte size of the object structure
psz_typeobject type name
Returns
the created object, or NULL.

References unlikely, and vlc_object_init().

Referenced by vlc_object_create().

◆ vlc_list_children()

size_t vlc_list_children ( vlc_object_t obj,
vlc_object_t **restrict  tab,
size_t  max 
)

Lists the children of an object.

Fills a table of pointers to children object of an object, incrementing the reference count for each of them.

Parameters
objobject whose children are to be listed
tabbase address to hold the list of children [OUT]
maxsize of the table
Returns
the actual number of children (may be larger than requested).
Warning
The list of object can change asynchronously even before the function returns. The list meant exclusively for debugging and tracing, not for functional introspection of any kind.
Objects appear in the object tree early, and disappear late. Most object properties are not accessible or not defined when the object is accessed through this function. For instance, the object cannot be used as a message log target (because object flags are not accessible asynchronously). Also type-specific object variables may not have been created yet, or may already have been deleted.

References count, vlc_children_foreach, vlc_externals, vlc_internals, and vlc_object_hold().

◆ vlc_object_create()

void *() vlc_object_create ( vlc_object_t p_this,
size_t  i_size 
)

References vlc_custom_create().

◆ vlc_object_deinit()

void vlc_object_deinit ( vlc_object_t obj)

Deinitializes a VLC object.

This frees resources allocated by vlc_object_init().

References vlc_object_internals::resources, var_DestroyAll(), vlc_internals, vlc_restorecancel(), and vlc_savecancel().

Referenced by vlc_object_delete().

◆ vlc_object_delete()

void() vlc_object_delete ( vlc_object_t obj)

References vlc_object_deinit().

◆ vlc_object_init()

◆ vlc_object_parent()

vlc_object_t *() vlc_object_parent ( vlc_object_t obj)

References vlc_internals.