VLC 4.0.0-dev
Loading...
Searching...
No Matches

In-memory anonymous pipe. More...

Collaboration diagram for FIFO stream:

Typedefs

typedef struct vlc_stream_fifo vlc_stream_fifo_t
 

Functions

vlc_stream_fifo_tvlc_stream_fifo_New (vlc_object_t *parent, stream_t **reader)
 Creates a FIFO stream.
 
int vlc_stream_fifo_Queue (vlc_stream_fifo_t *s, block_t *block)
 Writes a block to a FIFO stream.
 
ssize_t vlc_stream_fifo_Write (vlc_stream_fifo_t *s, const void *buf, size_t len)
 Writes data to a FIFO stream.
 
void vlc_stream_fifo_Close (vlc_stream_fifo_t *s)
 Terminates a FIFO stream.
 

Detailed Description

In-memory anonymous pipe.

Typedef Documentation

◆ vlc_stream_fifo_t

Function Documentation

◆ vlc_stream_fifo_Close()

void vlc_stream_fifo_Close ( vlc_stream_fifo_t s)

Terminates a FIFO stream.

Marks the end of the FIFO stream and releases any underlying resources.

Parameters
sFIFO stream created by vlc_stream_fifo_New()

References vlc_stream_fifo::eof, vlc_stream_fifo::queue, vlc_queue_Lock(), vlc_queue_Signal(), vlc_queue_Unlock(), and vlc_stream_fifo_private::writer.

Referenced by vlc_demux_chained_Delete(), and vlc_demux_chained_New().

◆ vlc_stream_fifo_New()

vlc_stream_fifo_t * vlc_stream_fifo_New ( vlc_object_t parent,
stream_t **  reader 
)

Creates a FIFO stream.

Creates a non-seekable byte stream object whose byte stream is generated by another thread in the process. This is the LibVLC equivalent of an anonymous pipe/FIFO.

On the reader side, the normal stream functions are used, e.g. vlc_stream_Read() and vlc_stream_Delete().

The created stream object is automatically destroyed when both the reader and the writer sides have been closed, with vlc_stream_Delete() and vlc_stream_fifo_Close() respectively.

Parameters
parentparent VLC object for the stream
readerlocation to store read side stream pointer [OUT]
Returns
a FIFO stream object or NULL on memory error.

References vlc_stream_fifo::eof, stream_t::pf_block, stream_t::pf_control, stream_t::pf_seek, vlc_stream_fifo::queue, unlikely, vlc_queue_Init(), vlc_stream_CustomNew(), vlc_stream_fifo_Block(), vlc_stream_fifo_Control(), vlc_stream_fifo_Destroy(), vlc_stream_Private(), and vlc_stream_fifo_private::writer.

Referenced by vlc_demux_chained_New().

◆ vlc_stream_fifo_Queue()

int vlc_stream_fifo_Queue ( vlc_stream_fifo_t s,
block_t block 
)

Writes a block to a FIFO stream.

Parameters
sFIFO stream created by vlc_stream_fifo_New()
blockdata block to write to the stream
Returns
0 on success. -1 if the reader end has already been closed (errno is then set to EPIPE, and the block is deleted).
Bug:
No congestion control is performed. If the reader end is not keeping up with the writer end, buffers will accumulate in memory.

References block_Release, vlc_stream_fifo::eof, likely, vlc_stream_fifo::queue, unlikely, vlc_queue_EnqueueUnlocked(), vlc_queue_Lock(), vlc_queue_Unlock(), and vlc_stream_fifo_private::writer.

Referenced by vlc_demux_chained_Send(), and vlc_stream_fifo_Write().

◆ vlc_stream_fifo_Write()

ssize_t vlc_stream_fifo_Write ( vlc_stream_fifo_t s,
const void *  buf,
size_t  len 
)

Writes data to a FIFO stream.

This is a convenience helper for vlc_stream_fifo_Queue().

Parameters
sFIFO stream created by vlc_stream_fifo_New()
bufstart address of data to write
lenlength of data to write in bytes
Returns
len on success, or -1 on error (errno is set accordingly)

References block_Alloc, vlc_frame_t::p_buffer, unlikely, vlc_stream_fifo_Queue(), and vlc_stream_fifo_private::writer.