VLC 4.0.0-dev
input.c File Reference
Include dependency graph for input.c:

Macros

#define SLAVE_ADD_NOFLAG   0
 
#define SLAVE_ADD_FORCED   (1<<0)
 
#define SLAVE_ADD_CANFAIL   (1<<1)
 
#define SLAVE_ADD_SET_TIME   (1<<2)
 

Functions

static void * Run (void *)
 
static void * Preparse (void *)
 
static void Destroy (input_thread_t *p_input)
 
static int Init (input_thread_t *p_input)
 
static void End (input_thread_t *p_input)
 
static void MainLoop (input_thread_t *p_input, bool b_interactive)
 MainLoop The main input loop. More...
 
static int ControlPop (input_thread_t *, int *, input_control_param_t *, vlc_tick_t i_deadline, bool b_postpone_seek)
 
static void ControlRelease (int i_type, const input_control_param_t *p_param)
 
static bool ControlIsSeekRequest (int i_type)
 
static bool Control (input_thread_t *, int, input_control_param_t)
 
static void ControlPause (input_thread_t *, vlc_tick_t)
 
static int UpdateTitleSeekpointFromDemux (input_thread_t *)
 
static void UpdateGenericFromDemux (input_thread_t *)
 
static void UpdateTitleListfromDemux (input_thread_t *)
 
static void MRLSections (const char *, int *, int *, int *, int *)
 
static input_source_tInputSourceNew (const char *psz_mrl)
 
static int InputSourceInit (input_source_t *in, input_thread_t *p_input, const char *psz_mrl, const char *psz_forced_demux, bool b_in_can_fail)
 
static void InputSourceDestroy (input_source_t *)
 
static void InputSourceMeta (input_thread_t *, input_source_t *, vlc_meta_t *)
 
static void SlaveDemux (input_thread_t *p_input)
 
static void SlaveSeek (input_thread_t *p_input)
 
static void InputMetaUser (input_thread_t *p_input, vlc_meta_t *p_meta)
 
static void InputUpdateMeta (input_thread_t *p_input, demux_t *p_demux)
 
static void InputGetExtraFiles (input_thread_t *p_input, int *pi_list, char ***pppsz_list, const char **psz_access, const char *mrl)
 
static void AppendAttachment (input_thread_t *p_input, int i_new, input_attachment_t **pp_new)
 
static int input_SlaveSourceAdd (input_thread_t *, enum slave_type, const char *, unsigned)
 
static char * input_SubtitleFile2Uri (input_thread_t *, const char *)
 
static void input_ChangeState (input_thread_t *p_input, int i_state, vlc_tick_t)
 
int input_Start (input_thread_t *p_input)
 Start a input_thread_t created by input_Create. More...
 
void input_Stop (input_thread_t *p_input)
 Request a running input thread to stop and die. More...
 
void input_Close (input_thread_t *p_input)
 Close an input. More...
 
void input_SetTime (input_thread_t *p_input, vlc_tick_t i_time, bool b_fast)
 
void input_SetPosition (input_thread_t *p_input, double f_position, bool b_fast)
 
input_item_tinput_GetItem (input_thread_t *p_input)
 Get the item from an input thread FIXME it does not increase ref count of the item. More...
 
input_thread_tinput_Create (vlc_object_t *p_parent, input_thread_events_cb events_cb, void *events_data, input_item_t *p_item, enum input_type type, input_resource_t *p_resource, vlc_renderer_item_t *p_renderer)
 Create a new input_thread_t. More...
 
bool input_Stopped (input_thread_t *input)
 
static void MainLoopDemux (input_thread_t *p_input, bool *pb_changed)
 MainLoopDemux It asks the demuxer to demux some data. More...
 
static int MainLoopTryRepeat (input_thread_t *p_input)
 
static void MainLoopStatistics (input_thread_t *p_input)
 Update timing infos and statistics. More...
 
static void InitProperties (input_thread_t *input)
 
static void InitTitle (input_thread_t *p_input, bool had_titles)
 
static void StartTitle (input_thread_t *p_input)
 
static int SlaveCompare (const void *a, const void *b)
 
