Data Structures | Defines | Typedefs | Enumerations | Functions

vlc_input.h File Reference

This file defines functions, structures and enums for input objects in vlc. More...

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

Defines

#define INPUT_UPDATE_NONE   0x0000
#define INPUT_UPDATE_SIZE   0x0001
#define INPUT_UPDATE_TITLE   0x0010
#define INPUT_UPDATE_SEEKPOINT   0x0020
#define INPUT_UPDATE_META   0x0040
#define INPUT_UPDATE_SIGNAL   0x0080
#define INPUT_RECORD_PREFIX   "vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p"
 Record prefix string.
#define INPUT_RATE_DEFAULT   1000
 Input rate.
#define INPUT_RATE_MIN   32
 Minimal rate value.
#define INPUT_RATE_MAX   32000
 Maximal rate value.
#define input_Create(a, b, c, d)   input_Create(VLC_OBJECT(a),b,c,d)
#define input_CreateAndStart(a, b, c)   input_CreateAndStart(VLC_OBJECT(a),b,c)
#define input_Read(a, b)   input_Read(VLC_OBJECT(a),b)

Typedefs

typedef struct
input_thread_private_t 
input_thread_private_t
 This defines private core storage for an input.
typedef struct input_resource_t input_resource_t
 This defines an opaque input resource handler.
typedef enum input_state_e input_state_e
 Input state.
typedef enum input_event_type_e input_event_type_e
 Input events.

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_ABORT, 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_NAME, 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_ADD_INFO, INPUT_REPLACE_INFOS, INPUT_MERGE_INFOS,
  INPUT_GET_INFO, INPUT_DEL_INFO, INPUT_SET_NAME, INPUT_GET_VIDEO_FPS,
  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_ATTACHMENTS, INPUT_GET_ATTACHMENT, INPUT_ADD_SLAVE, INPUT_ADD_SUBTITLE,
  INPUT_SET_RECORD_STATE, INPUT_GET_RECORD_STATE, INPUT_RESTART_ES, INPUT_GET_AOUT,
  INPUT_GET_VOUTS, INPUT_GET_ES_OBJECTS, INPUT_GET_PCR_SYSTEM, INPUT_MODIFY_PCR_SYSTEM
}
 

Input queries.

More...

Functions

static void vlc_audio_replay_gain_MergeFromMeta (audio_replay_gain_t *p_dst, const vlc_meta_t *p_meta)
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 input_attachment_tvlc_input_attachment_New (const char *psz_name, const char *psz_mime, const char *psz_description, const void *p_data, int i_data)
static input_attachment_tvlc_input_attachment_Duplicate (const input_attachment_t *a)
static void vlc_input_attachment_Delete (input_attachment_t *a)
input_thread_tinput_Create (vlc_object_t *p_parent, input_item_t *, const char *psz_log, input_resource_t *)
 Create a new input_thread_t.
input_thread_tinput_CreateAndStart (vlc_object_t *p_parent, input_item_t *, const char *psz_log)
 Create a new input_thread_t and start it.
int input_Start (input_thread_t *)
 Start a input_thread_t created by input_Create.
void input_Stop (input_thread_t *, bool b_abort)
 Request a running input thread to stop and die.
int input_Read (vlc_object_t *, input_item_t *)
 Initialize an input thread and run it until it stops by itself.
int input_vaControl (input_thread_t *, int i_query, va_list)
int input_Control (input_thread_t *, int i_query,...)
 Control function for inputs.
void input_Close (input_thread_t *)
 Close an input.
void input_Join (input_thread_t *)
void input_Release (input_thread_t *)
input_item_tinput_GetItem (input_thread_t *)
 Get the input item for an input thread.
static input_state_e input_GetState (input_thread_t *p_input)
 It will return the current state of the input.
static int input_AddSubtitle (input_thread_t *p_input, const char *psz_url, bool b_check_extension)
 It will add a new subtitle source to the input.
static vout_thread_tinput_GetVout (input_thread_t *p_input)
 Return one of the video output (if any).
static audio_output_tinput_GetAout (input_thread_t *p_input)
 Return the audio output (if any) associated with an input.
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.
static int input_GetPcrSystem (input_thread_t *p_input, mtime_t *pi_system, mtime_t *pi_delay)
static int input_ModifyPcrSystem (input_thread_t *p_input, bool b_absolute, mtime_t i_system)
decoder_tinput_DecoderCreate (vlc_object_t *, es_format_t *, input_resource_t *)
 Spawn a decoder thread outside of the input thread.
void input_DecoderDelete (decoder_t *)
 Kills a decoder thread and waits until it's finished.
void input_DecoderDecode (decoder_t *, block_t *, bool b_do_pace)
 Put a block_t in the decoder's fifo.
char * input_CreateFilename (vlc_object_t *, const char *psz_path, const char *psz_prefix, const char *psz_extension)
 This function creates a sane filename path.
input_resource_tinput_resource_New (vlc_object_t *)
 It creates an empty input resource handler.
void input_resource_Release (input_resource_t *)
 It releases an input resource.
void input_resource_TerminateVout (input_resource_t *)
 Forcefully destroys the video output (e.g.
void input_resource_Terminate (input_resource_t *)
 This function releases all resources (object).

Detailed Description

This file defines functions, structures and enums for input objects in vlc.


Define Documentation

#define input_Create (   a,
  b,
  c,
  d 
)    input_Create(VLC_OBJECT(a),b,c,d)
#define input_CreateAndStart (   a,
  b,
  c 
)    input_CreateAndStart(VLC_OBJECT(a),b,c)
#define INPUT_RATE_DEFAULT   1000

Input rate.

It is an float used by the variable "rate" in the range [INPUT_RATE_DEFAULT/INPUT_RATE_MAX, INPUT_RATE_DEFAULT/INPUT_RATE_MAX] the default value being 1. It represents the ratio of playback speed to nominal speed (bigger is faster).

Internally, the rate is stored as a value in the range [INPUT_RATE_MIN, INPUT_RATE_MAX]. internal rate = INPUT_RATE_DEFAULT / rate variable Default rate value

Referenced by aout_DecPlay(), aout_InputPlay(), ClockGetTsOffset(), ClockStreamToSystem(), ClockSystemToStream(), Control(), DecoderFixTs(), DecoderPlayAudio(), EsOutFrameNext(), EsOutGetBuffering(), Init(), input_SendEventRate(), input_vaControl(), inputResamplingStop(), RateCallback(), and vlm_ControlMediaInstanceGets().

#define INPUT_RATE_MAX   32000

Maximal rate value.

Referenced by Control().

#define INPUT_RATE_MIN   32

Minimal rate value.

Referenced by Control().

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

Referenced by playlist_Import(), and playlist_MLLoad().

#define INPUT_RECORD_PREFIX   "vlc-record-%Y-%m-%d-%Hh%Mm%Ss-$ N-$ p"

Record prefix string.

TODO make it configurable.

Referenced by EsOutSetRecord().

#define INPUT_UPDATE_META   0x0040
#define INPUT_UPDATE_NONE   0x0000
#define INPUT_UPDATE_SEEKPOINT   0x0020
#define INPUT_UPDATE_SIGNAL   0x0080

Referenced by UpdateGenericFromAccess().

#define INPUT_UPDATE_SIZE   0x0001
#define INPUT_UPDATE_TITLE   0x0010

Typedef Documentation

Input events.

You can catch input event by adding a callback on the variable "intf-event". This variable is an integer that will hold a input_event_type_e value.

This defines an opaque input resource handler.

Input state.

This enum is used by the variable "state"

This defines private core storage for an input.


Enumeration Type Documentation

Input events.

You can catch input event by adding a callback on the variable "intf-event". This variable is an integer that will hold a input_event_type_e value.

Enumerator:
INPUT_EVENT_STATE 
INPUT_EVENT_DEAD 
INPUT_EVENT_ABORT 
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_NAME 
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 queries.

Enumerator:
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_ADD_INFO 
INPUT_REPLACE_INFOS 
INPUT_MERGE_INFOS 
INPUT_GET_INFO 
INPUT_DEL_INFO 
INPUT_SET_NAME 
INPUT_GET_VIDEO_FPS 
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_ATTACHMENTS 
INPUT_GET_ATTACHMENT 
INPUT_ADD_SLAVE 
INPUT_ADD_SUBTITLE 
INPUT_SET_RECORD_STATE 
INPUT_GET_RECORD_STATE 
INPUT_RESTART_ES 
INPUT_GET_AOUT 
INPUT_GET_VOUTS 
INPUT_GET_ES_OBJECTS 
INPUT_GET_PCR_SYSTEM 
INPUT_MODIFY_PCR_SYSTEM 

Input state.

This enum is used by the variable "state"

Enumerator:
INIT_S 
OPENING_S 
PLAYING_S 
PAUSE_S 
END_S 
ERROR_S 

Function Documentation

static int input_AddSubtitle ( input_thread_t p_input,
const char *  psz_url,
bool  b_check_extension 
) [inline, static]

