VLC  3.0.21
Data Structures | Macros | Typedefs | Enumerations | Functions
vlc_input.h File Reference
Include dependency graph for vlc_input.h:

Go to the source code of this file.

Data Structures

struct  seekpoint_t
 
struct  input_title_t
 
struct  input_attachment_t
 
struct  input_thread_t
 Main structure representing an input thread. More...
 

Macros

#define INPUT_TITLE_MENU   0x01 /* Menu title */
 
#define INPUT_TITLE_INTERACTIVE   0x02 /* Interactive title. Playback position has no meaning. */
 
#define INPUT_RECORD_PREFIX   "vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p"
 Record prefix string. More...
 
#define INPUT_RATE_DEFAULT   1000
 Input rate. More...
 
#define INPUT_RATE_MIN   32 /* Up to 32/1 */
 Minimal rate value. More...
 
#define INPUT_RATE_MAX   32000 /* Up to 1/32 */
 Maximal rate value. More...
 
#define input_Create(a, b, c, d, e)   input_Create(VLC_OBJECT(a),b,c,d,e)
 
#define input_Read(a, b)   input_Read(VLC_OBJECT(a),b)
 
#define input_CreateAndStart(a, b, c)   input_CreateAndStart(VLC_OBJECT(a),b,c)
 

Typedefs

typedef struct input_title_t input_title_t
 
typedef struct input_resource_t input_resource_t
 This defines an opaque input resource handler. More...
 
typedef enum input_state_e input_state_e
 Input state. More...
 
typedef enum input_event_type_e input_event_type_e
 Input events. More...
 

Enumerations

enum  input_state_e {
  INIT_S = 0, OPENING_S, PLAYING_S, PAUSE_S,
  END_S, ERROR_S
}
 Input state. More...
 
enum  input_event_type_e {
  INPUT_EVENT_STATE, INPUT_EVENT_DEAD, INPUT_EVENT_RATE, INPUT_EVENT_POSITION,
  INPUT_EVENT_LENGTH, INPUT_EVENT_TITLE, INPUT_EVENT_CHAPTER, INPUT_EVENT_PROGRAM,
  INPUT_EVENT_ES, INPUT_EVENT_TELETEXT, INPUT_EVENT_RECORD, INPUT_EVENT_ITEM_META,
  INPUT_EVENT_ITEM_INFO, INPUT_EVENT_ITEM_EPG, INPUT_EVENT_STATISTICS, INPUT_EVENT_SIGNAL,
  INPUT_EVENT_AUDIO_DELAY, INPUT_EVENT_SUBTITLE_DELAY, INPUT_EVENT_BOOKMARK, INPUT_EVENT_CACHE,
  INPUT_EVENT_AOUT, INPUT_EVENT_VOUT
}
 Input events. More...
 
enum  input_query_e {
  INPUT_GET_POSITION, INPUT_SET_POSITION, INPUT_GET_LENGTH, INPUT_GET_TIME,
  INPUT_SET_TIME, INPUT_GET_RATE, INPUT_SET_RATE, INPUT_GET_STATE,
  INPUT_SET_STATE, INPUT_GET_AUDIO_DELAY, INPUT_SET_AUDIO_DELAY, INPUT_GET_SPU_DELAY,
  INPUT_SET_SPU_DELAY, INPUT_NAV_ACTIVATE, INPUT_NAV_UP, INPUT_NAV_DOWN,
  INPUT_NAV_LEFT, INPUT_NAV_RIGHT, INPUT_NAV_POPUP, INPUT_NAV_MENU,
  INPUT_ADD_INFO, INPUT_REPLACE_INFOS, INPUT_MERGE_INFOS, INPUT_DEL_INFO,
  INPUT_GET_BOOKMARK, INPUT_GET_BOOKMARKS, INPUT_CLEAR_BOOKMARKS, INPUT_ADD_BOOKMARK,
  INPUT_CHANGE_BOOKMARK, INPUT_DEL_BOOKMARK, INPUT_SET_BOOKMARK, INPUT_GET_TITLE_INFO,
  INPUT_GET_FULL_TITLE_INFO, INPUT_GET_SEEKPOINTS, INPUT_GET_ATTACHMENTS, INPUT_GET_ATTACHMENT,
  INPUT_ADD_SLAVE, INPUT_SET_RECORD_STATE, INPUT_GET_RECORD_STATE, INPUT_RESTART_ES,
  INPUT_UPDATE_VIEWPOINT, INPUT_SET_INITIAL_VIEWPOINT, INPUT_GET_AOUT, INPUT_GET_VOUTS,
  INPUT_GET_ES_OBJECTS, INPUT_SET_RENDERER, INPUT_GET_PCR_SYSTEM, INPUT_MODIFY_PCR_SYSTEM
}
 Input queries. More...
 

