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

Raw input byte streams. More...

Collaboration diagram for Access:

Files

file  vlc_access.h
 Input byte stream modules interface.
 

Data Structures

struct  access_t
 

Macros

#define ACCESS_SET_CALLBACKS(read, block, control, seek)
 
#define STANDARD_READ_ACCESS_INIT
 
#define STANDARD_BLOCK_ACCESS_INIT
 

Enumerations

enum  access_query_e {
  ACCESS_CAN_SEEK, ACCESS_CAN_FASTSEEK, ACCESS_CAN_PAUSE, ACCESS_CAN_CONTROL_PACE,
  ACCESS_GET_SIZE =6, ACCESS_GET_PTS_DELAY = 0x101, ACCESS_GET_TITLE_INFO, ACCESS_GET_TITLE,
  ACCESS_GET_SEEKPOINT, ACCESS_GET_META, ACCESS_GET_CONTENT_TYPE, ACCESS_GET_SIGNAL,
  ACCESS_SET_PAUSE_STATE = 0x200, ACCESS_SET_TITLE, ACCESS_SET_SEEKPOINT, ACCESS_SET_PRIVATE_ID_STATE = 0x1000,
  ACCESS_SET_PRIVATE_ID_CA, ACCESS_GET_PRIVATE_ID_STATE
}
 

Functions

access_tvlc_access_NewMRL (vlc_object_t *obj, const char *mrl)
 Opens a new read-only byte stream. More...
 
void vlc_access_Delete (access_t *access)
 Closes a byte stream. More...
 
static int vlc_access_Seek (access_t *access, uint64_t offset)
 Sets the read byte offset. More...
 
static uint64_t vlc_access_Tell (const access_t *access)
 Gets the read byte offset. More...
 
static bool vlc_access_Eof (const access_t *access)
 Checks if end-of-stream is reached. More...
 
static ssize_t vlc_access_Read (access_t *access, void *buf, size_t len)
 Reads a byte stream. More...
 
static block_tvlc_access_Block (access_t *access)
 Dequeues one block of data. More...
 
static int access_vaControl (access_t *p_access, int i_query, va_list args)
 
static int access_Control (access_t *p_access, int i_query,...)
 
static uint64_t access_GetSize (access_t *p_access)
 
static void access_InitFields (access_t *p_a)
 
int access_vaDirectoryControlHelper (access_t *p_access, int i_query, va_list args)
 Default pf_control callback for directory accesses. More...
 

Detailed Description

Raw input byte streams.

Macro Definition Documentation

#define ACCESS_SET_CALLBACKS (   read,
  block,
  control,
  seek 
)
Value:
do { \
p_access->pf_read = (read); \
p_access->pf_block = (block); \
p_access->pf_control = (control); \
p_access->pf_seek = (seek); \
} while(0)
#define STANDARD_BLOCK_ACCESS_INIT
Value:
do { \
access_InitFields( p_access ); \
ACCESS_SET_CALLBACKS( NULL, Block, Control, Seek ); \
p_sys = p_access->p_sys = (access_sys_t*)calloc( 1, sizeof( access_sys_t ) ); \
if( !p_sys ) return VLC_ENOMEM; \
} while(0);
#define ACCESS_SET_CALLBACKS(read, block, control, seek)
Definition: vlc_access.h:256
static int Control(es_out_t *, int i_query, va_list)
Definition: es_out_timeshift.c:707
struct access_sys_t access_sys_t
Definition: vlc_common.h:223
static void access_InitFields(access_t *p_a)
Definition: vlc_access.h:245
#define VLC_ENOMEM
Not enough memory.
Definition: vlc_common.h:360
#define STANDARD_READ_ACCESS_INIT
Value:
do { \
access_InitFields( p_access ); \
p_sys = p_access->p_sys = (access_sys_t*)calloc( 1, sizeof( access_sys_t ) ); \
if( !p_sys ) return VLC_ENOMEM;\
} while(0);
#define ACCESS_SET_CALLBACKS(read, block, control, seek)
Definition: vlc_access.h:256
static int Control(es_out_t *, int i_query, va_list)
Definition: es_out_timeshift.c:707
struct access_sys_t access_sys_t
Definition: vlc_common.h:223
static void access_InitFields(access_t *p_a)
Definition: vlc_access.h:245
#define VLC_ENOMEM
Not enough memory.
Definition: vlc_common.h:360
static ssize_t Read(stream_t *, void *p_read, size_t i_read)
Definition: stream_memory.c:154

