Data Structures | Defines | Enumerations | Functions | Variables

subtitles.c File Reference

This file contains functions to dectect subtitle files. More...

Include dependency graph for subtitles.c:

Data Structures

struct  vlc_subfn_t

Defines

#define MAX_SUBTITLE_FILES   128
 We are not going to autodetect more subtitle files than this.

Enumerations

enum  {
  SUB_PRIORITY_NONE = 0, SUB_PRIORITY_MATCH_NONE = 1, SUB_PRIORITY_MATCH_RIGHT = 2, SUB_PRIORITY_MATCH_LEFT = 3,
  SUB_PRIORITY_MATCH_ALL = 4
}

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 compare_sub_priority (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**.
char ** subtitles_Detect (input_thread_t *p_this, char *psz_path, const char *psz_name_org)
 Detect subtitle files.

Variables

static const char const sub_exts [][6]
 The possible extensions for subtitle files we support.

Detailed Description

This file contains functions to dectect subtitle files.


Define Documentation

#define MAX_SUBTITLE_FILES   128

We are not going to autodetect more subtitle files than this.

Referenced by subtitles_Detect().


Enumeration Type Documentation

anonymous enum
Enumerator:
SUB_PRIORITY_NONE 
SUB_PRIORITY_MATCH_NONE 
SUB_PRIORITY_MATCH_RIGHT 
SUB_PRIORITY_MATCH_LEFT 
SUB_PRIORITY_MATCH_ALL 

Function Documentation

static int compare_sub_priority ( const void *  a,
const void *  b 
) [static]
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().

static void strcpy_get_ext ( char *  d,
const char *  s 
) [static]

Referenced by subtitles_Detect().

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

References strlcpy().

Referenced by subtitles_Detect().

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

Referenced by subtitles_Detect().

char** subtitles_Detect ( input_thread_t p_this,
char *  psz_path,
const char *  psz_name_org 
)

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_this the calling input_thread_t
psz_path a list of subdirectories (separated by a ',') to look in.
psz_name the complete filename to base the search on.
Returns:
a NULL terminated array of filenames with detected possible subtitles. The array contains max MAX_SUBTITLE_FILES items and you need to free it after use.

References compare_sub_priority(), DIR_SEP, DIR_SEP_CHAR, make_path(), MAX_SUBTITLE_FILES, msg_Dbg, paths_to_list(), vlc_subfn_t::priority, psz_ext, vlc_subfn_t::psz_ext, vlc_subfn_t::psz_fname, psz_name, strcasecmp(), strcpy_get_ext(), strcpy_strip_ext(), strcpy_trim(), strdup(), strncasecmp(), SUB_PRIORITY_MATCH_ALL, subtitles_Filter(), var_GetInteger, vlc_opendir(), vlc_readdir(), vlc_stat(), and whiteonly().

Referenced by LoadSubtitles().

int subtitles_Filter ( const char *  psz_dir_content  ) 

References strcasecmp(), and sub_exts.

Referenced by input_vaControl(), and subtitles_Detect().

static int whiteonly ( const char *  s  )  [static]

Referenced by subtitles_Detect().


Variable Documentation

const char const sub_exts[][6] [static]
Initial value:
 {
    "idx", "sub",  "srt",
    "ssa", "ass",  "smi",
    "utf", "utf8", "utf-8",
    "rt",   "aqt", "txt",
    "usf", "jss",  "cdg",
    "psb", "mpsub","mpl2",
    "pjs", "dks", "stl",
    ""
}

The possible extensions for subtitle files we support.

Referenced by subtitles_Filter().

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines