VLC  4.0.0-dev
Functions | Variables
subtitles.c File Reference
Include dependency graph for subtitles.c:


static void strcpy_trim (char *d, const char *s)
static void strcpy_strip_ext (char *d, const char *s)
static void strcpy_get_ext (char *d, const char *s)
static int whiteonly (const char *s)
static int slave_strcmp (const void *a, const void *b)
int subtitles_Filter (const char *psz_dir_content)
static char ** paths_to_list (const char *psz_dir, char *psz_path)
 Convert a list of paths separated by ',' to a char**. More...
int subtitles_Detect (input_thread_t *p_this, char *psz_path, const char *psz_name_org, input_item_slave_t ***ppp_slaves, int *p_slaves)
 Detect subtitle files. More...


static const char *const sub_exts [] = { "aqt", "ass", "cdg", "dks", "idx", "jss", "mpl2", "mpsub", "pjs", "psb", "rt", "sami", "sbv", "scc", "smi", "srt", "ssa", "stl", "sub", "tt", "ttml", "usf", "vtt", "webvtt" , "" }
 The possible extensions for subtitle files we support. More...

Detailed Description

This file contains functions to detect subtitle files.

Function Documentation

◆ paths_to_list()

static char** paths_to_list ( const char *  psz_dir,
char *  psz_path 

Convert a list of paths separated by ',' to a char**.

References asprintf().

Referenced by subtitles_Detect().

◆ slave_strcmp()

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

References input_item_slave::psz_uri, and strcoll.

Referenced by subtitles_Detect().

◆ strcpy_get_ext()

static void strcpy_get_ext ( char *  d,
const char *  s 

Referenced by subtitles_Detect().

◆ strcpy_strip_ext()

static void strcpy_strip_ext ( char *  d,
const char *  s 

References strlcpy().

Referenced by subtitles_Detect().

◆ strcpy_trim()

static void strcpy_trim ( char *  d,
const char *  s 

Referenced by subtitles_Detect().

◆ subtitles_Detect()

int subtitles_Detect ( input_thread_t p_this,
char *  psz_path,
const char *  psz_name_org,
input_item_slave_t ***  ppp_slaves,
int *  p_slaves 

Detect subtitle files.

When called this function will split up the psz_name string into a directory, filename and extension. It then opens the directory in which the file resides and tries to find possible matches of subtitles files.

p_thisthe calling input_thread_t
psz_patha list of subdirectories (separated by a ',') to look in.
psz_name_orgthe complete filename to base the search on.
pp_slavesan initialized input item slave list to append detected subtitles to
p_slavespointer to the size of the slave list

References asprintf(), input_item_slave::b_forced, DIR_SEP, DIR_SEP_CHAR, input_item_slave::i_priority, input_item_slave_Delete, input_item_slave_New(), msg_Dbg, paths_to_list(), psz_ext, psz_name, input_item_slave::psz_uri, SLAVE_PRIORITY_MATCH_ALL, SLAVE_PRIORITY_MATCH_LEFT, SLAVE_PRIORITY_MATCH_NONE, SLAVE_PRIORITY_MATCH_RIGHT, slave_strcmp(), SLAVE_TYPE_SPU, strcasecmp(), strcpy_get_ext(), strcpy_strip_ext(), strcpy_trim(), strdup(), subtitles_Filter(), TAB_APPEND, var_GetInteger(), VLC_EGENERIC, VLC_ENOMEM, vlc_opendir(), vlc_path2uri(), vlc_readdir(), vlc_stat(), VLC_SUCCESS, vlc_uri2path(), and whiteonly().

Referenced by LoadSlaves().

◆ subtitles_Filter()

int subtitles_Filter ( const char *  psz_dir_content)

◆ whiteonly()

static int whiteonly ( const char *  s)

Referenced by subtitles_Detect().

Variable Documentation

◆ sub_exts

const char* const sub_exts[] = { "aqt", "ass", "cdg", "dks", "idx", "jss", "mpl2", "mpsub", "pjs", "psb", "rt", "sami", "sbv", "scc", "smi", "srt", "ssa", "stl", "sub", "tt", "ttml", "usf", "vtt", "webvtt" , "" }

The possible extensions for subtitle files we support.

Referenced by subtitles_Filter().