Functions

static seekpoint_tvlc_seekpoint_New (void)
 
static void vlc_seekpoint_Delete (seekpoint_t *point)
 
static seekpoint_tvlc_seekpoint_Duplicate (const seekpoint_t *src)
 
static input_title_tvlc_input_title_New (void)
 
static void vlc_input_title_Delete (input_title_t *t)
 
static input_title_tvlc_input_title_Duplicate (const input_title_t *t)
 
static void vlc_input_attachment_Delete (input_attachment_t *a)
 
static input_attachment_tvlc_input_attachment_New (const char *psz_name, const char *psz_mime, const char *psz_description, const void *p_data, size_t i_data)
 
static input_attachment_tvlc_input_attachment_Duplicate (const input_attachment_t *a)
 
input_thread_tinput_Create (vlc_object_t *p_parent, input_item_t *, const char *psz_log, input_resource_t *, vlc_renderer_item_t *p_renderer)
 Create a new input_thread_t. More...
 
int input_Start (input_thread_t *)
 Start a input_thread_t created by input_Create. More...
 
void input_Stop (input_thread_t *)
 Request a running input thread to stop and die. More...
 
int input_Read (vlc_object_t *, input_item_t *)
 Initialize an input thread and run it until it stops by itself. More...
 
int input_vaControl (input_thread_t *, int i_query, va_list)
 
int input_Control (input_thread_t *, int i_query,...)
 Control function for inputs. More...
 
void input_Close (input_thread_t *)
 Close an input. More...
 
static input_thread_tinput_CreateAndStart (vlc_object_t *parent, input_item_t *item, const char *log)
 Create a new input_thread_t and start it. More...
 
input_item_tinput_GetItem (input_thread_t *)
 Get the input item for an input thread. More...
 
static input_state_e input_GetState (input_thread_t *p_input)
 It will return the current state of the input. More...
 
static vout_thread_tinput_GetVout (input_thread_t *p_input)
 Return one of the video output (if any). More...
 
static int input_AddSlave (input_thread_t *p_input, enum slave_type type, const char *psz_uri, bool b_forced, bool b_notify, bool b_check_ext)
 
static int input_UpdateViewpoint (input_thread_t *p_input, const vlc_viewpoint_t *p_viewpoint, bool b_absolute)
 Update the viewpoint of the input thread. More...
 
static audio_output_tinput_GetAout (input_thread_t *p_input)
 Return the audio output (if any) associated with an input. More...
 
static int input_GetEsObjects (input_thread_t *p_input, int i_id, vlc_object_t **pp_decoder, vout_thread_t **pp_vout, audio_output_t **pp_aout)
 Returns the objects associated to an ES. More...
 
static int input_GetPcrSystem (input_thread_t *p_input, vlc_tick_t *pi_system, vlc_tick_t *pi_delay)
 
static int input_ModifyPcrSystem (input_thread_t *p_input, bool b_absolute, vlc_tick_t i_system)
 
decoder_tinput_DecoderCreate (vlc_object_t *, const es_format_t *, input_resource_t *)
 Spawn a decoder thread outside of the input thread. More...
 
