VLC  4.0.0-dev
Data Structures | Functions
item.c File Reference
Include dependency graph for item.c:

Data Structures

struct  input_item_opaque
 
struct  item_type_entry
 
struct  input_item_parser_id_t
 
struct  rdh_slave
 
struct  rdh_dir
 

Functions

static enum input_item_type_e GuessType (const input_item_t *p_item, bool *p_net)
 
void input_item_SetErrorWhenReading (input_item_t *p_i, bool b_error)
 
void input_item_SetPreparsed (input_item_t *p_i, bool b_preparsed)
 
void input_item_SetArtNotFound (input_item_t *p_i, bool b_not_found)
 
void input_item_SetArtFetched (input_item_t *p_i, bool b_art_fetched)
 
void input_item_SetMeta (input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz_val)
 
void input_item_CopyOptions (input_item_t *p_child, input_item_t *p_parent)
 
bool input_item_HasErrorWhenReading (input_item_t *p_item)
 
bool input_item_MetaMatch (input_item_t *p_i, vlc_meta_type_t meta_type, const char *psz)
 
const char * input_item_GetMetaLocked (input_item_t *item, vlc_meta_type_t meta_type)
 
char * input_item_GetMeta (input_item_t *p_i, vlc_meta_type_t meta_type)
 
char * input_item_GetTitleFbName (input_item_t *p_item)
 
char * input_item_GetName (input_item_t *p_item)
 
void input_item_SetName (input_item_t *p_item, const char *psz_name)
 
char * input_item_GetURI (input_item_t *p_i)
 
void input_item_SetURI (input_item_t *p_i, const char *psz_uri)
 
vlc_tick_t input_item_GetDuration (input_item_t *p_i)
 
void input_item_SetDuration (input_item_t *p_i, vlc_tick_t i_duration)
 
char * input_item_GetNowPlayingFb (input_item_t *p_item)
 
bool input_item_IsPreparsed (input_item_t *p_item)
 
bool input_item_IsArtFetched (input_item_t *p_item)
 
bool input_item_ShouldPreparseSubItems (input_item_t *p_item)
 
input_item_tinput_item_Hold (input_item_t *p_item)
 Holds an input item, i.e. More...
 
void input_item_Release (input_item_t *p_item)
 Releases an input item, i.e. More...
 
int input_item_AddOption (input_item_t *p_input, const char *psz_option, unsigned flags)
 This function allows to add an option to an existing input_item_t. More...
 
int input_item_AddOptions (input_item_t *p_item, int i_options, const char *const *ppsz_options, unsigned i_flags)
 This function add several options to an existing input_item_t. More...
 
int input_item_AddOpaque (input_item_t *item, const char *name, void *value)
 
void input_item_ApplyOptions (vlc_object_t *obj, input_item_t *item)
 
static int bsearch_strcmp_cb (const void *a, const void *b)
 
static bool input_item_IsMaster (const char *psz_filename)
 
bool input_item_slave_GetType (const char *psz_filename, enum slave_type *p_slave_type)
 
input_item_slave_tinput_item_slave_New (const char *psz_uri, enum slave_type i_type, enum slave_priority i_priority)
 
int input_item_AddSlave (input_item_t *p_item, input_item_slave_t *p_slave)
 This function allows adding a slave to an existing input item. More...
 
static info_category_tInputItemFindCat (input_item_t *p_item, int *pi_index, const char *psz_cat)
 
char * input_item_GetInfo (input_item_t *p_i, const char *psz_cat, const char *psz_name)
 Get a info item from a given category in a given input item. More...
 
static int InputItemVaAddInfo (input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format, va_list args)
 
int input_item_AddInfo (input_item_t *p_i, const char *psz_cat, const char *psz_name, const char *psz_format,...)
 
int input_item_DelInfo (input_item_t *p_i, const char *psz_cat, const char *psz_name)
 
void input_item_ReplaceInfos (input_item_t *p_item, info_category_t *p_cat)
 
void input_item_MergeInfos (input_item_t *p_item, info_category_t *p_cat)
 
void input_item_SetEpgEvent (input_item_t *p_item, const vlc_epg_event_t *p_epg_evt)
 
void input_item_SetEpg (input_item_t *p_item, const vlc_epg_t *p_update, bool b_current_source)
 
void input_item_ChangeEPGSource (input_item_t *p_item, int i_source_id)
 
void input_item_SetEpgTime (input_item_t *p_item, int64_t i_time)
 
void input_item_SetEpgOffline (input_item_t *p_item)
 