It will add a new subtitle source to the input.

Provided for convenience.

References INPUT_ADD_SUBTITLE, and input_Control().

void input_Close ( input_thread_t p_input  ) 

Close an input.

It does not call input_Stop itself.

References input_Join(), and input_Release().

Referenced by LoopInput(), and vlm_OnMediaUpdate().

int input_Control ( input_thread_t p_input,
int  i_query,
  ... 
)
input_thread_t* input_Create ( vlc_object_t p_parent,
input_item_t p_item,
const char *  psz_log,
input_resource_t p_resource 
)

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_parent a vlc_object
p_item an input item
psz_log an optional prefix for this input logs
p_resource an optional input ressource
Returns:
a pointer to the spawned input thread

References Create().

input_thread_t* input_CreateAndStart ( vlc_object_t p_parent,
input_item_t p_item,
const char *  psz_log 
)

Create a new input_thread_t and start it.

Provided for convenience.

See also:
input_Create

References input_Create, input_Start(), and vlc_object_release.

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

This function creates a sane filename path.

References asprintf(), DIR_SEP, filename_sanitize(), path_sanitize(), str_format, and vlc_opendir().

Referenced by EsOutSetRecord().

decoder_t* input_DecoderCreate ( vlc_object_t ,
es_format_t ,
input_resource_t  
)

Spawn a decoder thread outside of the input thread.

References decoder_New().

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

Put a block_t in the decoder's fifo.

Thread-safe w.r.t. the decoder. May be a cancellation point.

Parameters:
p_dec the decoder object
p_block the data block

References decoder_owner_sys_t::b_buffering, block_FifoEmpty(), block_FifoPace(), block_FifoPut(), block_FifoSize(), msg_Warn, decoder_owner_sys_t::p_fifo, and decoder_t::p_owner.

Referenced by DecoderFlush(), EsOutControlLocked(), and EsOutSend().

void input_DecoderDelete ( decoder_t p_dec  ) 
static audio_output_t* input_GetAout ( input_thread_t p_input  )  [inline, static]

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

Parameters:
p_input an 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.

Referenced by findAout().

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 
) [inline, static]

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.

References input_Control(), and INPUT_GET_ES_OBJECTS.

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_thread_t::p, and input_thread_private_t::p_item.

Referenced by DisplayVoutTitle(), EsOutMeta(), EsOutUpdateInfo(), str_format_meta(), and WaitPreparsed().

static int input_GetPcrSystem ( input_thread_t p_input,
mtime_t pi_system,
mtime_t pi_delay 
) [inline, static]
static input_state_e input_GetState ( input_thread_t p_input  )  [inline, static]

It will return the current state of the input.

Provided for convenience.

References input_Control(), and INPUT_GET_STATE.

static vout_thread_t* input_GetVout ( input_thread_t p_input  )  [inline, static]

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_input an 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(), INPUT_GET_VOUTS, and vlc_object_release.

void input_Join ( input_thread_t  ) 
static int input_ModifyPcrSystem ( input_thread_t p_input,
bool  b_absolute,
mtime_t  i_system 
) [inline, static]
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_parent a vlc_object
p_item an input item
Returns:
an error code, VLC_SUCCESS on success

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

void input_Release ( input_thread_t  ) 
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 Destructor(), input_resource_t::lock, input_resource_t::lock_hold, input_resource_t::p_parent, vlc_gc_init, and vlc_mutex_init().

Referenced by Create(), PlayItem(), and vlm_ControlMediaInstanceStart().

void input_resource_Release ( input_resource_t  ) 

It releases an input resource.

References vlc_gc_decref.

Referenced by Destructor(), playlist_Deactivate(), and vlm_MediaInstanceDelete().

void input_resource_Terminate ( input_resource_t  ) 
void input_resource_TerminateVout ( input_resource_t  ) 

Forcefully destroys the video output (e.g.

when the playlist is stopped).

References input_resource_RequestVout().

Referenced by EsOutControlLocked(), EsOutDecodersStopBuffering(), input_resource_Terminate(), LoopRequest(), and vlm_ControlMediaInstanceStart().

int input_Start ( input_thread_t p_input  ) 
void input_Stop ( input_thread_t p_input,
bool  b_abort 
)

Request a running input thread to stop and die.

b_abort must be true when a user stop is requested and not because you have detected an error or an eof. It will be used to properly send the INPUT_EVENT_ABORT event.

Parameters:
p_input the input thread to stop
b_abort true if the input has been aborted by a user request