void input_DecoderDelete (decoder_t *)
 Kills a decoder thread and waits until it's finished. More...
 
void input_DecoderDecode (decoder_t *, block_t *, bool b_do_pace)
 Put a block_t in the decoder's fifo. More...
 
void input_DecoderDrain (decoder_t *)
 Signals that there are no further blocks to decode, and requests that the decoder drain all pending buffers. More...
 
void input_DecoderFlush (decoder_t *)
 Requests that the decoder immediately discard all pending buffers. More...
 
char * input_CreateFilename (input_thread_t *, const char *psz_path, const char *psz_prefix, const char *psz_extension)
 This function creates a sane filename path. More...
 
input_resource_tinput_resource_New (vlc_object_t *)
 It creates an empty input resource handler. More...
 
void input_resource_Release (input_resource_t *)
 It releases an input resource. More...
 
void input_resource_TerminateVout (input_resource_t *)
 Forcefully destroys the video output (e.g. More...
 
void input_resource_Terminate (input_resource_t *)
 This function releases all resources (object). More...
 
audio_output_tinput_resource_HoldAout (input_resource_t *)
 
audio_output_tinput_resource_GetAout (input_resource_t *)
 This function creates or recycles an audio output. More...
 
void input_resource_PutAout (input_resource_t *, audio_output_t *)
 This function retains or destroys an audio output. More...
 
void input_resource_ResetAout (input_resource_t *)
 Prevents the existing audio output (if any) from being recycled. More...
 

Detailed Description

Input thread interface

Macro Definition Documentation

◆ input_Create

#define input_Create (   a,
  b,
  c,
  d,
 
)    input_Create(VLC_OBJECT(a),b,c,d,e)

◆ input_CreateAndStart

#define input_CreateAndStart (   a,
  b,
 
)    input_CreateAndStart(VLC_OBJECT(a),b,c)

◆ input_Read

#define input_Read (   a,
 
)    input_Read(VLC_OBJECT(a),b)

Function Documentation

◆ input_AddSlave()

static int input_AddSlave ( input_thread_t p_input,
enum slave_type  type,
const char *  psz_uri,
bool  b_forced,
bool  b_notify,
bool  b_check_ext 
)
inlinestatic

◆ input_Close()

void input_Close ( input_thread_t p_input)

Close an input.

It does not call input_Stop itself.

References input_priv(), thread, vlc_interrupt_deinit(), vlc_join(), and vlc_object_release.

Referenced by PreparserCloseInput().

◆ input_Control()

int input_Control ( input_thread_t p_input,
int  i_query,
  ... 
)

Control function for inputs.

Parameters
p_inputinput handle
i_queryquery type
Returns
VLC_SUCCESS if ok

References input_vaControl().

Referenced by Create(), DecoderGetInputAttachments(), input_GetAout(), input_GetState(), input_GetVout(), input_ModifyPcrSystem(), input_UpdateViewpoint(), and playlist_SetRenderer().

◆ input_Create()

input_thread_t* input_Create ( vlc_object_t p_parent,
input_item_t p_item,
const char *  psz_log,
input_resource_t p_resource,
vlc_renderer_item_t p_renderer 
)

Create a new input_thread_t.

You need to call input_Start on it when you are done adding callback on the variables/events you want to monitor.

Parameters
p_parenta vlc_object
p_iteman input item
psz_logan optional prefix for this input logs
p_resourcean optional input ressource
Returns
a pointer to the spawned input thread

References Create().

◆ input_CreateAndStart()

static input_thread_t* input_CreateAndStart ( vlc_object_t parent,
input_item_t item,
const char *  log 
)
inlinestatic

Create a new input_thread_t and start it.

Provided for convenience.

See also
input_Create

References input_Create.

◆ input_CreateFilename()

char* input_CreateFilename ( input_thread_t ,
const char *  psz_path,
const char *  psz_prefix,
const char *  psz_extension 
)

◆ input_DecoderCreate()