Enumeration Type Documentation

Enumerator
ACCESS_CAN_SEEK 
ACCESS_CAN_FASTSEEK 
ACCESS_CAN_PAUSE 
ACCESS_CAN_CONTROL_PACE 
ACCESS_GET_SIZE 
ACCESS_GET_PTS_DELAY 
ACCESS_GET_TITLE_INFO 
ACCESS_GET_TITLE 
ACCESS_GET_SEEKPOINT 
ACCESS_GET_META 
ACCESS_GET_CONTENT_TYPE 
ACCESS_GET_SIGNAL 
ACCESS_SET_PAUSE_STATE 
ACCESS_SET_TITLE 
ACCESS_SET_SEEKPOINT 
ACCESS_SET_PRIVATE_ID_STATE 
ACCESS_SET_PRIVATE_ID_CA 
ACCESS_GET_PRIVATE_ID_STATE 

Function Documentation

static int access_Control ( access_t p_access,
int  i_query,
  ... 
)
inlinestatic
static uint64_t access_GetSize ( access_t p_access)
inlinestatic
static void access_InitFields ( access_t p_a)
inlinestatic

References access_t::b_eof, access_t::i_pos, and access_t::info.

Referenced by access_New().

static int access_vaControl ( access_t p_access,
int  i_query,
va_list  args 
)
inlinestatic

< Unspecified error

References access_t::pf_control, and VLC_EGENERIC.

Referenced by access_Control(), and AStreamControl().

int access_vaDirectoryControlHelper ( access_t p_access,
int  i_query,
va_list  args 
)

Default pf_control callback for directory accesses.

< Unspecified error

< No error

References ACCESS_CAN_CONTROL_PACE, ACCESS_CAN_FASTSEEK, ACCESS_CAN_PAUSE, ACCESS_CAN_SEEK, ACCESS_GET_PTS_DELAY, VLC_EGENERIC, VLC_SUCCESS, and VLC_UNUSED.

static block_t* vlc_access_Block ( access_t access)
inlinestatic

Dequeues one block of data.

This function waits for a block of data to be available (if necessary) and returns a reference to it. Not all byte streams support this. Some streams must be read with vlc_access_Read() instead.

Note
The returned block may be of any size. The size is dependent on the underlying implementation of the byte stream.
The function may return NULL spuriously. A NULL return is not indicative of a fatal error.
Returns
a data block (free with block_Release()) or NULL

References access_t::pf_block.

void vlc_access_Delete ( access_t access)

Closes a byte stream.

Parameters
accessbyte stream to close

References module_unneed, access_t::p_module, access_t::psz_access, access_t::psz_filepath, access_t::psz_location, and vlc_object_release.

Referenced by AStreamDestroy(), and stream_AccessNew().

static bool vlc_access_Eof ( const access_t access)
inlinestatic

Checks if end-of-stream is reached.

References access_t::b_eof, and access_t::info.

access_t* vlc_access_NewMRL ( vlc_object_t obj,
const char *  mrl 
)

Opens a new read-only byte stream.

This function might block. The initial offset is of course always zero.

Parameters
objparent VLC object
mrlmedia resource location to read
Returns
a new access object on success, NULL on failure

References access_New(), input_SplitMRL(), strdup(), and unlikely.

Referenced by stream_UrlNew().

static ssize_t vlc_access_Read ( access_t access,
void *  buf,
size_t  len 
)
inlinestatic

Reads a byte stream.

This function waits for some data to be available (if necessary) and returns available data (up to the requested size). Not all byte streams support this. Some streams must be read with vlc_access_Block() instead.

Note
A short read does not imply the end of the stream. It merely implies that enough data is not immediately available. To detect the end of the stream, either check if the function returns zero, or call vlc_access_Eof().
The function may return a negative value spuriously. Negative error values should be ignored; they do not necessarily indicate a fatal error.
Parameters
bufbuffer to read data into
lensize of the buffer in bytes
Returns
the number of bytes read (possibly less than requested), zero at end-of-stream, or -1 on transient errors

References access_t::pf_read.

Referenced by AReadStream().

static int vlc_access_Seek ( access_t access,
uint64_t  offset 
)
inlinestatic

Sets the read byte offset.

< Unspecified error

References access_t::pf_seek, and VLC_EGENERIC.

Referenced by AStreamSeekBlock(), and AStreamSeekStream().

static uint64_t vlc_access_Tell ( const access_t access)
inlinestatic

Gets the read byte offset.

References access_t::i_pos, and access_t::info.