VLC  3.0.0-git
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Files | Data Structures | Macros | Enumerations | Functions
Stream

Buffered input byte streams. More...

Collaboration diagram for Stream:

Files

file  vlc_stream.h
 Byte streams and byte stream filter modules interface.
 

Data Structures

struct  stream_t
 stream_t definition More...
 

Macros

#define stream_MemoryNew(a, b, c, d)   stream_MemoryNew( VLC_OBJECT(a), b, c, d )
 
#define stream_UrlNew(a, b)   stream_UrlNew( VLC_OBJECT(a), b )
 
#define stream_FilterSetDefaultReadDir(p_stream)   p_stream->pf_readdir = stream_FilterDefaultReadDir;
 Sets stream_FilterDefaultReadDir as the pf_readdir callback for this stream filter. More...
 

Enumerations

enum  stream_query_e {
  STREAM_CAN_SEEK, STREAM_CAN_FASTSEEK, STREAM_CAN_PAUSE, STREAM_CAN_CONTROL_PACE,
  STREAM_SET_POSITION, STREAM_GET_POSITION, STREAM_GET_SIZE, STREAM_IS_DIRECTORY,
  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_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 stream_Control() and stream_vaControl() More...
 

Functions

ssize_t stream_Read (stream_t *, void *, size_t)
 Reads data from a byte stream. More...
 
ssize_t stream_Peek (stream_t *, const uint8_t **, size_t)
 
int stream_vaControl (stream_t *s, int i_query, va_list args)
 Use to control the "stream_t *". More...
 
void stream_Delete (stream_t *s)
 Destroy a stream. More...
 
int stream_Control (stream_t *s, int i_query,...)
 
block_tstream_Block (stream_t *s, int i_size)
 Read "i_size" bytes and store them in a block_t. More...
 
char * stream_ReadLine (stream_t *)
 
input_item_tstream_ReadDir (stream_t *)
 Read the next input_item_t from the directory stream. More...
 
static int64_t stream_Tell (stream_t *s)
 Get the current position in a stream. More...
 
static int64_t stream_Size (stream_t *s)
 Get the size of the stream. More...
 
static int stream_Seek (stream_t *s, uint64_t i_pos)
 
static char * stream_ContentType (stream_t *s)
 Get the Content-Type of a stream, or NULL if unknown. More...
 
stream_tstream_DemuxNew (demux_t *p_demux, const char *psz_demux, es_out_t *out)
 Create a special stream and a demuxer, this allows chaining demuxers You must delete it using stream_Delete. More...
 
void stream_DemuxSend (stream_t *s, block_t *p_block)
 Send data to a stream handle created by stream_DemuxNew(). More...
 
int stream_DemuxControlVa (stream_t *s, int, va_list)
 Perform a demux (i.e. More...
 
static int stream_DemuxControl (stream_t *s, int query,...)
 
stream_tstream_MemoryNew (vlc_object_t *p_obj, uint8_t *p_buffer, uint64_t i_size, bool b_preserve_memory)
 Create a stream_t reading from memory. More...
 
stream_tstream_UrlNew (vlc_object_t *p_this, const char *psz_url)
 Create a stream_t reading from a URL. More...
 
stream_tstream_FilterNew (stream_t *p_source, const char *psz_stream_filter)
 Try to add a stream filter to an open stream. More...
 
input_item_tstream_FilterDefaultReadDir (stream_t *s)
 Default ReadDir implementation for stream Filter. More...
 

Detailed Description

Buffered input byte streams.

Macro Definition Documentation

#define stream_FilterSetDefaultReadDir (   p_stream)    p_stream->pf_readdir = stream_FilterDefaultReadDir;

Sets stream_FilterDefaultReadDir as the pf_readdir callback for this stream filter.

#define stream_MemoryNew (   a,
  b,
  c,
 
)    stream_MemoryNew( VLC_OBJECT(a), b, c, d )
#define stream_UrlNew (   a,
 
)    stream_UrlNew( VLC_OBJECT(a), b )

Referenced by DownloadArt(), and ImageReadUrl().

Enumeration Type Documentation

Possible commands to send to stream_Control() and 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_SET_POSITION 

arg1= uint64_t res=can fail

STREAM_GET_POSITION 

arg1= uint64_t * res=cannot fail

STREAM_GET_SIZE 

arg1= uint64_t * res=can fail

STREAM_IS_DIRECTORY 

arg1= bool *, arg2= bool *, arg3=bool *, res=cannot fail

STREAM_GET_PTS_DELAY 

arg1= int64_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_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 *psz_ext (if arg1 is true) res=can fail

STREAM_SET_PRIVATE_ID_STATE 
STREAM_SET_PRIVATE_ID_CA 
STREAM_GET_PRIVATE_ID_STATE 

Function Documentation

block_t* stream_Block ( stream_t s,
int  i_size 
)

Read "i_size" bytes and store them in a block_t.

It always read i_size bytes unless you are at the end of the stream where it return what is available.

References block_Alloc(), block_Release(), block_t::i_buffer, block_t::p_buffer, and stream_Read().