decoder_t* input_DecoderCreate ( vlc_object_t ,
const es_format_t ,
input_resource_t  
)

Spawn a decoder thread outside of the input thread.

References decoder_New().

◆ input_DecoderDecode()

void input_DecoderDecode ( decoder_t p_dec,
block_t p_block,
bool  b_do_pace 
)

◆ input_DecoderDelete()

void input_DecoderDelete ( decoder_t p_dec)

◆ input_DecoderDrain()

void input_DecoderDrain ( decoder_t p_dec)

Signals that there are no further blocks to decode, and requests that the decoder drain all pending buffers.

This is used to ensure that all intermediate buffers empty and no samples get lost at the end of the stream.

Note
The function does not actually wait for draining. It just signals that draining should be performed once the decoder has emptied FIFO.

References decoder_owner_sys_t::b_draining, decoder_owner_sys_t::p_fifo, decoder_t::p_owner, vlc_fifo_Lock(), vlc_fifo_Signal(), and vlc_fifo_Unlock().

Referenced by EsOutControlLocked().

◆ input_DecoderFlush()

void input_DecoderFlush ( decoder_t p_dec)

◆ input_GetAout()

static audio_output_t* input_GetAout ( input_thread_t p_input)
inlinestatic

Return the audio output (if any) associated with an input.

Parameters
p_inputan input thread
Returns
NULL on error, or the audio output (which needs to be released with vlc_object_release()).

References input_Control(), and INPUT_GET_AOUT.

◆ input_GetEsObjects()

static int input_GetEsObjects ( input_thread_t p_input,
int  i_id,
vlc_object_t **  pp_decoder,
vout_thread_t **  pp_vout,
audio_output_t **  pp_aout 
)
inlinestatic

Returns the objects associated to an ES.

You must release all non NULL object using vlc_object_release. You may set pointer of pointer to NULL to avoid retreiving it.

◆ input_GetItem()

input_item_t* input_GetItem ( input_thread_t p_input)

Get the input item for an input thread.

You have to keep a reference to the input or to the input_item_t until you do not need it anymore.

Get the input item for an input thread.

if it is used after p_input is destroyed nothing prevent it from being freed.

References input_priv(), and input_thread_private_t::p_item.

◆ input_GetPcrSystem()

static int input_GetPcrSystem ( input_thread_t p_input,
vlc_tick_t pi_system,
vlc_tick_t pi_delay 
)
inlinestatic

◆ input_GetState()

static input_state_e input_GetState ( input_thread_t p_input)
inlinestatic

It will return the current state of the input.

Provided for convenience.

References INIT_S, input_Control(), and INPUT_GET_STATE.

Referenced by PreparserCloseInput(), and PreparserProbeInput().

◆ input_GetVout()

static vout_thread_t* input_GetVout ( input_thread_t p_input)
inlinestatic

Return one of the video output (if any).

If possible, you should use INPUT_GET_VOUTS directly and process all video outputs instead.

Parameters
p_inputan input thread from which to get a video output
Returns
NULL on error, or a video output thread pointer (which needs to be released with vlc_object_release()).

References input_Control(), and INPUT_GET_VOUTS.

Referenced by input_vaControl().

◆ input_ModifyPcrSystem()

static int input_ModifyPcrSystem ( input_thread_t p_input,
bool  b_absolute,
vlc_tick_t  i_system 
)
inlinestatic

◆ input_Read()

int input_Read ( vlc_object_t p_parent,
input_item_t p_item 
)

Initialize an input thread and run it until it stops by itself.

Parameters
p_parenta vlc_object
p_iteman input item
Returns
an error code, VLC_SUCCESS on success

< Unspecified error

< No error

References Create(), End(), Init(), MainLoop(), VLC_EGENERIC, vlc_object_release, and VLC_SUCCESS.

◆ input_resource_GetAout()

audio_output_t* input_resource_GetAout ( input_resource_t )

◆ input_resource_HoldAout()