input_item_tinput_item_NewExt (const char *psz_uri, const char *psz_name, vlc_tick_t duration, enum input_item_type_e type, enum input_item_net_type i_net)
 This function creates a new input_item_t with the provided information. More...
 
input_item_tinput_item_Copy (input_item_t *p_input)
 This function creates a new input_item_t as a copy of another. More...
 
static int typecmp (const void *key, const void *entry)
 
input_item_node_tinput_item_node_Create (input_item_t *p_input)
 Start adding multiple subitems. More...
 
void input_item_node_Delete (input_item_node_t *p_node)
 Delete a node created with input_item_node_Create() and all its children. More...
 
input_item_node_tinput_item_node_AppendItem (input_item_node_t *p_node, input_item_t *p_item)
 Add a new child node to this parent node that will point to this subitem. More...
 
void input_item_node_AppendNode (input_item_node_t *p_parent, input_item_node_t *p_child)
 Add an already created node to children of this parent node. More...
 
void input_item_node_RemoveNode (input_item_node_t *parent, input_item_node_t *child)
 Remove a node from its parent. More...
 
void input_item_UpdateTracksInfo (input_item_t *item, const es_format_t *fmt)
 
char * input_item_CreateFilename (input_item_t *item, const char *dir, const char *filenamefmt, const char *ext)
 This function creates a sane filename path. More...
 
static void input_item_parser_InputEvent (input_thread_t *input, const struct vlc_input_event *event, void *parser_)
 
input_item_parser_id_tinput_item_Parse (input_item_t *item, vlc_object_t *obj, const input_item_parser_cbs_t *cbs, void *userdata)
 Parse an item asynchronously. More...
 
void input_item_parser_id_Interrupt (input_item_parser_id_t *parser)
 Interrupts & cancels the parsing. More...
 
void input_item_parser_id_Release (input_item_parser_id_t *parser)
 Release (and interrupt if needed) a parser. More...
 
static int rdh_compar_type (input_item_t *p1, input_item_t *p2)
 
static int rdh_compar_filename (const void *a, const void *b)
 
static void rdh_sort (input_item_node_t *p_node)
 
static bool rdh_file_has_ext (const char *psz_filename, const char *psz_ignored_exts)
 Does the provided file name has one of the extension provided ? More...
 
static bool rdh_file_is_ignored (struct vlc_readdir_helper *p_rdh, const char *psz_filename)
 
static char * rdh_name_from_filename (const char *psz_filename)
 
static uint8_t rdh_get_slave_priority (input_item_t *p_item, input_item_slave_t *p_slave, const char *psz_slave_filename)
 
static int rdh_should_match_idx (struct vlc_readdir_helper *p_rdh, struct rdh_slave *p_rdh_sub)
 
static void rdh_attach_slaves (struct vlc_readdir_helper *p_rdh, input_item_node_t *p_parent_node)
 
static int rdh_unflatten (struct vlc_readdir_helper *p_rdh, input_item_node_t **pp_node, const char *psz_path, int i_net)
 
void vlc_readdir_helper_init (struct vlc_readdir_helper *p_rdh, vlc_object_t *p_obj, input_item_node_t *p_node)
 Init a vlc_readdir_helper struct. More...
 
void vlc_readdir_helper_finish (struct vlc_readdir_helper *p_rdh, bool b_success)
 Finish adding items to the node. More...
 
int vlc_readdir_helper_additem (struct vlc_readdir_helper *p_rdh, const char *psz_uri, const char *psz_flatpath, const char *psz_filename, int i_type, int i_net)
 Add a new input_item_t entry to the node of the vlc_readdir_helper struct. More...
 

Function Documentation

◆ bsearch_strcmp_cb()

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

◆ GuessType()

static enum input_item_type_e GuessType ( const input_item_t p_item,
bool *  p_net 
)
static

◆ input_item_AddInfo()

int input_item_AddInfo ( input_item_t p_i,
const char *  psz_cat,
const char *  psz_name,
const char *  psz_format,
  ... 
)

◆ input_item_AddOpaque()

int input_item_AddOpaque ( input_item_t item,
const char *  name,
void *  value 
)

◆ input_item_AddOption()

int input_item_AddOption ( input_item_t p_input,
const char *  psz_option,
unsigned  flags 
)

◆ input_item_AddOptions()

int input_item_AddOptions ( input_item_t p_item,
int  i_options,
const char *const *  ppsz_options,
unsigned  i_flags 
)

This function add several options to an existing input_item_t.

References input_item_AddOption(), and VLC_SUCCESS.

Referenced by add_to_playlist(), and intf_InsertItem().

◆ input_item_AddSlave()