static bool SlaveExists (input_item_slave_t **pp_slaves, int i_slaves, const char *psz_uri)
 
static void RequestSubRate (input_thread_t *p_input, float f_slave_fps)
 
static void SetSubtitlesOptions (input_thread_t *p_input)
 
static enum slave_type DeduceSlaveType (input_thread_t *p_input, const char *psz_uri)
 
static void GetVarSlaves (input_thread_t *p_input, input_item_slave_t ***ppp_slaves, int *p_slaves)
 
static void LoadSlaves (input_thread_t *p_input)
 
static void UpdatePtsDelay (input_thread_t *p_input)
 
static void InitPrograms (input_thread_t *p_input)
 
static size_t ControlGetReducedIndexLocked (input_thread_t *p_input, input_control_t *c)
 
int input_ControlPush (input_thread_t *p_input, int i_type, const input_control_param_t *p_param)
 
static void ControlUnpause (input_thread_t *p_input, vlc_tick_t i_control_date)
 
static void ViewpointApply (input_thread_t *p_input)
 
static void ControlNav (input_thread_t *p_input, int i_type)
 
void input_SetProgramId (input_thread_t *input, int group_id)
 Set the program id. More...
 
int input_SetEsCatDelay (input_thread_t *input, enum es_format_category_e cat, vlc_tick_t delay)
 Set the default delay applied to the given category. More...
 
void input_SetEsCatIds (input_thread_t *input, enum es_format_category_e cat, const char *str_ids)
 Set the list of string ids to enable for a category. More...
 
static void ControlSetEsList (input_thread_t *input, enum es_format_category_e cat, vlc_es_id_t **ids)
 
static int UpdateTitleSeekpoint (input_thread_t *p_input, int i_title, int i_seekpoint)
 
static int InputStreamHandleAnchor (input_thread_t *p_input, input_source_t *source, stream_t **stream, char const *anchor)
 
static demux_tInputDemuxNew (input_thread_t *p_input, es_out_t *p_es_out, input_source_t *p_source, const char *url, const char *psz_demux, const char *psz_anchor)
 
static void input_SplitMRL (const char **, const char **, const char **, const char **, char *)
 
input_source_tinput_source_Hold (input_source_t *in)
 Hold the input_source_t. More...
 
void input_source_Release (input_source_t *in)
 Release the input_source_t. More...
 
const char * input_source_GetStrId (input_source_t *in)
 Returns the string identifying this input source. More...
 
int input_source_GetNewAutoId (input_source_t *in)
 Get a new fmt.i_id from the input source. More...
 
bool input_source_IsAutoSelected (input_source_t *in)
 Returns true if a given source should be auto-selected. More...
 
static void InputGetExtraFilesPattern (input_thread_t *p_input, int *pi_list, char ***pppsz_list, const char *uri, const char *psz_match, const char *psz_format, int i_start, int i_stop)
 
static const char * MRLSeekPoint (const char *str, int *title, int *chapter)
 
int input_GetAttachments (input_thread_t *input, input_attachment_t ***attachments)
 
input_attachment_tinput_GetAttachment (input_thread_t *input, const char *name)
 
bool input_CanPaceControl (input_thread_t *input)
 

Macro Definition Documentation

◆ SLAVE_ADD_CANFAIL

#define SLAVE_ADD_CANFAIL   (1<<1)

◆ SLAVE_ADD_FORCED

#define SLAVE_ADD_FORCED   (1<<0)

◆ SLAVE_ADD_NOFLAG

#define SLAVE_ADD_NOFLAG   0

◆ SLAVE_ADD_SET_TIME

#define SLAVE_ADD_SET_TIME   (1<<2)

Function Documentation

◆ AppendAttachment()

◆ Control()

static bool Control ( input_thread_t p_input,
int  i_type,
input_control_param_t  param 
)
static

References AUDIO_ES, input_source_t::b_can_pace_control, input_source_t::b_can_rate_control, input_source_t::b_can_stream_record, input_source_t::b_eof, input_control_param_t::b_fast_seek, input_item_slave::b_forced, input_thread_private_t::b_out_pace_control, input_thread_private_t::b_recording, input_source_t::b_rescale_ts, input_control_param_t::cat, input_control_param_t::cat_delay, input_control_param_t::cat_ids, ControlNav(), ControlPause(), ControlRelease(), ControlSetEsList(), ControlUnpause(), input_control_param_t::delay, demux_Control(), demux_FilterDisable(), demux_FilterEnable(), DEMUX_GET_LENGTH, demux_GetSeekpoint(), demux_GetTitle(), DEMUX_SET_ES, DEMUX_SET_GROUP_DEFAULT, DEMUX_SET_GROUP_LIST, DEMUX_SET_RATE, DEMUX_SET_RECORD_STATE, DEMUX_SET_SEEKPOINT, DEMUX_SET_TITLE, demux_SetPosition(), demux_SetTime(), input_control_param_t::dir_path, input_control_param_t::enabled, input_control_param_t::es_delay, es_out_Control(), ES_OUT_RESET_PCR, es_out_RestartEs(), ES_OUT_SET_GROUP, es_out_SetDelay(), es_out_SetEs(), es_out_SetEsCatIds(), es_out_SetEsDelay(), es_out_SetFrameNext(), es_out_SetRate(), es_out_SetRecordState(), es_out_SetVbiPage(), es_out_SetVbiTransparency(), es_out_StartAllEs(), es_out_StopAllEs(), es_out_UnsetEs(), vlc_value_t::f_float, input_control_param_t::f_val, vlc_viewpoint_t::fov, vlc_value_t::i_int, input_title_t::i_seekpoint, input_thread_private_t::i_slave, input_thread_private_t::i_state, seekpoint_t::i_time_offset, input_source_t::i_title, input_item_slave::i_type, i_type, input_control_param_t::i_val, input_control_param_t::id, input_control_param_t::ids, INPUT_CONTROL_ADD_SLAVE, INPUT_CONTROL_JUMP_POSITION, INPUT_CONTROL_JUMP_TIME, INPUT_CONTROL_NAV_ACTIVATE, INPUT_CONTROL_NAV_DOWN, INPUT_CONTROL_NAV_LEFT, INPUT_CONTROL_NAV_MENU, INPUT_CONTROL_NAV_POPUP, INPUT_CONTROL_NAV_RIGHT, INPUT_CONTROL_NAV_UP, INPUT_CONTROL_RESTART_ES, INPUT_CONTROL_SET_CATEGORY_DELAY, INPUT_CONTROL_SET_ES, INPUT_CONTROL_SET_ES_CAT_IDS, INPUT_CONTROL_SET_ES_DELAY, INPUT_CONTROL_SET_ES_LIST, INPUT_CONTROL_SET_FRAME_NEXT, INPUT_CONTROL_SET_INITIAL_VIEWPOINT, INPUT_CONTROL_SET_POSITION, INPUT_CONTROL_SET_PROGRAM, INPUT_CONTROL_SET_RATE, INPUT_CONTROL_SET_RECORD_STATE, INPUT_CONTROL_SET_RENDERER, INPUT_CONTROL_SET_SEEKPOINT, INPUT_CONTROL_SET_SEEKPOINT_NEXT, INPUT_CONTROL_SET_SEEKPOINT_PREV, INPUT_CONTROL_SET_STATE, INPUT_CONTROL_SET_SUBS_FPS, INPUT_CONTROL_SET_TIME, INPUT_CONTROL_SET_TITLE, INPUT_CONTROL_SET_TITLE_NEXT, INPUT_CONTROL_SET_TITLE_PREV, INPUT_CONTROL_SET_VBI_PAGE, INPUT_CONTROL_SET_VBI_TRANSPARENCY, INPUT_CONTROL_SET_VIEWPOINT, INPUT_CONTROL_UNSET_ES, INPUT_CONTROL_UPDATE_VIEWPOINT, input_item_AddSlave(), input_priv(), INPUT_RATE_MAX, INPUT_RATE_MIN, input_SendEventRate(), input_SendEventRecord(), input_SendEventSeekpoint(), input_SendEventSubsFPS(), input_SlaveSourceAdd(), input_control_param_t::list, input_thread_private_t::master, msg_Dbg, msg_Err, msg_Info, msg_Warn, vlc_value_t::p_address, input_source_t::p_demux, input_thread_private_t::p_es_out, input_thread_private_t::p_es_out_display, input_thread_private_t::p_item, input_thread_private_t::p_renderer, input_thread_private_t::p_sout, input_control_param_t::page, PAUSE_S, vlc_viewpoint_t::pitch, PLAYING_S, input_control_param_t::pos, input_item_slave::psz_uri, input_thread_private_t::rate, input_control_param_t::record_state, RequestSubRate(), vlc_viewpoint_t::roll, input_title_t::seekpoint, SLAVE_ADD_CANFAIL, SLAVE_ADD_FORCED, SLAVE_ADD_SET_TIME, SlaveSeek(), SPU_ES, input_control_param_t::str_ids, input_control_param_t::time, input_source_t::title, input_control_param_t::val, var_GetInteger(), input_control_param_t::vbi_page, input_control_param_t::vbi_transparency, input_control_param_t::viewpoint, input_thread_private_t::viewpoint, input_thread_private_t::viewpoint_changed, ViewpointApply(), vlc_es_id_GetInputId(), vlc_es_id_GetSource(), vlc_renderer_item_demux_filter(), vlc_renderer_item_hold(), vlc_renderer_item_release(), VLC_SUCCESS, VLC_TICK_FROM_SEC, vlc_tick_now(), and vlc_viewpoint_t::yaw.