audio_output_t* input_resource_HoldAout ( input_resource_t )
Returns
the current audio output if any. Use vlc_object_release() to drop the reference.

Referenced by input_vaControl(), and playlist_GetAout().

◆ input_resource_New()

input_resource_t* input_resource_New ( vlc_object_t )

It creates an empty input resource handler.

The given object MUST stay alive as long as the input_resource_t is not deleted.

References input_resource_t::lock, input_resource_t::lock_hold, input_resource_t::p_parent, input_resource_t::refs, and vlc_mutex_init().

Referenced by Create(), and playlist_Create().

◆ input_resource_PutAout()

void input_resource_PutAout ( input_resource_t ,
audio_output_t  
)

This function retains or destroys an audio output.

Referenced by aout_update_format(), DeleteDecoder(), playlist_Create(), and ReloadDecoder().

◆ input_resource_Release()

void input_resource_Release ( input_resource_t )

It releases an input resource.

Referenced by input_Destructor(), and playlist_Destroy().

◆ input_resource_ResetAout()

void input_resource_ResetAout ( input_resource_t )

Prevents the existing audio output (if any) from being recycled.

◆ input_resource_Terminate()

void input_resource_Terminate ( input_resource_t )

This function releases all resources (object).

Referenced by Thread().

◆ input_resource_TerminateVout()

void input_resource_TerminateVout ( input_resource_t )

Forcefully destroys the video output (e.g.

when the playlist is stopped).

Referenced by EsOutControlLocked(), and Thread().

◆ input_Start()

int input_Start ( input_thread_t p_input)

Start a input_thread_t created by input_Create.

You must not start an already running input_thread_t.

Parameters
theinput thread to start

< Unspecified error

< No error

References input_thread_private_t::b_preparsing, ERROR_S, input_ChangeState(), input_priv(), input_thread_private_t::is_running, msg_Err, Preparse(), Run(), input_thread_private_t::thread, vlc_clone(), VLC_EGENERIC, VLC_SUCCESS, and VLC_THREAD_PRIORITY_INPUT.

Referenced by PlayItem().

◆ input_Stop()

void input_Stop ( input_thread_t p_input)

◆ input_UpdateViewpoint()

static int input_UpdateViewpoint ( input_thread_t p_input,
const vlc_viewpoint_t p_viewpoint,
bool  b_absolute 
)
inlinestatic

Update the viewpoint of the input thread.

The viewpoint will be applied to all vouts and aouts.

Parameters
p_inputan input thread
p_viewpointthe viewpoint value
b_absoluteif true replace the old viewpoint with the new one. If false, increase/decrease it.
Returns
VLC_SUCCESS or a VLC error code

References input_Control(), and INPUT_UPDATE_VIEWPOINT.

◆ input_vaControl()

int input_vaControl ( input_thread_t ,
int  i_query,
va_list   
)

< No error

< No error

< No error

< No error

< No error

< No error

< No error

< No error

< Unspecified error

< No error

< No error

< Unspecified error

< No error

< Unspecified error

< No error

< Unspecified error

< No error

< Unspecified error

< No error

< No error

< No error

< No error

< Unspecified error

< Not enough memory

< No error

< Unspecified error

< No error

< Not enough memory

< No error

< Unspecified error

< Unspecified error

< Not enough memory

< No error

< Unspecified error

< No error

< No error

< Unspecified error

< No error

< No error

< No error

< Not enough memory

< No error

< Unspecified error

< No error

< Unspecified error

< No error

< No error

< Unspecified error

