VLC 4.0.0-dev
Collaboration diagram for Frame chain:

Functions

static void vlc_frame_ChainAppend (vlc_frame_t **pp_list, vlc_frame_t *frame)
 Appends a vlc_frame_t to the chain. More...
 
static void vlc_frame_ChainLastAppend (vlc_frame_t ***ppp_last, vlc_frame_t *frame)
 Appends a vlc_frame_t to the last frame pointer and update it. More...
 
static void vlc_frame_ChainRelease (vlc_frame_t *frame)
 Releases a chain of blocks. More...
 
static size_t vlc_frame_ChainExtract (vlc_frame_t *p_list, void *p_data, size_t i_max)
 Extracts data from a chain of frames. More...
 
static void vlc_frame_ChainProperties (const vlc_frame_t *p_list, int *pi_count, size_t *pi_size, vlc_tick_t *pi_length)
 Retrieves chain properties. More...
 
static vlc_frame_tvlc_frame_ChainGather (vlc_frame_t *p_list)
 Gathers a chain into a single vlc_frame_t. More...
 

Detailed Description

Function Documentation

◆ vlc_frame_ChainAppend()

static void vlc_frame_ChainAppend ( vlc_frame_t **  pp_list,
vlc_frame_t frame 
)
inlinestatic

Appends a vlc_frame_t to the chain.

The given frame is appended to the last frame of the given chain.

Attention
Using this function on long chains or repeatedly calling it to append a lot of frames can be slow, as it has to iterate the whole chain to append the frame. In these cases vlc_frame_ChainLastAppend should be used.
Parameters
pp_listPointer to the vlc_frame_t chain
frameThe vlc_frame_t to append (can be NULL)
See also
vlc_frame_ChainLastAppend()

Example:

vlc_frame_t *p_chain = NULL;
vlc_frame_ChainAppend(&p_chain, p_frame);
static void vlc_frame_ChainAppend(vlc_frame_t **pp_list, vlc_frame_t *frame)
Appends a vlc_frame_t to the chain.
Definition: vlc_frame.h:401
Definition: vlc_frame.h:123

References p.

◆ vlc_frame_ChainExtract()

static size_t vlc_frame_ChainExtract ( vlc_frame_t p_list,
void *  p_data,
size_t  i_max 
)
static

Extracts data from a chain of frames.

Copies the specified amount of data from the chain into the given buffer. If the data in the chain is less than the maximum amount given, the remainder of the buffer is not modified.

Parameters
p_listPointer to the first vlc_frame_t of the chain to copy from
[out]p_dataDestination buffer to copy the data to
i_maxNumber of bytes to copy
Returns
Number of bytes actually copied
See also
vlc_frame_ChainGather()

References vlc_frame_t::i_buffer, p, vlc_frame_t::p_buffer, and vlc_frame_t::p_next.

Referenced by vlc_frame_ChainGather().

◆ vlc_frame_ChainGather()

static vlc_frame_t * vlc_frame_ChainGather ( vlc_frame_t p_list)
inlinestatic

Gathers a chain into a single vlc_frame_t.

All frames in the chain are gathered into a single vlc_frame_t and the original chain is released.

Parameters
p_listPointer to the first vlc_frame_t of the chain to gather
Returns
Returns a pointer to a new vlc_frame_t or NULL if the frame can not be allocated, in which case the original chain is not released. If the chain pointed to by p_list is already gathered, a pointer to it is returned and no new frame will be allocated.
See also
vlc_frame_ChainExtract()

References vlc_frame_t::i_buffer, vlc_frame_t::i_dts, vlc_frame_t::i_flags, vlc_frame_t::i_length, vlc_frame_t::i_pts, vlc_frame_t::p_buffer, vlc_frame_t::p_next, vlc_frame_Alloc(), vlc_frame_ChainExtract(), vlc_frame_ChainProperties(), and vlc_frame_ChainRelease().

◆ vlc_frame_ChainLastAppend()

static void vlc_frame_ChainLastAppend ( vlc_frame_t ***  ppp_last,
vlc_frame_t frame 
)
inlinestatic

Appends a vlc_frame_t to the last frame pointer and update it.

Uses a pointer over a pointer to p_next of the last frame of the frame chain to append a frame at the end of the chain and updates the pointer to the new last frame's p_next. If the appended frame is itself a chain, it is iterated till the end to correctly update ppp_last.

Parameters
[in,out]ppp_lastPointer to pointer to the end of the chain (The vlc_frame_t::p_next of the last vlc_frame_t in the chain)
frameThe vlc_frame_t to append

Example:

vlc_frame_t *p_frame = NULL;
vlc_frame_t **pp_frame_last = &p_frame;
vlc_frame_ChainLastAppend(&pp_frame_last, p_other_frame);
static void vlc_frame_ChainLastAppend(vlc_frame_t ***ppp_last, vlc_frame_t *frame)
Appends a vlc_frame_t to the last frame pointer and update it.
Definition: vlc_frame.h:436

References vlc_frame_t::p_next.

◆ vlc_frame_ChainProperties()

static void vlc_frame_ChainProperties ( const vlc_frame_t p_list,
int *  pi_count,
size_t *  pi_size,
vlc_tick_t pi_length 
)
inlinestatic

Retrieves chain properties.

Can be used to retrieve count of frames, number of bytes and the duration of the chain.

Parameters
p_listPointer to the first vlc_frame_t of the chain
[out]pi_countPointer to count of frames in the chain (may be NULL)
[out]pi_sizePointer to number of bytes in the chain (may be NULL)
[out]pi_lengthPointer to length (duration) of the chain (may be NULL)

References vlc_frame_t::i_buffer, vlc_frame_t::i_length, and vlc_frame_t::p_next.

Referenced by vlc_frame_ChainGather().

◆ vlc_frame_ChainRelease()

static void vlc_frame_ChainRelease ( vlc_frame_t frame)
inlinestatic

Releases a chain of blocks.

The frame pointed to by frame and all following frames in the chain are released.

Parameters
framePointer to first vlc_frame_t of the chain to release
See also
vlc_frame_Release()

References vlc_frame_t::p_next, and vlc_frame_Release().

Referenced by vlc_fifo_Empty(), and vlc_frame_ChainGather().