int input_item_AddSlave ( input_item_t ,
input_item_slave_t  
)

This function allows adding a slave to an existing input item.

The slave is owned by the input item after this call.

References input_item_slave::i_priority, input_item_t::i_slaves, input_item_t::lock, input_item_t::pp_slaves, SLAVE_PRIORITY_MATCH_NONE, TAB_APPEND, VLC_EGENERIC, vlc_mutex_lock(), vlc_mutex_unlock(), and VLC_SUCCESS.

Referenced by Control(), LoadSlaves(), and rdh_attach_slaves().

◆ input_item_ApplyOptions()

void input_item_ApplyOptions ( vlc_object_t obj,
input_item_t item 
)

◆ input_item_ChangeEPGSource()

void input_item_ChangeEPGSource ( input_item_t p_item,
int  i_source_id 
)

◆ input_item_Copy()

input_item_t* input_item_Copy ( input_item_t p_input)

◆ input_item_CopyOptions()

void input_item_CopyOptions ( input_item_t p_child,
input_item_t p_parent 
)

◆ input_item_CreateFilename()

char* input_item_CreateFilename ( input_item_t item,
const char *  dir,
const char *  filenamefmt,
const char *  ext 
)

This function creates a sane filename path.

References asprintf(), DIR_SEP, filename_sanitize(), str_format(), and unlikely.

Referenced by EsOutSetRecord().

◆ input_item_DelInfo()

int input_item_DelInfo ( input_item_t p_i,
const char *  psz_cat,
const char *  psz_name 
)

◆ input_item_GetDuration()

vlc_tick_t input_item_GetDuration ( input_item_t p_i)

◆ input_item_GetInfo()

char* input_item_GetInfo ( input_item_t p_i,
const char *  psz_cat,
const char *  psz_name 
)

Get a info item from a given category in a given input item.

Parameters
p_iThe input item to get info from
psz_catString representing the category for the info
psz_nameString representing the name of the desired info
Returns
A pointer to the string with the given info if found, or an empty string otherwise. The caller should free the returned pointer.

References info_category_FindInfo(), InputItemFindCat(), input_item_t::lock, psz_name, info_t::psz_value, strdup(), vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by input_FindArtInCacheUsingItemUID(), and input_SaveArt().

◆ input_item_GetMeta()

char* input_item_GetMeta ( input_item_t p_i,
vlc_meta_type_t  meta_type 
)

◆ input_item_GetMetaLocked()

const char* input_item_GetMetaLocked ( input_item_t item,
vlc_meta_type_t  meta_type 
)

◆ input_item_GetName()

char* input_item_GetName ( input_item_t p_item)

◆ input_item_GetNowPlayingFb()

char* input_item_GetNowPlayingFb ( input_item_t p_item)

◆ input_item_GetTitleFbName()

char* input_item_GetTitleFbName ( input_item_t p_item)

◆ input_item_GetURI()

char* input_item_GetURI ( input_item_t p_i)

◆ input_item_HasErrorWhenReading()

bool input_item_HasErrorWhenReading ( input_item_t p_item)

◆ input_item_Hold()

input_item_t* input_item_Hold ( input_item_t )

◆ input_item_IsArtFetched()

bool input_item_IsArtFetched ( input_item_t p_item)

◆ input_item_IsMaster()

static bool input_item_IsMaster ( const char *  psz_filename)
static

◆ input_item_IsPreparsed()

bool input_item_IsPreparsed ( input_item_t p_item)

◆ input_item_MergeInfos()

void input_item_MergeInfos ( input_item_t p_item,
info_category_t p_cat 
)

◆ input_item_MetaMatch()

bool input_item_MetaMatch ( input_item_t p_i,
vlc_meta_type_t  meta_type,
const char *  psz 
)

◆ input_item_NewExt()

input_item_t* input_item_NewExt ( const char *  psz_uri,
const char *  psz_name,
vlc_tick_t  i_duration,
enum input_item_type_e  i_type,
enum input_item_net_type  i_net 
)

◆ input_item_node_AppendItem()

input_item_node_t* input_item_node_AppendItem ( input_item_node_t p_node,
input_item_t p_item 
)

◆ input_item_node_AppendNode()

void input_item_node_AppendNode ( input_item_node_t p_parent,
input_item_node_t p_child 
)

Add an already created node to children of this parent node.

References input_item_node_t::i_children, input_item_node_t::pp_children, and TAB_APPEND.

Referenced by input_item_node_AppendItem(), and vlc_media_tree_AddChild().

◆ input_item_node_Create()

input_item_node_t* input_item_node_Create ( input_item_t p_input)