References _, asprintf(), input_thread_private_t::attachment, input_item_slave::b_forced, input_thread_private_t::b_preparsing, input_thread_private_t::bookmark, count, es_out_Control(), es_out_ControlGetPcrSystem(), es_out_ControlModifyPcrSystem(), ES_OUT_GET_ES_OBJECTS_BY_ID, input_thread_private_t::i_attachment, input_thread_private_t::i_bookmark, vlc_value_t::i_int, input_title_t::i_seekpoint, input_thread_private_t::i_title, INPUT_ADD_BOOKMARK, INPUT_ADD_INFO, INPUT_ADD_SLAVE, INPUT_CHANGE_BOOKMARK, INPUT_CLEAR_BOOKMARKS, INPUT_CONTROL_ADD_SLAVE, INPUT_CONTROL_NAV_ACTIVATE, INPUT_CONTROL_RESTART_ES, INPUT_CONTROL_SET_BOOKMARK, INPUT_CONTROL_SET_INITIAL_VIEWPOINT, INPUT_CONTROL_SET_RENDERER, INPUT_CONTROL_SET_VIEWPOINT, INPUT_CONTROL_UPDATE_VIEWPOINT, input_ControlPush(), INPUT_DEL_BOOKMARK, INPUT_DEL_INFO, INPUT_GET_AOUT, INPUT_GET_ATTACHMENT, INPUT_GET_ATTACHMENTS, INPUT_GET_AUDIO_DELAY, INPUT_GET_BOOKMARK, INPUT_GET_BOOKMARKS, INPUT_GET_ES_OBJECTS, INPUT_GET_FULL_TITLE_INFO, INPUT_GET_LENGTH, INPUT_GET_PCR_SYSTEM, INPUT_GET_POSITION, INPUT_GET_RATE, INPUT_GET_RECORD_STATE, INPUT_GET_SEEKPOINTS, INPUT_GET_SPU_DELAY, INPUT_GET_STATE, INPUT_GET_TIME, INPUT_GET_TITLE_INFO, INPUT_GET_VOUTS, input_GetVout(), input_item_AddInfo(), input_item_DelInfo(), input_item_MergeInfos(), input_item_ReplaceInfos(), input_item_slave_New(), INPUT_MERGE_INFOS, INPUT_MODIFY_PCR_SYSTEM, INPUT_NAV_ACTIVATE, INPUT_NAV_DOWN, INPUT_NAV_LEFT, INPUT_NAV_MENU, INPUT_NAV_POPUP, INPUT_NAV_RIGHT, INPUT_NAV_UP, input_priv(), INPUT_RATE_DEFAULT, INPUT_REPLACE_INFOS, input_resource_HoldAout(), input_resource_HoldVouts(), INPUT_RESTART_ES, input_SendEventMetaInfo(), INPUT_SET_AUDIO_DELAY, INPUT_SET_BOOKMARK, INPUT_SET_INITIAL_VIEWPOINT, INPUT_SET_POSITION, INPUT_SET_RATE, INPUT_SET_RECORD_STATE, INPUT_SET_RENDERER, INPUT_SET_SPU_DELAY, INPUT_SET_STATE, INPUT_SET_TIME, INPUT_UPDATE_VIEWPOINT, input_item_t::lock, msg_Err, vlc_value_t::p_address, input_thread_private_t::p_es_out_display, input_thread_private_t::p_item, input_thread_private_t::p_resource, input_thread_private_t::pp_bookmark, seekpoint_t::psz_name, input_attachment_t::psz_name, psz_name, psz_value, input_title_t::seekpoint, SLAVE_PRIORITY_USER, SLAVE_TYPE_AUDIO, SLAVE_TYPE_SPU, subtitles_Filter(), TAB_APPEND, TAB_CLEAN, TAB_REMOVE, input_thread_private_t::title, unlikely, UpdateBookmarksOption(), var_GetBool, var_GetFloat, var_GetInteger, var_SetBool, var_SetFloat, var_SetInteger, vasprintf(), vlc_alloc(), VLC_EGENERIC, VLC_ENOMEM, vlc_gettext(), vlc_input_attachment_Duplicate(), vlc_input_title_Duplicate(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_object_release, vlc_renderer_item_hold(), vlc_seekpoint_Delete(), vlc_seekpoint_Duplicate(), VLC_SUCCESS, vout_OSDMessage(), and VOUT_SPU_CHANNEL_OSD.

Referenced by input_Control().