Referenced by ControlNav(), and MainLoop().

◆ ControlGetReducedIndexLocked()

◆ ControlIsSeekRequest()

◆ ControlNav()

◆ ControlPause()

◆ ControlPop()

◆ ControlRelease()

◆ ControlSetEsList()

◆ ControlUnpause()

◆ DeduceSlaveType()

static enum slave_type DeduceSlaveType ( input_thread_t p_input,
const char *  psz_uri 
)
static

◆ Destroy()

◆ End()

◆ GetVarSlaves()

static void GetVarSlaves ( input_thread_t p_input,
input_item_slave_t ***  ppp_slaves,
int *  p_slaves 
)
static

◆ Init()

◆ InitPrograms()

◆ InitProperties()

◆ InitTitle()

◆ input_CanPaceControl()

◆ input_ChangeState()

◆ input_Close()

void input_Close ( input_thread_t p_input)

Close an input.

It does not call input_Stop itself.

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

Referenced by input_item_Parse(), input_item_parser_id_Release(), RunnableRun(), and vlc_player_input_Delete().

◆ input_ControlPush()

◆ input_Create()

input_thread_t * input_Create ( vlc_object_t p_parent,
input_thread_events_cb  events_cb,
void *  events_data,
input_item_t p_item,
enum input_type  type,
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
p_resourcean optional input ressource
Returns
a pointer to the spawned input thread

References input_thread_private_t::attachment, input_thread_private_t::b_low_delay, input_thread_private_t::b_out_pace_control, input_item_t::b_preparse_interact, input_thread_private_t::b_recording, Destroy(), input_thread_private_t::events_cb, input_thread_private_t::events_data, input_thread_private_t::i_attachment, input_thread_private_t::i_control, input_thread_private_t::i_jitter_max, input_item_t::i_preparse_depth, input_thread_private_t::i_seekpoint_offset, input_thread_private_t::i_slave, input_thread_private_t::i_start, input_thread_private_t::i_state, input_thread_private_t::i_stop, input_thread_private_t::i_title_offset, INIT_S, input_thread_private_t::input, input_ConfigVarInit(), input_EsOutNew(), input_item_ApplyOptions(), input_item_GetName(), input_item_Hold(), input_item_SetESNowPlaying(), input_item_SetNowPlaying(), input_priv(), input_resource_Hold(), input_resource_New(), input_resource_SetInput(), input_stats_Create(), INPUT_TYPE_PREPARSING, INPUT_TYPE_THUMBNAILING, InputSourceNew(), input_thread_private_t::interrupt, input_thread_private_t::is_running, input_thread_private_t::is_stopped, input_item_t::lock, input_thread_private_t::lock_control, vlc_object_t::logger, input_thread_private_t::master, msg_Dbg, vlc_object_t::no_interact, input_thread_private_t::normal_time, input_thread_t::obj, input_thread_private_t::p_es_out, input_thread_private_t::p_es_out_display, input_thread_private_t::p_item, input_thread_private_t::p_renderer, input_thread_private_t::p_resource, input_thread_private_t::p_sout, input_item_t::p_stats, psz_name, input_thread_private_t::rate, input_thread_private_t::slave, input_thread_private_t::stats, strcasecmp(), TAB_INIT, input_thread_private_t::type, unlikely, var_InheritAddress(), var_InheritBool(), var_InheritInteger(), var_InheritString(), input_thread_private_t::viewpoint, input_thread_private_t::viewpoint_changed, vlc_cond_init(), vlc_custom_create, vlc_interrupt_init(), vlc_mutex_init(), vlc_mutex_lock(), vlc_mutex_unlock(), VLC_OBJECT, vlc_renderer_item_hold(), VLC_TICK_0, VLC_TICK_FROM_MS, vlc_viewpoint_init(), and input_thread_private_t::wait_control.

Referenced by vlc_player_input_New().

◆ input_GetAttachment()

◆ input_GetAttachments()

◆ input_GetItem()

input_item_t * input_GetItem ( input_thread_t p_input)

Get the item from an input thread FIXME it does not increase ref count of the item.

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.

Referenced by access_New(), demux_NewAdvanced(), DisplayVoutTitle(), EsOutEsUpdateFmt(), EsOutMeta(), EsOutSetRecord(), input_item_parser_InputEvent(), input_thread_Events(), stream_AccessNew(), vlc_player_input_RestoreMlStates(), and vlc_player_UpdateMLStates().

◆ input_SetEsCatDelay()

int input_SetEsCatDelay ( input_thread_t input,
enum es_format_category_e  cat,
vlc_tick_t  delay 
)

Set the default delay applied to the given category.

Set the default delay for the given es_format_category_e synchronously if the input is not running yet, otherwise push a control to signal to the input which delay should be updated.

Parameters
inputAny input to change the delay for.
catThe ES category to apply the delay to.
delayThe delay to apply to the category, a positive delay shifting the track to the future.
Returns
VLC_SUCCESS when the delay has been applied, or signal an error otherwise.
Note
This function can be called before start or while running.
This function is not thread-safe, the caller should handle the locking.

References input_control_param_t::cat_delay, es_out_SetDelay(), INPUT_CONTROL_SET_CATEGORY_DELAY, input_ControlPush(), input_priv(), input_thread_private_t::is_running, input_thread_private_t::is_stopped, input_thread_private_t::p_es_out_display, and VLC_SUCCESS.

Referenced by vlc_player_input_New(), and vlc_player_SetCategoryDelay().

◆ input_SetEsCatIds()

void input_SetEsCatIds ( input_thread_t input,
enum es_format_category_e  cat,
const char *  str_ids 
)

Set the list of string ids to enable for a category.

cf. ES_OUT_SET_ES_CAT_IDS This function can be called before start or while started. This function is not thread-safe, the caller should handle the locking.

References input_control_param_t::cat_ids, es_out_SetEsCatIds(), INPUT_CONTROL_SET_ES_CAT_IDS, input_ControlPush(), input_priv(), input_thread_private_t::is_running, input_thread_private_t::is_stopped, input_thread_private_t::p_es_out_display, and strdup().

Referenced by vlc_player_input_SelectTracksByStringIds().

◆ input_SetPosition()

◆ input_SetProgramId()

void input_SetProgramId ( input_thread_t input,
int  group_id 
)

Set the program id.

cf. ES_OUT_SET_GROUP This function can be called before start or while started. This function is not thread-safe, the caller should handle the locking.

References es_out_Control(), ES_OUT_SET_GROUP, INPUT_CONTROL_SET_PROGRAM, input_ControlPushHelper(), input_priv(), input_thread_private_t::is_running, input_thread_private_t::is_stopped, and input_thread_private_t::p_es_out_display.

Referenced by vlc_player_SelectProgram().

◆ input_SetTime()

◆ input_SlaveSourceAdd()

◆ input_source_GetNewAutoId()

int input_source_GetNewAutoId ( input_source_t in)

Get a new fmt.i_id from the input source.

This auto id will be relative to this input source. It allows to have stable ids across different playback instances, by not relying on the input source addition order.

References input_source_t::auto_id.

Referenced by EsOutAddLocked().

◆ input_source_GetStrId()

const char * input_source_GetStrId ( input_source_t in)

Returns the string identifying this input source.

Returns
a string id or NULL if the source is the master

References input_source_t::str_id.

Referenced by EsOutAddLocked().

◆ input_source_Hold()

◆ input_source_IsAutoSelected()

bool input_source_IsAutoSelected ( input_source_t in)

Returns true if a given source should be auto-selected.

References input_source_t::autoselected.

Referenced by EsOutSelect().

◆ input_source_Release()

◆ input_SplitMRL()

static void input_SplitMRL ( const char **  access,
const char **  demux,
const char **  path,
const char **  anchor,
char *  buf 
)
static

References p.

Referenced by InputSourceInit().

◆ input_Start()

int input_Start ( input_thread_t p_input)

◆ input_Stop()

◆ input_Stopped()

◆ input_SubtitleFile2Uri()

static char * input_SubtitleFile2Uri ( input_thread_t p_input,
const char *  psz_subtitle 
)
static

References msg_Dbg, strdup(), vlc_path2uri(), and vlc_stat().

Referenced by LoadSlaves().

◆ InputDemuxNew()

◆ InputGetExtraFiles()

static void InputGetExtraFiles ( input_thread_t p_input,
int *  pi_list,
char ***  pppsz_list,
const char **  psz_access,
const char *  mrl 
)
static

◆ InputGetExtraFilesPattern()

static void InputGetExtraFilesPattern ( input_thread_t p_input,
int *  pi_list,
char ***  pppsz_list,
const char *  uri,
const char *  psz_match,
const char *  psz_format,
int  i_start,
int  i_stop 
)
static

◆ InputMetaUser()

◆ InputSourceDestroy()

◆ InputSourceInit()

static int InputSourceInit ( input_source_t in,
input_thread_t p_input,
const char *  psz_mrl,
const char *  psz_forced_demux,
bool  b_in_can_fail 
)
static

◆ InputSourceMeta()

◆ InputSourceNew()

◆ InputStreamHandleAnchor()

◆ InputUpdateMeta()

◆ LoadSlaves()

◆ MainLoop()

◆ MainLoopDemux()

◆ MainLoopStatistics()

◆ MainLoopTryRepeat()

◆ MRLSections()

static void MRLSections ( const char *  p,
int *  pi_title_start,
int *  pi_title_end,
int *  pi_chapter_start,
int *  pi_chapter_end 
)
static

References MRLSeekPoint(), and p.

Referenced by InputDemuxNew(), and InputStreamHandleAnchor().

◆ MRLSeekPoint()

static const char * MRLSeekPoint ( const char *  str,
int *  title,
int *  chapter 
)
static

Referenced by MRLSections().

◆ Preparse()

◆ RequestSubRate()

static void RequestSubRate ( input_thread_t p_input,
float  f_slave_fps 
)
static

◆ Run()

◆ SetSubtitlesOptions()

static void SetSubtitlesOptions ( input_thread_t p_input)
static

◆ SlaveCompare()

static int SlaveCompare ( const void *  a,
const void *  b 
)
static

References input_item_slave::i_priority.

Referenced by LoadSlaves().

◆ SlaveDemux()

◆ SlaveExists()

static bool SlaveExists ( input_item_slave_t **  pp_slaves,
int  i_slaves,
const char *  psz_uri 
)
static

Referenced by LoadSlaves().

◆ SlaveSeek()

◆ StartTitle()

◆ UpdateGenericFromDemux()

◆ UpdatePtsDelay()

◆ UpdateTitleListfromDemux()

◆ UpdateTitleSeekpoint()

◆ UpdateTitleSeekpointFromDemux()

◆ ViewpointApply()