VLC 4.0.0-dev
Loading...
Searching...
No Matches
Collaboration diagram for Linked lists:

Files

file  vlc_list.h
 This provides convenience helpers for linked lists.

Data Structures

struct  vlc_list
 Doubly-linked list node. More...
struct  vlc_list_it
 List iterator. More...

Macros

#define VLC_LIST_INITIALIZER(h)
 Static initializer for a list head.
#define vlc_list_foreach(pos, head, member)
 List iteration macro.
#define vlc_list_foreach_const(pos, head, member)
#define vlc_list_reverse_foreach(pos, head, member)
 List iteration macro.
#define vlc_list_entry(ptr, type, member)
 Converts a list node pointer to an element pointer.
#define vlc_list_first_entry_or_null(head, type, member)
 Gets the first element.
#define vlc_list_last_entry_or_null(head, type, member)
 Gets the last element.
#define vlc_list_prev_entry_or_null(head, entry, type, member)
#define vlc_list_next_entry_or_null(head, entry, type, member)

Functions

static void vlc_list_init (struct vlc_list *restrict head)
 Initializes an empty list head.
static void vlc_list_add_between (struct vlc_list *restrict node, struct vlc_list *prev, struct vlc_list *next)
 Inserts an element in a list.
static void vlc_list_add_after (struct vlc_list *restrict node, struct vlc_list *prev)
 Inserts an element after another.
static void vlc_list_add_before (struct vlc_list *restrict node, struct vlc_list *next)
 Inserts an element before another.
static void vlc_list_append (struct vlc_list *restrict node, struct vlc_list *head)
 Appends an element into a list.
static void vlc_list_prepend (struct vlc_list *restrict node, struct vlc_list *head)
 Prepends an element into a list.
static void vlc_list_remove (struct vlc_list *restrict node)
 Removes an element from a list.
static void vlc_list_replace (const struct vlc_list *original, struct vlc_list *restrict substitute)
 Replaces an element with another one.
static bool vlc_list_is_empty (const struct vlc_list *head)
 Checks if a list is empty.
static bool vlc_list_is_first (const struct vlc_list *node, const struct vlc_list *head)
 Checks if an element is first in a list.
static bool vlc_list_is_last (const struct vlc_list *node, const struct vlc_list *head)
 Checks if an element is last in a list.
static struct vlc_list_it vlc_list_it_start (struct vlc_list *head)
static struct vlc_list_it vlc_list_it_start_const (const struct vlc_list *head)
static struct vlc_list_it vlc_list_it_reverse_start (struct vlc_list *head)
static struct vlc_list_it vlc_list_it_reverse_start_const (const struct vlc_list *head)
static bool vlc_list_it_continue (const struct vlc_list_it *restrict it)
static void vlc_list_it_next (struct vlc_list_it *restrict it)
static void vlc_list_it_prev (struct vlc_list_it *restrict it)
static void * vlc_list_first_or_null (const struct vlc_list *head, size_t offset)
static void * vlc_list_last_or_null (const struct vlc_list *head, size_t offset)
static void * vlc_list_prev_or_null (const struct vlc_list *head, const struct vlc_list *node, size_t offset)
static void * vlc_list_next_or_null (const struct vlc_list *head, const struct vlc_list *node, size_t offset)

Detailed Description

Macro Definition Documentation

◆ vlc_list_entry

#define vlc_list_entry ( ptr,
type,
member )
Value:
container_of(ptr, type, member)
#define container_of(ptr, type, member)
Definition vlc_common.h:1069

Converts a list node pointer to an element pointer.

Parameters
ptrlist node pointer
typelist data element type name
memberlist node member within the data element compound type

◆ vlc_list_first_entry_or_null

#define vlc_list_first_entry_or_null ( head,
type,
member )
Value:
((type *)vlc_list_first_or_null(head, offsetof (type, member)))
static void * vlc_list_first_or_null(const struct vlc_list *head, size_t offset)
Definition vlc_list.h:328

Gets the first element.

Parameters
head[in] Head of list whose last element to get.
Returns
the first entry in a list or NULL if empty.

Referenced by info_category_Delete(), picture_pool_GetAvailableLocked(), preparser_pool_QueueTake(), QueueTake(), and vlc_clock_main_Create().

◆ vlc_list_foreach