Start adding multiple subitems.

Create a root node to hold a tree of subitems for given item

References input_item_node_t::i_children, input_item_Hold(), input_item_node_t::p_item, and input_item_node_t::pp_children.

Referenced by demux_Demux(), input_item_node_AppendItem(), and vlc_media_tree_AddChild().

◆ input_item_node_Delete()

void input_item_node_Delete ( input_item_node_t p_node)

◆ input_item_node_RemoveNode()

void input_item_node_RemoveNode ( input_item_node_t parent,
input_item_node_t child 
)

Remove a node from its parent.

References input_item_node_t::i_children, input_item_node_t::pp_children, and TAB_REMOVE.

Referenced by rdh_attach_slaves(), and vlc_media_tree_Remove().

◆ input_item_Parse()

input_item_parser_id_t* input_item_Parse ( input_item_t item,
vlc_object_t parent,
const input_item_parser_cbs_t cbs,
void *  userdata 
)

Parse an item asynchronously.

Note
The parsing is done asynchronously. The user can call input_item_parser_id_Interrupt() before receiving the on_ended() event in order to interrupt it.
Parameters
itemthe item to parse
parentthe parent obj
cbscallbacks to be notified of the end of the parsing
userdataopaque data used by parser callbacks
Returns
a parser instance or NULL in case of error, the parser needs to be released with input_item_parser_id_Release()

References input_item_parser_id_t::cbs, INIT_S, input_item_parser_id_t::input, input_Close(), input_CreatePreparser(), input_item_parser_InputEvent(), input_Start(), input_item_parser_cbs_t::on_ended, input_item_parser_id_t::state, and input_item_parser_id_t::userdata.

Referenced by Parse().

◆ input_item_parser_id_Interrupt()

void input_item_parser_id_Interrupt ( input_item_parser_id_t parser)

Interrupts & cancels the parsing.

Note
The parser still needs to be released with input_item_parser_id_Release afterward.
Calling this function will cause the on_ended callback to be invoked.
Parameters
theparser to interrupt

References input_item_parser_id_t::input, and input_Stop().

Referenced by input_item_parser_id_Release().

◆ input_item_parser_id_Release()

void input_item_parser_id_Release ( input_item_parser_id_t parser)

Release (and interrupt if needed) a parser.

Parameters
parserthe parser returned by input_item_Parse

References input_item_parser_id_t::input, input_Close(), and input_item_parser_id_Interrupt().

Referenced by Parse().

◆ input_item_parser_InputEvent()

static void input_item_parser_InputEvent ( input_thread_t input,
const struct vlc_input_event event,
void *  parser_ 
)
static

◆ input_item_Release()

void input_item_Release ( input_item_t )

◆ input_item_ReplaceInfos()

void input_item_ReplaceInfos ( input_item_t p_item,
info_category_t p_cat 
)

◆ input_item_SetArtFetched()

void input_item_SetArtFetched ( input_item_t p_i,
bool  b_art_fetched 
)

◆ input_item_SetArtNotFound()

void input_item_SetArtNotFound ( input_item_t p_i,
bool  b_not_found 
)

◆ input_item_SetDuration()

void input_item_SetDuration ( input_item_t p_i,
vlc_tick_t  i_duration 
)

◆ input_item_SetEpg()

void input_item_SetEpg ( input_item_t p_item,
const vlc_epg_t p_update,
bool  b_current_source 
)

◆ input_item_SetEpgEvent()

void input_item_SetEpgEvent ( input_item_t p_item,
const vlc_epg_event_t p_epg_evt 
)

◆ input_item_SetEpgOffline()

void input_item_SetEpgOffline ( input_item_t p_item)

◆ input_item_SetEpgTime()

void input_item_SetEpgTime ( input_item_t p_item,
int64_t  i_time 
)

◆ input_item_SetErrorWhenReading()

void input_item_SetErrorWhenReading ( input_item_t p_i,
bool  b_error 
)

◆ input_item_SetMeta()

void input_item_SetMeta ( input_item_t p_i,
vlc_meta_type_t  meta_type,
const char *  psz_val 
)

◆ input_item_SetName()

void input_item_SetName ( input_item_t p_item,
const char *  psz_name 
)

◆ input_item_SetPreparsed()

void input_item_SetPreparsed ( input_item_t p_i,
bool  b_preparsed 
)

◆ input_item_SetURI()

void input_item_SetURI ( input_item_t p_i,
const char *  psz_uri 
)

◆ input_item_ShouldPreparseSubItems()

bool input_item_ShouldPreparseSubItems ( input_item_t p_item)