References input_thread_private_t::b_abort, INPUT_CONTROL_SET_DIE, input_ControlPush(), input_thread_private_t::lock_control, ObjectKillChildrens(), input_thread_t::p, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_OBJECT.

Referenced by GoAndPreparse(), LoopInput(), vlm_ControlMediaInstanceStart(), vlm_MediaInstanceDelete(), and vlm_OnMediaUpdate().

int input_vaControl ( input_thread_t ,
int  i_query,
va_list   
)

References _, asprintf(), input_thread_private_t::attachment, input_thread_t::b_preparsing, input_thread_private_t::bookmark, es_out_Control(), es_out_ControlGetPcrSystem(), es_out_ControlModifyPcrSystem(), ES_OUT_GET_ES_OBJECTS_BY_ID, input_thread_private_t::f_fps, input_thread_private_t::i_attachment, input_thread_private_t::i_bookmark, vlc_value_t::i_int, input_thread_private_t::i_title, INPUT_ADD_BOOKMARK, INPUT_ADD_INFO, INPUT_ADD_SLAVE, INPUT_ADD_SUBTITLE, INPUT_CHANGE_BOOKMARK, INPUT_CLEAR_BOOKMARKS, INPUT_CONTROL_ADD_SLAVE, INPUT_CONTROL_ADD_SUBTITLE, INPUT_CONTROL_RESTART_ES, INPUT_CONTROL_SET_BOOKMARK, 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_INFO, INPUT_GET_LENGTH, INPUT_GET_PCR_SYSTEM, INPUT_GET_POSITION, INPUT_GET_RATE, INPUT_GET_RECORD_STATE, INPUT_GET_SPU_DELAY, INPUT_GET_STATE, INPUT_GET_TIME, INPUT_GET_TITLE_INFO, INPUT_GET_VIDEO_FPS, INPUT_GET_VOUTS, input_item_AddInfo(), input_item_DelInfo(), input_item_GetInfo(), input_item_MergeInfos(), input_item_ReplaceInfos(), input_item_SetName(), INPUT_MERGE_INFOS, INPUT_MODIFY_PCR_SYSTEM, INPUT_RATE_DEFAULT, INPUT_REPLACE_INFOS, input_resource_HoldAout(), input_resource_HoldVouts(), INPUT_RESTART_ES, input_SendEventMetaInfo(), input_SendEventMetaName(), INPUT_SET_AUDIO_DELAY, INPUT_SET_BOOKMARK, INPUT_SET_NAME, INPUT_SET_POSITION, INPUT_SET_RATE, INPUT_SET_RECORD_STATE, INPUT_SET_SPU_DELAY, INPUT_SET_STATE, INPUT_SET_TIME, input_item_t::lock, msg_Err, input_thread_t::p, 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, input_attachment_t::psz_name, seekpoint_t::psz_name, psz_name, vlc_value_t::psz_string, psz_value, strdup(), subtitles_Filter(), TAB_APPEND, TAB_REMOVE, input_thread_private_t::title, UpdateBookmarksOption(), var_GetBool, var_GetFloat, var_GetInteger, var_GetTime, var_SetBool, var_SetFloat, var_SetInteger, var_SetTime, vasprintf(), VLC_EGENERIC, vlc_input_attachment_Duplicate(), vlc_input_title_Duplicate(), vlc_mutex_lock(), vlc_mutex_unlock(), vlc_seekpoint_Delete(), and vlc_seekpoint_Duplicate().

Referenced by input_Control().

static void vlc_audio_replay_gain_MergeFromMeta ( audio_replay_gain_t p_dst,
const vlc_meta_t p_meta 
) [inline, static]
static void vlc_input_attachment_Delete ( input_attachment_t a  )  [inline, static]
static input_attachment_t* vlc_input_attachment_Duplicate ( const input_attachment_t a  )  [inline, static]
static input_attachment_t* vlc_input_attachment_New ( const char *  psz_name,
const char *  psz_mime,
const char *  psz_description,
const void *  p_data,
int  i_data 
) [inline, static]
static void vlc_input_title_Delete ( input_title_t t  )  [inline, static]
static input_title_t* vlc_input_title_Duplicate ( const input_title_t t  )  [inline, static]
static input_title_t* vlc_input_title_New ( void   )  [inline, static]
static void vlc_seekpoint_Delete ( seekpoint_t point  )  [inline, static]

References seekpoint_t::psz_name.

Referenced by Create(), and input_vaControl().

static seekpoint_t* vlc_seekpoint_Duplicate ( const seekpoint_t src  )  [inline, static]
static seekpoint_t* vlc_seekpoint_New ( void   )  [inline, static]
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines