VLC 4.0.0-dev
|
Buffered input byte streams. More...
Modules | |
Access | |
Raw input byte streams. | |
FIFO stream | |
In-memory anonymous pipe. | |
Files | |
file | vlc_stream.h |
Byte streams and byte stream filter modules interface. | |
Data Structures | |
struct | vlc_stream_operations |
struct | stream_t |
stream_t definition More... | |
Macros | |
#define | vlc_stream_MemoryNew(a, b, c, d) vlc_stream_MemoryNew(VLC_OBJECT(a), b, c, d) |
#define | vlc_stream_NewURL(a, b) vlc_stream_NewURL(VLC_OBJECT(a), b) |
Enumerations | |
enum | stream_query_e { STREAM_CAN_SEEK , STREAM_CAN_FASTSEEK , STREAM_CAN_PAUSE , STREAM_CAN_CONTROL_PACE , STREAM_GET_SIZE =6 , STREAM_GET_MTIME , STREAM_GET_PTS_DELAY = 0x101 , STREAM_GET_TITLE_INFO , STREAM_GET_TITLE , STREAM_GET_SEEKPOINT , STREAM_GET_META , STREAM_GET_CONTENT_TYPE , STREAM_GET_SIGNAL , STREAM_GET_TAGS , STREAM_GET_TYPE , STREAM_SET_PAUSE_STATE = 0x200 , STREAM_SET_TITLE , STREAM_SET_SEEKPOINT , STREAM_SET_RECORD_STATE , STREAM_SET_PRIVATE_ID_STATE = 0x1000 , STREAM_SET_PRIVATE_ID_CA , STREAM_GET_PRIVATE_ID_STATE } |
Possible commands to send to vlc_stream_Control() and vlc_stream_vaControl() More... | |
Functions | |
ssize_t | vlc_stream_Read (stream_t *s, void *buf, size_t len) |
Reads data from a byte stream. | |
ssize_t | vlc_stream_ReadPartial (stream_t *s, void *buf, size_t len) |
Reads partial data from a byte stream. | |
ssize_t | vlc_stream_Peek (stream_t *s, const uint8_t **bufp, size_t len) |
Peeks at data from a byte stream. | |
block_t * | vlc_stream_ReadBlock (stream_t *) |
Reads a data block from a byte stream. | |
uint64_t | vlc_stream_Tell (const stream_t *) |
Tells the current stream position. | |
bool | vlc_stream_Eof (const stream_t *) |
Checks for end of stream. | |
int | vlc_stream_Seek (stream_t *s, uint64_t offset) |
Sets the current stream position. | |
int | vlc_stream_vaControl (stream_t *s, int query, va_list args) |
Use to control the "stream_t *". | |
static int | vlc_stream_Control (stream_t *s, int query,...) |
block_t * | vlc_stream_Block (stream_t *s, size_t) |
Read data into a block. | |
char * | vlc_stream_ReadLine (stream_t *) |
int | vlc_stream_ReadDir (stream_t *s, input_item_node_t *node) |
Reads a directory. | |
void | vlc_stream_Delete (stream_t *s) |
Closes a byte stream. | |
stream_t * | vlc_stream_CommonNew (vlc_object_t *, void(*)(stream_t *)) |
static bool | vlc_stream_CanSeek (stream_t *s) |
static bool | vlc_stream_CanFastSeek (stream_t *s) |
static bool | vlc_stream_CanPause (stream_t *s) |
static bool | vlc_stream_CanPace (stream_t *s) |
static vlc_tick_t | vlc_stream_GetPtsDelay (stream_t *s) |
static int | vlc_stream_GetSeekpoint (stream_t *s, unsigned *seekpoint) |
static int | vlc_stream_GetSignal (stream_t *s, double *quality, double *strength) |
static int | vlc_stream_GetTitle (stream_t *s, unsigned *title) |
static int | vlc_stream_GetMeta (stream_t *s, vlc_meta_t *meta) |
static int | vlc_stream_GetType (stream_t *s, int *type) |
static int | vlc_stream_GetSize (stream_t *s, uint64_t *size) |
Get the size of the stream. | |
static int | vlc_stream_GetMTime (stream_t *s, uint64_t *mtime) |
static int | vlc_stream_GetTitleInfo (stream_t *s, input_title_t ***title_info, int *size) |
static int | vlc_stream_GetContentType (stream_t *s, char **content_type) |
static int | vlc_stream_GetTags (stream_t *s, const block_t **tags) |
static int | vlc_stream_GetPrivateIdState (stream_t *s, int priv_id, bool *state) |
static int | vlc_stream_SetPauseState (stream_t *s, bool pause_state) |
static int | vlc_stream_SetSeekPoint (stream_t *s, int seekpoint) |
static int | vlc_stream_SetTitle (stream_t *s, int title) |
static int | vlc_stream_SetRecordState (stream_t *s, bool record_state, const char *dir_path, const char *ext) |
static int | vlc_stream_SetPrivateIdState (stream_t *s, int priv_id, bool state) |
static int | vlc_stream_SetPrivateIdCa (stream_t *s, void *ca) |
Set the private ID ca. | |
static int64_t | stream_Size (stream_t *s) |
static bool | stream_HasExtension (stream_t *s, const char *extension) |
static char * | stream_ContentType (stream_t *s) |
Get the Content-Type of a stream, or NULL if unknown. | |
static char * | stream_MimeType (stream_t *s) |
Get the mime-type of a stream. | |
static bool | stream_IsMimeType (stream_t *s, const char *type) |
Checks for a MIME type. | |
stream_t * | vlc_stream_MemoryNew (vlc_object_t *obj, uint8_t *base, size_t size, bool preserve) |
Create a stream from a memory buffer. | |
stream_t * | vlc_stream_NewURL (vlc_object_t *obj, const char *url) |
Create a stream_t reading from a URL. | |
stream_t * | vlc_stream_FilterNew (stream_t *p_source, const char *psz_stream_filter) |
Try to add a stream filter to an open stream. | |
Buffered input byte streams.
#define vlc_stream_MemoryNew | ( | a, | |
b, | |||
c, | |||
d | |||
) | vlc_stream_MemoryNew(VLC_OBJECT(a), b, c, d) |
#define vlc_stream_NewURL | ( | a, | |
b | |||
) | vlc_stream_NewURL(VLC_OBJECT(a), b) |
enum stream_query_e |
Possible commands to send to vlc_stream_Control() and vlc_stream_vaControl()
Enumerator | |
---|---|
STREAM_CAN_SEEK | arg1=(bool *) res=cannot fail |
STREAM_CAN_FASTSEEK | arg1=(bool *) res=cannot fail |
STREAM_CAN_PAUSE | arg1=(bool *) res=cannot fail |
STREAM_CAN_CONTROL_PACE | arg1=(bool *) res=cannot fail |
STREAM_GET_SIZE | arg1=(uint64_t *) res=can fail |
STREAM_GET_MTIME | arg1=(uint64_t *) res=can fail Returns the last modified time in seconds since epoch. |
STREAM_GET_PTS_DELAY | arg1=(vlc_tick_t *) res=cannot fail |
STREAM_GET_TITLE_INFO | arg1=(input_title_t***) arg2=(int*) res=can fail |
STREAM_GET_TITLE | arg1=(unsigned *) res=can fail |
STREAM_GET_SEEKPOINT | arg1=(unsigned *) res=can fail |
STREAM_GET_META | arg1=(vlc_meta_t *) res=can fail |
STREAM_GET_CONTENT_TYPE | arg1=(char **) res=can fail |
STREAM_GET_SIGNAL | arg1=(double *pf_quality), arg2=(double *pf_strength) res=can fail |
STREAM_GET_TAGS | arg1=(const block_t **) res=can fail |
STREAM_GET_TYPE | arg1=(int*) res=can fail |
STREAM_SET_PAUSE_STATE | arg1=(bool) res=can fail |
STREAM_SET_TITLE | arg1=(int) res=can fail |
STREAM_SET_SEEKPOINT | arg1=(int) res=can fail |
STREAM_SET_RECORD_STATE | arg1=bool, arg2=const char *dir_path (if arg1 is true), arg3=const char *psz_ext (if arg1 is true) res=can fail |
STREAM_SET_PRIVATE_ID_STATE | arg1=(int i_private_data) arg2=(bool b_selected) res=can fail |
STREAM_SET_PRIVATE_ID_CA | arg1=(void *) |
STREAM_GET_PRIVATE_ID_STATE | arg1=(int i_private_data) arg2=(bool *) res=can fail |
|
inlinestatic |
Get the Content-Type of a stream, or NULL if unknown.
Result must be free()'d.
References vlc_stream_GetContentType().
Referenced by stream_MimeType().
|
inlinestatic |
References name, stream_t::psz_filepath, stream_t::psz_url, and strcasecmp().
|
inlinestatic |
Checks for a MIME type.
Checks if the stream has a specific MIME type.
References strcasecmp(), and stream_MimeType().
Referenced by demux_IsContentType().
|
inlinestatic |
Get the mime-type of a stream.
NULL
if unknown References stream_ContentType().
Referenced by demux_NewAdvanced(), ImageReadUrl(), and stream_IsMimeType().
|
inlinestatic |
References vlc_stream_GetSize().
Referenced by demux_vaControlHelper().
Read data into a block.
s | stream to read data from |
size | number of bytes to read |
References block_Alloc, block_Release, vlc_frame_t::i_buffer, vlc_frame_t::p_buffer, unlikely, and vlc_stream_Read().
Referenced by ImageReadUrl().
|
inlinestatic |
References STREAM_CAN_FASTSEEK, and vlc_stream_Control().
|
inlinestatic |
|
inlinestatic |
References vlc_stream_operations::can_pause, STREAM_CAN_PAUSE, and vlc_stream_Control().
|
inlinestatic |
References vlc_stream_operations::can_seek, STREAM_CAN_SEEK, and vlc_stream_Control().
stream_t * vlc_stream_CommonNew | ( | vlc_object_t * | parent, |
void(*)(stream_t *) | destroy | ||
) |
References vlc_stream_CustomNew().
Referenced by se_AttachWrapper().
|
inlinestatic |
References vlc_stream_vaControl().
Referenced by demux_UpdateTitleFromStream(), demux_vaControlHelper(), vlc_stream_CanFastSeek(), vlc_stream_CanPace(), vlc_stream_CanPause(), vlc_stream_CanSeek(), vlc_stream_GetContentType(), vlc_stream_GetMeta(), vlc_stream_GetMTime(), vlc_stream_GetPrivateIdState(), vlc_stream_GetPtsDelay(), vlc_stream_GetSeekpoint(), vlc_stream_GetSignal(), vlc_stream_GetSize(), vlc_stream_GetTags(), vlc_stream_GetTitle(), vlc_stream_GetTitleInfo(), vlc_stream_GetType(), vlc_stream_SetPauseState(), vlc_stream_SetPrivateIdCa(), vlc_stream_SetPrivateIdState(), vlc_stream_SetRecordState(), vlc_stream_SetSeekPoint(), and vlc_stream_SetTitle().
void vlc_stream_Delete | ( | stream_t * | s | ) |
Closes a byte stream.
s | byte stream to close |
Closes a byte stream.
References vlc_stream_operations::close, stream_priv_t::destroy, stream_t::ops, stream_CommonDelete(), and stream_priv.
Referenced by accessNewAttachment(), AStreamDestroy(), demux_Delete(), demux_DestroyDemux(), download_key(), download_signature(), GetUpdateFile(), ImageReadUrl(), InputDemuxNew(), RunDownloader(), se_Release(), stream_AccessNew(), StreamDelete(), update_DownloadReal(), vlc_demux_chained_New(), vlc_demux_chained_Thread(), and vlc_stream_NewMRL().
bool vlc_stream_Eof | ( | const stream_t * | s | ) |
Checks for end of stream.
Checks if the last attempt to reads data from the stream encountered the end of stream before the attempt could be fully satisfied. The value is initially false, and is reset to false by vlc_stream_Seek().
References stream_priv_t::eof, and stream_priv.
Referenced by AStreamReadBlock(), and AStreamReadStream().
Try to add a stream filter to an open stream.
References vlc_stream_operations::block, module_need, stream_t::ops, stream_t::p_input_item, stream_t::pf_block, stream_t::pf_read, stream_t::psz_filepath, stream_t::psz_url, vlc_stream_operations::read, stream_t::s, strdup(), vlc_stream_operations::stream, stream_CommonDelete(), StreamDelete(), unlikely, vlc_object_parent, vlc_stream_CustomNew(), and vlc_stream_Private().
Referenced by stream_FilterAutoNew(), and stream_FilterChainNew().
|
inlinestatic |
References STREAM_GET_CONTENT_TYPE, and vlc_stream_Control().
Referenced by stream_ContentType().
|
inlinestatic |
References STREAM_GET_META, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_MTIME, and vlc_stream_Control().
Referenced by FillFileStatsIfAny().
|
inlinestatic |
References state, STREAM_GET_PRIVATE_ID_STATE, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_PTS_DELAY, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_SEEKPOINT, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_SIGNAL, and vlc_stream_Control().
|
inlinestatic |
Get the size of the stream.
References STREAM_GET_SIZE, and vlc_stream_Control().
Referenced by download_key(), download_signature(), FillFileStatsIfAny(), GetUpdateFile(), ImageReadUrl(), OpenSDP(), stream_Size(), and update_DownloadReal().
References STREAM_GET_TAGS, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_TITLE, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_TITLE_INFO, and vlc_stream_Control().
|
inlinestatic |
References STREAM_GET_TYPE, and vlc_stream_Control().
stream_t * vlc_stream_MemoryNew | ( | vlc_object_t * | obj, |
uint8_t * | base, | ||
size_t | size, | ||
bool | preserve | ||
) |
Create a stream from a memory buffer.
obj | parent VLC object |
base | start address of the memory buffer to read from |
size | size in bytes of the memory buffer |
preserve | if false, free(base) will be called when the stream is destroyed; if true, the memory buffer is preserved |
References Control(), vlc_stream_memory_private::i_pos, vlc_stream_memory_private::i_size, vlc_stream_memory_private::p_buffer, stream_t::pf_control, stream_t::pf_read, stream_t::pf_seek, Read(), Seek(), stream_MemoryDelete(), stream_MemoryPreserveDelete(), unlikely, vlc_stream_CustomNew(), and vlc_stream_Private().
stream_t * vlc_stream_NewURL | ( | vlc_object_t * | obj, |
const char * | url | ||
) |
Create a stream_t reading from a URL.
You must delete it using vlc_stream_Delete.
References msg_Err, stream_AccessNew(), and stream_FilterAutoNew().
ssize_t vlc_stream_Peek | ( | stream_t * | s, |
const uint8_t ** | bufp, | ||
size_t | len | ||
) |
Peeks at data from a byte stream.
This function buffers for the requested number of bytes, waiting if necessary. Then it stores a pointer to the buffer. Unlike vlc_stream_Read() or vlc_stream_Block(), this function does not modify the stream read offset.
s | the stream object to peek from |
bufp | storage space for the buffer address [OUT] |
len | number of bytes to peek |
ssize_t vlc_stream_Read | ( | stream_t * | s, |
void * | buf, | ||
size_t | len | ||
) |
Reads data from a byte stream.
This function always waits for the requested number of bytes, unless a fatal error is encountered or the end-of-stream is reached first.
If the buffer is NULL, data is skipped instead of read. This is effectively a relative forward seek, but it works even on non-seekable streams.
s | the stream object to read from |
buf | start of buffer to read data into [OUT] |
len | number of bytes to read |
References vlc_stream_ReadPartial().
Referenced by download_key(), download_signature(), GetUpdateFile(), RunDownloader(), update_DownloadReal(), vlc_stream_Block(), and vlc_stream_ReadLine().
Reads a data block from a byte stream.
This function dequeues the next block of data from the byte stream. The byte stream back-end decides on the size of the block; the caller cannot make any assumption about it.
The function might also return NULL spuriously - this does not necessarily imply that the stream is ended nor that it has encountered a nonrecoverable error.
This function should be used instead of vlc_stream_Read() or vlc_stream_Peek() when the caller can handle reads of any size.
References vlc_stream_operations::block, stream_priv_t::block, block_Alloc, block_Release, stream_priv_t::eof, vlc_frame_t::i_buffer, stream_priv_t::offset, stream_t::ops, vlc_frame_t::p_buffer, stream_priv_t::peek, stream_t::pf_block, stream_t::pf_read, vlc_stream_operations::read, vlc_stream_operations::stream, stream_priv, unlikely, and vlc_killed().
Referenced by AStreamReadBlock().
int vlc_stream_ReadDir | ( | stream_t * | s, |
input_item_node_t * | node | ||
) |
Reads a directory.
This function fills an input item node with any and all the items within a directory. The behaviour is undefined if the stream is not a directory.
s | directory object to read from |
node | node to store the items into |
References stream_t::ops, stream_t::pf_readdir, vlc_stream_operations::readdir, and vlc_stream_operations::stream.
char * vlc_stream_ReadLine | ( | stream_t * | s | ) |
References vlc_stream_operations::block, stream_priv_t::char_width, stream_priv_t::conv, stream_priv_t::little_endian, msg_Dbg, msg_Err, stream_t::ops, p, stream_t::pf_block, stream_t::pf_read, vlc_stream_operations::read, vlc_stream_operations::stream, STREAM_LINE_MAX, stream_priv, STREAM_PROBE_LINE, stream_priv_t::text, U16_AT(), unlikely, vlc_iconv(), vlc_iconv_close(), VLC_ICONV_ERR, vlc_iconv_open(), vlc_stream_Peek(), vlc_stream_Read(), vlc_stream_Tell(), vlc_strerror_c(), and VLC_UNUSED.
ssize_t vlc_stream_ReadPartial | ( | stream_t * | s, |
void * | buf, | ||
size_t | len | ||
) |
Reads partial data from a byte stream.
This function waits until some data is available for reading from the stream, a fatal error is encountered or the end-of-stream is reached.
Unlike vlc_stream_Read(), this function does not wait for the full requested bytes count. It can return a short count even before the end of the stream and in the absence of any error.
s | the stream object to read from |
buf | start of buffer to read data into [OUT] |
len | buffer size (maximum number of bytes to read) |
References stream_priv_t::eof, stream_priv_t::offset, stream_priv_t::peek, stream_priv, vlc_stream_CopyBlock(), and vlc_stream_ReadRaw().
Referenced by AStreamReadStream(), and vlc_stream_Read().
int vlc_stream_Seek | ( | stream_t * | s, |
uint64_t | offset | ||
) |
Sets the current stream position.
This function changes the read offset within a stream, if the stream supports seeking. In case of error, the read offset is not changed.
s | the stream object to seek from |
offset | byte offset from the beginning of the stream |
References stream_priv_t::block, block_Release, stream_priv_t::eof, vlc_frame_t::i_buffer, stream_priv_t::offset, stream_t::ops, vlc_frame_t::p_buffer, stream_priv_t::peek, stream_t::pf_seek, vlc_stream_operations::seek, vlc_stream_operations::stream, stream_priv, VLC_EGENERIC, and VLC_SUCCESS.
Referenced by AStreamSeek(), demux_Probe(), and demux_vaControlHelper().
|
inlinestatic |
References STREAM_SET_PAUSE_STATE, and vlc_stream_Control().
|
inlinestatic |
Set the private ID ca.
The ca arg is of type en50221_capmt_info_t
.
References STREAM_SET_PRIVATE_ID_CA, and vlc_stream_Control().
|
inlinestatic |
References state, STREAM_SET_PRIVATE_ID_STATE, and vlc_stream_Control().
|
inlinestatic |
References STREAM_SET_RECORD_STATE, and vlc_stream_Control().
|
inlinestatic |
References STREAM_SET_SEEKPOINT, and vlc_stream_Control().
|
inlinestatic |
References STREAM_SET_TITLE, and vlc_stream_Control().
uint64_t vlc_stream_Tell | ( | const stream_t * | s | ) |
Tells the current stream position.
This function tells the current read offset (in bytes) from the start of the start of the stream.
References stream_priv_t::offset, and stream_priv.
Referenced by demux_Probe(), demux_vaControlHelper(), and vlc_stream_ReadLine().
int vlc_stream_vaControl | ( | stream_t * | s, |
int | cmd, | ||
va_list | args | ||
) |
Use to control the "stream_t *".
Look at stream_query_e for possible "i_query" value and format arguments. Return VLC_SUCCESS if ... succeed ;) and VLC_EGENERIC if failed or unimplemented
References stream_priv_t::block, block_Release, vlc_stream_operations::can_control_pace, vlc_stream_operations::can_fastseek, vlc_stream_operations::can_pause, vlc_stream_operations::can_seek, DEFAULT_PTS_DELAY, vlc_stream_operations::get_content_type, vlc_stream_operations::get_meta, vlc_stream_operations::get_mtime, vlc_stream_operations::get_private_id_state, vlc_stream_operations::get_pts_delay, vlc_stream_operations::get_seekpoint, vlc_stream_operations::get_signal, vlc_stream_operations::get_size, vlc_stream_operations::get_tags, vlc_stream_operations::get_title, vlc_stream_operations::get_title_info, vlc_stream_operations::get_type, stream_priv_t::offset, stream_t::ops, stream_priv_t::peek, stream_t::pf_control, vlc_stream_operations::set_pause_state, vlc_stream_operations::set_private_id_ca, vlc_stream_operations::set_private_id_state, vlc_stream_operations::set_record_state, vlc_stream_operations::set_seek_point, vlc_stream_operations::set_title, vlc_stream_operations::stream, STREAM_CAN_CONTROL_PACE, STREAM_CAN_FASTSEEK, STREAM_CAN_PAUSE, STREAM_CAN_SEEK, STREAM_GET_CONTENT_TYPE, STREAM_GET_META, STREAM_GET_MTIME, STREAM_GET_PRIVATE_ID_STATE, STREAM_GET_PTS_DELAY, STREAM_GET_SEEKPOINT, STREAM_GET_SIGNAL, STREAM_GET_SIZE, STREAM_GET_TAGS, STREAM_GET_TITLE, STREAM_GET_TITLE_INFO, STREAM_GET_TYPE, stream_priv, STREAM_SET_PAUSE_STATE, STREAM_SET_PRIVATE_ID_CA, STREAM_SET_PRIVATE_ID_STATE, STREAM_SET_RECORD_STATE, STREAM_SET_SEEKPOINT, STREAM_SET_TITLE, vlc_assert_unreachable, VLC_EGENERIC, and VLC_SUCCESS.
Referenced by AStreamControl(), demux_vaControlHelper(), and vlc_stream_Control().