◆ input_item_slave_GetType()

bool input_item_slave_GetType ( const char *  psz_filename,
enum slave_type p_slave_type 
)

◆ input_item_slave_New()

input_item_slave_t* input_item_slave_New ( const char *  psz_uri,
enum slave_type  i_type,
enum slave_priority  i_priority 
)

◆ input_item_UpdateTracksInfo()

void input_item_UpdateTracksInfo ( input_item_t item,
const es_format_t fmt 
)

◆ InputItemFindCat()

static info_category_t* InputItemFindCat ( input_item_t p_item,
int *  pi_index,
const char *  psz_cat 
)
static

◆ InputItemVaAddInfo()

static int InputItemVaAddInfo ( input_item_t p_i,
const char *  psz_cat,
const char *  psz_name,
const char *  psz_format,
va_list  args 
)
static

◆ rdh_attach_slaves()

static void rdh_attach_slaves ( struct vlc_readdir_helper p_rdh,
input_item_node_t p_parent_node 
)
static

◆ rdh_compar_filename()

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

◆ rdh_compar_type()

static int rdh_compar_type ( input_item_t p1,
input_item_t p2 
)
static

◆ rdh_file_has_ext()

static bool rdh_file_has_ext ( const char *  psz_filename,
const char *  psz_ignored_exts 
)
static

Does the provided file name has one of the extension provided ?

Referenced by rdh_file_is_ignored().

◆ rdh_file_is_ignored()

static bool rdh_file_is_ignored ( struct vlc_readdir_helper p_rdh,
const char *  psz_filename 
)
static

◆ rdh_get_slave_priority()

static uint8_t rdh_get_slave_priority ( input_item_t p_item,
input_item_slave_t p_slave,
const char *  psz_slave_filename 
)
static

◆ rdh_name_from_filename()

static char* rdh_name_from_filename ( const char *  psz_filename)
static

References psz_name, and strdup().

Referenced by rdh_get_slave_priority().

◆ rdh_should_match_idx()

static int rdh_should_match_idx ( struct vlc_readdir_helper p_rdh,
struct rdh_slave p_rdh_sub 
)
static

◆ rdh_sort()

static void rdh_sort ( input_item_node_t p_node)
static

◆ rdh_unflatten()

static int rdh_unflatten ( struct vlc_readdir_helper p_rdh,
input_item_node_t **  pp_node,
const char *  psz_path,
int  i_net 
)
static

◆ typecmp()

static int typecmp ( const void *  key,
const void *  entry 
)
static

References item_type_entry::psz_scheme.

Referenced by GuessType().

◆ vlc_readdir_helper_additem()

int vlc_readdir_helper_additem ( struct vlc_readdir_helper p_rdh,
const char *  psz_uri,
const char *  psz_flatpath,
const char *  psz_filename,
int  i_type,
int  i_net 
)

Add a new input_item_t entry to the node of the vlc_readdir_helper struct.

Parameters
p_rdhpreviously inited vlc_readdir_helper struct
psz_uriuri of the new item
psz_flatpathflattened path of the new item. If not NULL, this function will create an input item for each sub folders (separated by '/') of psz_flatpath (so, this will un-flatten the folder hierarchy). Either psz_flatpath or psz_filename must be valid.
psz_filenamefile name of the new item. If NULL, the file part of path will be used as a filename. Either psz_flatpath or psz_filename must be valid.
i_typesee input_item_type_e
i_netsee input_item_net_type

References vlc_readdir_helper::b_flatten, vlc_readdir_helper::i_slaves, vlc_readdir_helper::i_sub_autodetect_fuzzy, i_type, INPUT_DURATION_UNSET, input_item_CopyOptions(), input_item_NewExt(), input_item_node_AppendItem(), input_item_Release(), input_item_slave_GetType(), input_item_slave_New(), input_item_node_t::p_item, vlc_readdir_helper::p_node, rdh_slave::p_node, rdh_slave::p_slave, vlc_readdir_helper::pp_slaves, rdh_slave::psz_filename, rdh_file_is_ignored(), rdh_unflatten(), SLAVE_PRIORITY_MATCH_NONE, strdup(), TAB_APPEND, VLC_ENOMEM, and VLC_SUCCESS.

◆ vlc_readdir_helper_finish()

void vlc_readdir_helper_finish ( struct vlc_readdir_helper p_rdh,
bool  b_success 
)

◆ vlc_readdir_helper_init()

void vlc_readdir_helper_init ( struct vlc_readdir_helper p_rdh,
vlc_object_t p_obj,
input_item_node_t p_node 
)