static char* stream_ContentType ( stream_t s)
inlinestatic

Get the Content-Type of a stream, or NULL if unknown.

Result must be free()'d.

References stream_Control(), and STREAM_GET_CONTENT_TYPE.

Referenced by demux_New().

int stream_Control ( stream_t s,
int  i_query,
  ... 
)
void stream_Delete ( stream_t s)
static int stream_DemuxControl ( stream_t s,
int  query,
  ... 
)
inlinestatic
int stream_DemuxControlVa ( stream_t s,
int  ,
va_list   
)

Perform a demux (i.e.

DEMUX_...) control request on a stream handle created by stream_DemuxNew().

< Unspecified error

< No error

References DEMUX_GET_LENGTH, DEMUX_GET_POSITION, DEMUX_GET_TIME, stream_sys_t::length, stream_sys_t::lock, stream_t::p_sys, stream_sys_t::position, stream_sys_t::stats, stream_sys_t::time, VLC_EGENERIC, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_SUCCESS.

Referenced by stream_DemuxControl().

stream_t* stream_DemuxNew ( demux_t p_demux,
const char *  psz_demux,
es_out_t out 
)
void stream_DemuxSend ( stream_t s,
block_t p_block 
)

Send data to a stream handle created by stream_DemuxNew().

References block_FifoPut(), stream_sys_t::p_fifo, and stream_t::p_sys.

input_item_t* stream_FilterDefaultReadDir ( stream_t s)

Default ReadDir implementation for stream Filter.

This implementation just forward the pf_readdir call to the p_source stream.

References stream_t::p_source, and stream_ReadDir().

stream_t* stream_FilterNew ( stream_t p_source,
const char *  psz_stream_filter 
)

Try to add a stream filter to an open stream.

Returns
New stream to use, or NULL if the filter could not be added.

Try to add a stream filter to an open stream.

You must release it using stream_Delete unless it is used as a source to another filter.

References module_need, stream_t::p_input, stream_t::p_module, stream_t::p_source, stream_t::pf_destroy, stream_t::psz_url, strdup(), stream_CommonDelete(), stream_CommonNew(), StreamDelete(), unlikely, and VLC_OBJECT.

Referenced by stream_FilterChainNew().

stream_t* stream_MemoryNew ( vlc_object_t p_this,
uint8_t *  p_buffer,
uint64_t  i_size,
bool  i_preserve_memory 
)

Create a stream_t reading from memory.

You must delete it using stream_Delete.

Create a stream_t reading from memory.

Parameters
p_thisthe calling vlc_object
p_bufferthe memory buffer for the stream
i_bufferthe size of the buffer
i_preserve_memoryif this is set to false the memory buffer pointed to by p_buffer is freed on stream_Destroy

References Control(), Delete(), stream_sys_t::i_pos, stream_sys_t::i_preserve_memory, stream_sys_t::i_size, stream_sys_t::p_buffer, stream_t::p_input, stream_t::p_sys, stream_t::pf_control, stream_t::pf_destroy, stream_t::pf_read, Read(), stream_CommonDelete(), and stream_CommonNew().

ssize_t stream_Peek ( stream_t ,
const uint8_t **  ,
size_t   
)
ssize_t 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.

Parameters
bufstart of buffer to read data into [OUT]
lennumber of bytes to read
Returns
the number of bytes read or a negative value on error.

References block_Release(), block_t::i_buffer, block_t::p_buffer, stream_priv_t::peek, stream_t::pf_read, and unlikely.

Referenced by DownloadArt(), ImageReadUrl(), SkipAPETag(), SkipID3Tag(), stream_Block(), and stream_ReadLine().

input_item_t* stream_ReadDir ( stream_t s)

Read the next input_item_t from the directory stream.

It returns the next input item on success or NULL in case of error or end of stream. The item must be released with input_item_Release.

References stream_t::pf_readdir.

Referenced by stream_FilterDefaultReadDir().

char* stream_ReadLine ( stream_t )
static int stream_Seek ( stream_t s,
uint64_t  i_pos 
)
inlinestatic
static int64_t stream_Size ( stream_t s)
inlinestatic

Get the size of the stream.

References stream_Control(), and STREAM_GET_SIZE.

Referenced by demux_vaControlHelper(), and ImageReadUrl().

static int64_t stream_Tell ( stream_t s)
inlinestatic

Get the current position in a stream.

References stream_Control(), and STREAM_GET_POSITION.

Referenced by demux_vaControlHelper(), and stream_ReadLine().

stream_t* stream_UrlNew ( vlc_object_t p_this,
const char *  psz_url 
)

Create a stream_t reading from a URL.

You must delete it using stream_Delete.

References msg_Err, stream_AccessNew(), and vlc_access_NewMRL().

int 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

< No error

< No error

References block_Release(), block_t::i_buffer, stream_priv_t::peek, stream_t::pf_control, stream_ControlInternal(), STREAM_GET_POSITION, STREAM_SET_POSITION, and VLC_SUCCESS.

Referenced by demux_vaControlHelper(), and stream_Control().