VLC  3.0.15
Functions | Variables
subtitles.c File Reference
Include dependency graph for subtitles.c:

Functions

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

Variables

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", "ttml", "tt", "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 
)
static

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 
)
static

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 
)
static

Referenced by subtitles_Detect().

◆ strcpy_strip_ext()

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

References strlcpy().

Referenced by subtitles_Detect().

◆ strcpy_trim()

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

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.

Parameters
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
Returns
VLC_SUCCESS if ok

< Unspecified error

< Unspecified error

< Unspecified error

< Not enough memory

< Unspecified error

< Not enough memory

< No error

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

◆ subtitles_Filter()

int subtitles_Filter ( const char *  psz_dir_content)

References strcasecmp(), and sub_exts.

Referenced by input_vaControl(), and subtitles_Detect().

◆ whiteonly()

static int whiteonly ( const char *  s)
static

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", "ttml", "tt", "usf", "vtt", "webvtt" , "" }
static

The possible extensions for subtitle files we support.

Referenced by subtitles_Filter().