VLC  3.0.15
Functions
FIFO stream

In-memory anonymous pipe. More...

Collaboration diagram for FIFO stream:

Functions

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

Detailed Description

In-memory anonymous pipe.

Function Documentation

◆ vlc_stream_fifo_Close()

void vlc_stream_fifo_Close ( stream_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 block_FifoRelease(), stream_sys_t::eof, stream_sys_t::fifo, stream_t::p_sys, vlc_fifo_Lock(), vlc_fifo_Signal(), vlc_fifo_Unlock(), and vlc_object_release.

Referenced by vlc_demux_chained_Delete(), and vlc_demux_chained_New().

◆ vlc_stream_fifo_New()

stream_t* vlc_stream_fifo_New ( vlc_object_t parent)

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
Returns
a stream object or NULL on memory error.

References block_FifoNew(), block_FifoRelease(), stream_sys_t::eof, stream_sys_t::fifo, stream_t::p_sys, stream_t::pf_block, stream_t::pf_control, stream_t::pf_seek, unlikely, vlc_object_hold, vlc_stream_CommonNew(), vlc_stream_fifo_Block(), vlc_stream_fifo_Control(), and vlc_stream_fifo_Destroy().

Referenced by vlc_demux_chained_New().

◆ vlc_stream_fifo_Queue()

int vlc_stream_fifo_Queue ( stream_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(), stream_sys_t::eof, stream_sys_t::fifo, likely, stream_t::p_sys, unlikely, vlc_fifo_Lock(), vlc_fifo_QueueUnlocked(), and vlc_fifo_Unlock().

Referenced by vlc_demux_chained_Send(), and vlc_stream_fifo_Write().

◆ vlc_stream_fifo_Write()

ssize_t vlc_stream_fifo_Write ( stream_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(), block_t::p_buffer, unlikely, and vlc_stream_fifo_Queue().