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


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


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.
static int ControlPop (input_thread_t *, int *, input_control_param_t *, vlc_tick_t i_deadline, bool b_postpone_seek)
static int ControlPopEarly (input_thread_t *input, int *type, input_control_param_t *param)
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.
void input_Stop (input_thread_t *p_input)
 Request a running input thread to stop and die.
void input_Close (input_thread_t *p_input)
 Close an input.
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.
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.
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.
static int MainLoopTryRepeat (input_thread_t *p_input)
static vlc_tick_t InputSourceGetLength (input_source_t *source, input_item_t *item)
static void InputSourceStatistics (input_source_t *source, input_item_t *item, struct vlc_input_es_out *out)
static void MainLoopStatistics (input_thread_t *p_input)
 Update timing infos and statistics.
static int InitSout (input_thread_t *p_input)
static void InitProperties (input_thread_t *input)
static void InitTitle (input_thread_t *p_input, bool had_titles)
static void FillFileStatsIfAny (input_thread_t *p_input)
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 bool ControlTypeIsEarly (int type)
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)
static void ControlUpdateRenderer (input_thread_t *p_input, bool b_enable)
static void ControlInsertDemuxFilter (input_thread_t *p_input, const char *psz_demux_chain)
void input_SetProgramId (input_thread_t *input, int group_id)
 Set the program id.
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.
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.
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 *)
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


#define SLAVE_ADD_CANFAIL   (1<<1)


#define SLAVE_ADD_FORCED   (1<<0)


#define SLAVE_ADD_NOFLAG   0


#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 

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, ControlInsertDemuxFilter(), ControlNav(), ControlPause(), ControlRelease(), ControlSetEsList(), ControlUnpause(), ControlUpdateRenderer(), input_control_param_t::delay, demux_Control(), demux_FilterDisable(), demux_FilterEnable(), 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_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(), InputSourceGetLength(), input_control_param_t::list, input_thread_private_t::master, msg_Dbg, msg_Err, msg_Info, msg_Warn, vlc_input_es_out::out, 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, VIDEO_ES, 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 Init(), and MainLoop().

◆ ControlGetReducedIndexLocked()

◆ ControlInsertDemuxFilter()

static void ControlInsertDemuxFilter ( input_thread_t p_input,
const char *  psz_demux_chain 

◆ ControlIsSeekRequest()

◆ ControlNav()

◆ ControlPause()

◆ ControlPop()

◆ ControlPopEarly()

◆ ControlRelease()

◆ ControlSetEsList()

◆ ControlTypeIsEarly()

static bool ControlTypeIsEarly ( int  type)

◆ ControlUnpause()

◆ ControlUpdateRenderer()

static void ControlUpdateRenderer ( input_thread_t p_input,
bool  b_enable 

◆ DeduceSlaveType()

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

◆ Destroy()

◆ End()

◆ FillFileStatsIfAny()

◆ GetVarSlaves()

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

◆ Init()

◆ InitPrograms()

◆ InitProperties()

◆ InitSout()

◆ InitTitle()

◆ input_CanPaceControl()

◆ input_ChangeState()

static void input_ChangeState ( input_thread_t p_input,
int  i_state,
vlc_tick_t  state_date 

◆ 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.

p_parenta vlc_object
events_cbthe events virtual table
events_dataan opaque given to the events callbacks (events_cb)
p_iteman input item
typethe type of task the input is created for (thumbnailing, playback, ...)
p_resourcean optional input ressource
p_rendereran optional renderer object to render the input to
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_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_FROM_MS, vlc_viewpoint_init(), and input_thread_private_t::wait_control.

◆ 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(), EsOutMeta(), EsOutSetRecord(), input_item_parser_InputEvent(), input_thread_Events(), stream_AccessNew(), vlc_player_destructor_Thread(), 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.

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.
VLC_SUCCESS when the delay has been applied, or signal an error otherwise.
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, INPUT_CONTROL_SET_CATEGORY_DELAY, and input_ControlPush().

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, INPUT_CONTROL_SET_ES_CAT_IDS, input_ControlPush(), 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 INPUT_CONTROL_SET_PROGRAM, and input_ControlPushHelper().

Referenced by vlc_player_SelectProgram().

◆ input_SetTime()

◆ input_SlaveSourceAdd()

◆ input_SplitMRL()

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

References p.

Referenced by InputSourceInit().

◆ 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.

p_inputthe input thread to start

References input_priv(), INPUT_TYPE_PREPARSING, input_thread_private_t::is_running, msg_Err, Preparse(), Run(), input_thread_private_t::thread, input_thread_private_t::type, vlc_clone(), VLC_EGENERIC, and VLC_SUCCESS.

Referenced by input_item_Parse(), RunnableRun(), and vlc_player_input_Start().

◆ input_Stop()

◆ input_Stopped()

◆ input_SubtitleFile2Uri()

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

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 

◆ 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 

◆ InputMetaUser()

◆ InputSourceDestroy()

◆ InputSourceGetLength()

static vlc_tick_t InputSourceGetLength ( input_source_t source,
input_item_t item 

◆ 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 

◆ InputSourceMeta()

◆ InputSourceNew()

◆ InputSourceStatistics()

◆ 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 

References MRLSeekPoint(), and p.

Referenced by InputDemuxNew(), and InputStreamHandleAnchor().

◆ MRLSeekPoint()

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

Referenced by MRLSections().

◆ Preparse()

◆ RequestSubRate()

static void RequestSubRate ( input_thread_t p_input,
float  f_slave_fps 

◆ Run()

◆ SetSubtitlesOptions()

static void SetSubtitlesOptions ( input_thread_t p_input)

◆ SlaveCompare()

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

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 

Referenced by LoadSlaves().

◆ SlaveSeek()

◆ StartTitle()

◆ UpdateGenericFromDemux()

◆ UpdatePtsDelay()

◆ UpdateTitleListfromDemux()

◆ UpdateTitleSeekpoint()

◆ UpdateTitleSeekpointFromDemux()

◆ ViewpointApply()