#define vlc_list_foreach ( pos,
head,
member )
Value:
for (struct vlc_list_it vlc_list_it__##pos = vlc_list_it_start(head); \
vlc_list_it_continue(&(vlc_list_it__##pos)) \
&& ((pos) = container_of((vlc_list_it__##pos).current, \
typeof (*(pos)), member), true); \
vlc_list_it_next(&(vlc_list_it__##pos)))
static struct vlc_list_it vlc_list_it_start(struct vlc_list *head)
Definition vlc_list.h:213
static struct vlc_rcu_thread current
Definition rcu.c:44
List iterator.
Definition vlc_list.h:206

List iteration macro.

This macro iterates over all elements (excluding the head) of a list, in order from the first to the last.

For each iteration, it sets the cursor variable to the current element.

Parameters
posCursor pointer variable identifier.
head[in] Head pointer of the list to iterate.
memberIdentifier of the member of the data type serving as list node.
Note
It it safe to delete the current item while iterating. It is however not safe to delete another item.

Referenced by aout_Destroy(), aout_DevicesList(), aout_HotplugNotify(), CancelAllTasks(), DecoderPlayCcLocked(), EsOutChangePosition(), EsOutFrameNext(), EsOutProgramChangePause(), EsOutProgramsChangeRate(), EsOutProgramSearch(), EsOutProgramUpdateScrambled(), EsOutSetJitter(), EsOutSetRecord(), EsOutTerminate(), EsOutVaControlLocked(), filter_chain_Clear(), filter_chain_ForEach(), filter_chain_VideoFilter(), filter_chain_VideoFlush(), httpd_HostCreate(), httpd_HostDelete(), httpd_UrlDelete(), httpd_UrlNew(), httpdLoop(), input_item_Release(), input_resource_HoldVouts(), InputItemFindCat(), picture_pool_Release(), preparser_Cancel(), preparser_pool_Cancel(), preparser_pool_Delete(), RemoveCcDecoder(), resource_GetVoutRsc(), RunThread(), sout_AnnounceRegisterSDP(), vlc_audio_meter_Destroy(), vlc_audio_meter_Flush(), vlc_audio_meter_Process(), vlc_audio_meter_Reset(), vlc_clock_input_reset(), vlc_executor_Delete(), vlc_list_HasInput(), vlc_media_source_provider_Find(), vlc_media_tree_Delete(), vlc_ml_event_send(), vlc_player_AddMetadataLoudnessListener(), vlc_player_mainloop_Thread(), vlc_player_OnLoudnessEvent(), vlc_player_RemoveMetadataLoudnessListener(), vlc_player_SendSmpteTimerSourceUpdates(), vlc_player_SendTimerPause(), vlc_player_SendTimerSeek(), and vlc_player_SendTimerSourceUpdates().

◆ vlc_list_foreach_const

#define vlc_list_foreach_const ( pos,
head,
member )
Value:
for (struct vlc_list_it vlc_list_it__##pos = vlc_list_it_start_const(head); \
vlc_list_it_continue(&(vlc_list_it__##pos)) \
&& ((pos) = container_of((vlc_list_it__##pos).current, \
const typeof (*(pos)), member), true); \
vlc_list_it_next(&(vlc_list_it__##pos)))
static struct vlc_list_it vlc_list_it_start_const(const struct vlc_list *head)
Definition vlc_list.h:222

◆ VLC_LIST_INITIALIZER

#define VLC_LIST_INITIALIZER ( h)
Value:
{ h, h }

Static initializer for a list head.

◆ vlc_list_last_entry_or_null

#define vlc_list_last_entry_or_null ( head,
type,
member )
Value:
((type *)vlc_list_last_or_null(head, offsetof (type, member)))
static void * vlc_list_last_or_null(const struct vlc_list *head, size_t offset)
Definition vlc_list.h:336

Gets the last element.

Parameters
head[in] Head of list whose last element to get.
Returns
the last entry in a list or NULL if empty.

Referenced by filter_chain_AppendFromString(), filter_chain_AppendInner(), filter_chain_GetFmtOut(), filter_chain_GetVideoCtxOut(), and vlc_clock_input_start().

◆ vlc_list_next_entry_or_null

#define vlc_list_next_entry_or_null ( head,
entry,
type,
member )
Value:
((type *)vlc_list_next_or_null(head, &(entry)->member, \
offsetof (type, member)))
static void * vlc_list_next_or_null(const struct vlc_list *head, const struct vlc_list *node, size_t offset)
Definition vlc_list.h:353
Definition fourcc_gen.c:52

Referenced by vlc_clock_get_context().

◆ vlc_list_prev_entry_or_null

#define vlc_list_prev_entry_or_null ( head,
entry,
type,
member )
Value:
((type *)vlc_list_prev_or_null(head, &(entry)->member, \
offsetof (type, member)))
static void * vlc_list_prev_or_null(const struct vlc_list *head, const struct vlc_list *node, size_t offset)
Definition vlc_list.h:344

◆ vlc_list_reverse_foreach

#define vlc_list_reverse_foreach ( pos,
head,
member )
Value:
for (struct vlc_list_it vlc_list_it_##pos = vlc_list_it_reverse_start(head); \
vlc_list_it_continue(&(vlc_list_it_##pos)) \
&& ((pos) = container_of((vlc_list_it_##pos).current, \
typeof (*(pos)), member), true); \
vlc_list_it_prev(&(vlc_list_it_##pos)))
static struct vlc_list_it vlc_list_it_reverse_start(struct vlc_list *head)
Definition vlc_list.h:231

List iteration macro.

This macro iterates over all elements (excluding the head) of a list, in reversed order from the first to the last.

For each iteration, it sets the cursor variable to the current element.

Parameters
posCursor pointer variable identifier.
head[in] Head pointer of the list to iterate.
memberIdentifier of the member of the data type serving as list node.
Note
It it safe to delete the current item while iterating. It is however not safe to delete another item.

Referenced by filter_chain_MouseFilter(), and filter_chain_VideoFilter().

Function Documentation

◆ vlc_list_add_after()

void vlc_list_add_after ( struct vlc_list *restrict node,
struct vlc_list * prev )
inlinestatic

Inserts an element after another.

Parameters
node[out] Node pointer of the element to insert
prevNode pointer of the previous element.

References vlc_list::next, vlc_list::prev, and vlc_list_add_between().

Referenced by input_item_ReplaceInfos(), and vlc_list_prepend().

◆ vlc_list_add_before()

void vlc_list_add_before ( struct vlc_list *restrict node,
struct vlc_list * next )
inlinestatic

Inserts an element before another.

Parameters
node[out] Node pointer of the element to insert.
nextNode pointer of the next element.

References vlc_list::next, vlc_list::prev, and vlc_list_add_between().

Referenced by vlc_list_append().

◆ vlc_list_add_between()

void vlc_list_add_between ( struct vlc_list *restrict node,
struct vlc_list * prev,
struct vlc_list * next )
inlinestatic

Inserts an element in a list.

Parameters
node[out] Node pointer of the element to insert.
prevNode pointer of the previous element.
nextNode pointer of the next element.

References vlc_list::next, and vlc_list::prev.

Referenced by vlc_list_add_after(), vlc_list_add_before(), and vlc_list_replace().

◆ vlc_list_append()

◆ vlc_list_first_or_null()

void * vlc_list_first_or_null ( const struct vlc_list * head,
size_t offset )
inlinestatic

◆ vlc_list_init()

◆ vlc_list_is_empty()

◆ vlc_list_is_first()

bool vlc_list_is_first ( const struct vlc_list * node,
const struct vlc_list * head )
inlinestatic

Checks if an element is first in a list.

Parameters
node[in] List node of the element.
head[in] Head of the list to be checked.
Return values
falseThe element is not first (or is in another list).
trueThe element is first.

References vlc_list::prev.

Referenced by vlc_list_prev_or_null().

◆ vlc_list_is_last()

bool vlc_list_is_last ( const struct vlc_list * node,
const struct vlc_list * head )
inlinestatic

Checks if an element is last in a list.

Parameters
node[in] List node of the element.
head[in] Head of the list to be checked.
Return values
falseThe element is not last (or is in another list).
trueThe element is last.

References vlc_list::next.

Referenced by filter_chain_VideoBufferNew(), and vlc_list_next_or_null().

◆ vlc_list_it_continue()

bool vlc_list_it_continue ( const struct vlc_list_it *restrict it)
inlinestatic

◆ vlc_list_it_next()

void vlc_list_it_next ( struct vlc_list_it *restrict it)
inlinestatic

References vlc_list::next.

Referenced by filter_chain_VideoFilter().

◆ vlc_list_it_prev()

void vlc_list_it_prev ( struct vlc_list_it *restrict it)
inlinestatic

References vlc_list::next, and vlc_list::prev.

◆ vlc_list_it_reverse_start()

struct vlc_list_it vlc_list_it_reverse_start ( struct vlc_list * head)
inlinestatic

◆ vlc_list_it_reverse_start_const()

struct vlc_list_it vlc_list_it_reverse_start_const ( const struct vlc_list * head)
inlinestatic

◆ vlc_list_it_start()

struct vlc_list_it vlc_list_it_start ( struct vlc_list * head)
inlinestatic

◆ vlc_list_it_start_const()

struct vlc_list_it vlc_list_it_start_const ( const struct vlc_list * head)
inlinestatic

◆ vlc_list_last_or_null()

void * vlc_list_last_or_null ( const struct vlc_list * head,
size_t offset )
inlinestatic

◆ vlc_list_next_or_null()

void * vlc_list_next_or_null ( const struct vlc_list * head,
const struct vlc_list * node,
size_t offset )
inlinestatic

◆ vlc_list_prepend()

void vlc_list_prepend ( struct vlc_list *restrict node,
struct vlc_list * head )
inlinestatic

Prepends an element into a list.

Parameters
node[out] Node pointer of the element to prepend to the list.
headHead pointer of the list to prepend the element to.

References vlc_list_add_after().

Referenced by vlc::list< NodeType >::push_front().

◆ vlc_list_prev_or_null()

void * vlc_list_prev_or_null ( const struct vlc_list * head,
const struct vlc_list * node,
size_t offset )
inlinestatic

◆ vlc_list_remove()

void vlc_list_remove ( struct vlc_list *restrict node)
inlinestatic

◆ vlc_list_replace()

void vlc_list_replace ( const struct vlc_list * original,
struct vlc_list *restrict substitute )
inlinestatic

Replaces an element with another one.

Parameters
original[in] Node pointer of the element to remove from the list.
substitute[out] Node pointer of the replacement.

References vlc_list::next, vlc_list::prev, and vlc_list_add_between().

Referenced by spu_PrerenderText(), and SpuRenderSubpictures().