xine-lib: xine-lib-1.2.13/src/spu_dec/sputext_demuxer.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Functions
sputext_demuxer.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <sys/types.h>`
`#include <ctype.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/demux.h>`
`#include "sputext_demuxer.h"`

## Data Structures
struct | subtitle_t
struct | demux_sputext_t

## Macros
#define | LOG_MODULE "demux_sputext"
#define | LOG_VERBOSE
#define | ERR (void *)-1
#define | SUB_MAX_TEXT 5
#define | SUB_BUFSIZE 1024
#define | LINE_LEN 1000
#define | LINE_LEN_QUOT "1000"
#define | FORMAT_UNKNOWN -1
#define | FORMAT_MICRODVD 0
#define | FORMAT_SUBRIP 1
#define | FORMAT_SUBVIEWER 2
#define | FORMAT_SAMI 3
#define | FORMAT_VPLAYER 4
#define | FORMAT_RT 5
#define | FORMAT_SSA 6 /* Sub Station Alpha */
#define | FORMAT_PJS 7
#define | FORMAT_MPSUB 8
#define | FORMAT_AQTITLE 9
#define | FORMAT_JACOBSUB 10
#define | FORMAT_SUBVIEWER2 11
#define | FORMAT_SUBRIP09 12
#define | FORMAT_MPL2 13 /*Mplayer sub 2 ?*/

## Functions
static int | eol (char p)
static void | trail_space (char *s)
static char * | read_line_from_input (demux_sputext_t *this, char *line, off_t len)
static subtitle_t * | sub_read_line_sami (demux_sputext_t *this, subtitle_t *current)
static char * | sub_readtext (char *source, char **dest)
static subtitle_t * | sub_read_line_microdvd (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_subviewer (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_subrip (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_vplayer (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_rt (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_ssa (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_pjs (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_mpsub (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_aqt (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_jacobsub (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_subviewer2 (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_subrip09 (demux_sputext_t *this, subtitle_t *current)
static subtitle_t * | sub_read_line_mpl2 (demux_sputext_t *this, subtitle_t *current)
static int | sub_autodetect (demux_sputext_t *this)
static int | detect_utf8 (subtitle_t *subs, int num_subs)
static subtitle_t * | sub_read_file (demux_sputext_t *this)
static int | demux_sputext_next (demux_sputext_t *this_gen)
static void | demux_sputext_dispose (demux_plugin_t *this_gen)
static int | demux_sputext_get_status (demux_plugin_t *this_gen)
static int | demux_sputext_get_stream_length (demux_plugin_t *this_gen)
static int | demux_sputext_send_chunk (demux_plugin_t *this_gen)
static int | demux_sputext_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static void | demux_sputext_send_headers (demux_plugin_t *this_gen)
static uint32_t | demux_sputext_get_capabilities (demux_plugin_t *this_gen)
static int | demux_sputext_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
static demux_plugin_t * | open_demux_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input_gen)
void * | init_sputext_demux_class (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ ERR

#define ERR (void *)-1

Referenced by sub_read_file(), sub_read_line_jacobsub(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_pjs(), sub_read_line_rt(), sub_read_line_subrip(), sub_read_line_subrip09(), sub_read_line_subviewer(), sub_read_line_subviewer2(), and sub_read_line_vplayer().

## ◆ FORMAT_AQTITLE

#define FORMAT_AQTITLE 9

Referenced by sub_autodetect().

## ◆ FORMAT_JACOBSUB

#define FORMAT_JACOBSUB 10

Referenced by sub_autodetect().

## ◆ FORMAT_MICRODVD

#define FORMAT_MICRODVD 0

Referenced by sub_autodetect().

## ◆ FORMAT_MPL2

#define FORMAT_MPL2 13 /*Mplayer sub 2 ?*/

Referenced by sub_autodetect().

## ◆ FORMAT_MPSUB

#define FORMAT_MPSUB 8

Referenced by sub_autodetect().

## ◆ FORMAT_PJS

#define FORMAT_PJS 7

Referenced by sub_autodetect().

## ◆ FORMAT_RT

#define FORMAT_RT 5

Referenced by sub_autodetect().

## ◆ FORMAT_SAMI

#define FORMAT_SAMI 3

Referenced by sub_autodetect().

## ◆ FORMAT_SSA

#define FORMAT_SSA 6 /* Sub Station Alpha */

Referenced by sub_autodetect().

## ◆ FORMAT_SUBRIP

#define FORMAT_SUBRIP 1

Referenced by sub_autodetect().

## ◆ FORMAT_SUBRIP09

#define FORMAT_SUBRIP09 12

Referenced by sub_autodetect().

## ◆ FORMAT_SUBVIEWER

#define FORMAT_SUBVIEWER 2

Referenced by sub_autodetect().

## ◆ FORMAT_SUBVIEWER2

#define FORMAT_SUBVIEWER2 11

Referenced by sub_autodetect().

## ◆ FORMAT_UNKNOWN

#define FORMAT_UNKNOWN -1

Referenced by sub_autodetect(), and sub_read_file().

## ◆ FORMAT_VPLAYER

#define FORMAT_VPLAYER 4

Referenced by sub_autodetect().

## ◆ LINE_LEN

#define LINE_LEN 1000

Referenced by sub_autodetect(), sub_read_line_aqt(), sub_read_line_jacobsub(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_mpsub(), sub_read_line_pjs(), sub_read_line_rt(), sub_read_line_sami(), sub_read_line_ssa(), sub_read_line_subrip(), sub_read_line_subrip09(), sub_read_line_subviewer(), sub_read_line_subviewer2(), and sub_read_line_vplayer().

## ◆ LINE_LEN_QUOT

#define LINE_LEN_QUOT "1000"

Referenced by sub_read_line_jacobsub(), and sub_read_line_microdvd().

## ◆ LOG_MODULE

#define LOG_MODULE "demux_sputext"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ SUB_BUFSIZE

#define SUB_BUFSIZE 1024

Referenced by demux_sputext_next(), read_line_from_input(), and sub_read_line_subrip().

## ◆ SUB_MAX_TEXT

#define SUB_MAX_TEXT 5

Referenced by sub_read_line_jacobsub(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_mpsub(), sub_read_line_rt(), sub_read_line_ssa(), sub_read_line_subrip(), sub_read_line_subrip09(), sub_read_line_subviewer(), sub_read_line_subviewer2(), and sub_read_line_vplayer().

## Function Documentation

## ◆ demux_sputext_dispose()

static void demux_sputext_dispose | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_freep().

Referenced by open_demux_plugin().

## ◆ demux_sputext_get_capabilities()

static uint32_t demux_sputext_get_capabilities | ( | demux_plugin_t * | this_gen | ) |
| static

References DEMUX_CAP_NOCAP.

Referenced by open_demux_plugin().

## ◆ demux_sputext_get_optional_data()

static int demux_sputext_get_optional_data | ( | demux_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type )
| static

References DEMUX_OPTIONAL_DATA_SPULANG, DEMUX_OPTIONAL_SUCCESS, and DEMUX_OPTIONAL_UNSUPPORTED.

Referenced by open_demux_plugin().

## ◆ demux_sputext_get_status()

static int demux_sputext_get_status | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_demux_plugin().

## ◆ demux_sputext_get_stream_length()

static int demux_sputext_get_stream_length | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_demux_plugin().

## ◆ demux_sputext_next()

static int demux_sputext_next | ( | demux_sputext_t * | this_gen | ) |
| static

References BUF_FLAG_SPECIAL, BUF_SPECIAL_CHARSET_ENCODING, BUF_SPU_TEXT, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, subtitle_t::end, subtitle_t::lines, buf_element_s::pts, subtitle_t::start, SUB_BUFSIZE, subtitle_t::text, and buf_element_s::type.

Referenced by demux_sputext_send_chunk().

## ◆ demux_sputext_seek()

static int demux_sputext_seek | ( | demux_plugin_t * | this_gen,
|  | off_t | start_pos,
|  | int | start_time,
|  | int | playing )
| static

References _x_demux_control_newpts(), _x_demux_flush_engine(), DEMUX_OK, and lprintf.

Referenced by open_demux_plugin().

## ◆ demux_sputext_send_chunk()

static int demux_sputext_send_chunk | ( | demux_plugin_t * | this_gen | ) |
| static

References DEMUX_FINISHED, and demux_sputext_next().

Referenced by open_demux_plugin().

## ◆ demux_sputext_send_headers()

static void demux_sputext_send_headers | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_demux_control_start(), _x_stream_info_set(), BUF_CONTROL_SPU_CHANNEL, buf_element_s::decoder_info, DEMUX_OK, lprintf, buf_element_s::type, XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

Referenced by open_demux_plugin().

## ◆ detect_utf8()

static int detect_utf8 | ( | subtitle_t * | subs,
|  | int | num_subs )
| static

References subtitle_t::lines, and subtitle_t::text.

Referenced by sub_read_file().

## ◆ eol()

static int eol | ( | char | p | ) |
| static

Referenced by sub_read_line_jacobsub(), sub_read_line_mpsub(), and sub_readtext().

## ◆ init_sputext_demux_class()

void * init_sputext_demux_class | ( | xine_t * | xine,
|  | const void * | data )

References _, xine_s::config, demux_plugin_s::dispose, N_, NULL, open_demux_plugin(), demux_class_s::open_plugin, and config_values_s::register_num.

## ◆ open_demux_plugin()

static demux_plugin_t * open_demux_plugin | ( | demux_class_t * | class_gen,
|  | xine_stream_t * | stream,
|  | input_plugin_t * | input_gen )
| static

References xine_stream_s::content_detection_method, demux_sputext_dispose(), demux_sputext_get_capabilities(), demux_sputext_get_optional_data(), demux_sputext_get_status(), demux_sputext_get_stream_length(), demux_sputext_seek(), demux_sputext_send_chunk(), demux_sputext_send_headers(), input(), INPUT_CAP_SEEKABLE, lprintf, METHOD_BY_MRL, METHOD_EXPLICIT, NULL, input_plugin_s::seek, sub_read_file(), xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by init_sputext_demux_class().

## ◆ read_line_from_input()

static char * read_line_from_input | ( | demux_sputext_t * | this,
|  | char * | line,
|  | off_t | len )
| static

References input(), NULL, SUB_BUFSIZE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_autodetect(), sub_read_line_aqt(), sub_read_line_jacobsub(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_mpsub(), sub_read_line_pjs(), sub_read_line_rt(), sub_read_line_sami(), sub_read_line_ssa(), sub_read_line_subrip(), sub_read_line_subrip09(), sub_read_line_subviewer(), sub_read_line_subviewer2(), and sub_read_line_vplayer().

## ◆ sub_autodetect()

static int sub_autodetect | ( | demux_sputext_t * | this | ) |
| static

References FORMAT_AQTITLE, FORMAT_JACOBSUB, FORMAT_MICRODVD, FORMAT_MPL2, FORMAT_MPSUB, FORMAT_PJS, FORMAT_RT, FORMAT_SAMI, FORMAT_SSA, FORMAT_SUBRIP, FORMAT_SUBRIP09, FORMAT_SUBVIEWER, FORMAT_SUBVIEWER2, FORMAT_UNKNOWN, FORMAT_VPLAYER, LINE_LEN, read_line_from_input(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_file()

static subtitle_t * sub_read_file | ( | demux_sputext_t * | this | ) |
| static

References cfg_entry_s::config, detect_utf8(), subtitle_t::end, ERR, FORMAT_UNKNOWN, input(), config_values_s::lookup_entry, NULL, cfg_entry_s::num_value, subtitle_t::start, sub_autodetect(), sub_read_line_aqt(), sub_read_line_jacobsub(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_mpsub(), sub_read_line_pjs(), sub_read_line_rt(), sub_read_line_sami(), sub_read_line_ssa(), sub_read_line_subrip(), sub_read_line_subrip09(), sub_read_line_subviewer(), sub_read_line_subviewer2(), sub_read_line_vplayer(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by open_demux_plugin().

## ◆ sub_read_line_aqt()

static subtitle_t * sub_read_line_aqt | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, sub_readtext(), and subtitle_t::text.

Referenced by sub_read_file().

## ◆ sub_read_line_jacobsub()

static subtitle_t * sub_read_line_jacobsub | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, eol(), ERR, LINE_LEN, LINE_LEN_QUOT, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, subtitle_t::text, trail_space(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_microdvd()

static subtitle_t * sub_read_line_microdvd | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, LINE_LEN_QUOT, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, sub_readtext(), subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_mpl2()

static subtitle_t * sub_read_line_mpl2 | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, sub_readtext(), subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_mpsub()

static subtitle_t * sub_read_line_mpsub | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, eol(), LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_pjs()

static subtitle_t * sub_read_line_pjs | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, and subtitle_t::text.

Referenced by sub_read_file().

## ◆ sub_read_line_rt()

static subtitle_t * sub_read_line_rt | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, sub_readtext(), subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_sami()

static subtitle_t * sub_read_line_sami | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, subtitle_t::text, and trail_space().

Referenced by sub_read_file().

## ◆ sub_read_line_ssa()

static subtitle_t * sub_read_line_ssa | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, and subtitle_t::text.

Referenced by sub_read_file().

## ◆ sub_read_line_subrip()

static subtitle_t * sub_read_line_subrip | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_BUFSIZE, SUB_MAX_TEXT, subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_subrip09()

static subtitle_t * sub_read_line_subrip09 | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, sub_readtext(), subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_read_line_subviewer()

static subtitle_t * sub_read_line_subviewer | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, and subtitle_t::text.

Referenced by sub_read_file().

## ◆ sub_read_line_subviewer2()

static subtitle_t * sub_read_line_subviewer2 | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, and subtitle_t::text.

Referenced by sub_read_file().

## ◆ sub_read_line_vplayer()

static subtitle_t * sub_read_line_vplayer | ( | demux_sputext_t * | this,
|  | subtitle_t * | current )
| static

References subtitle_t::end, ERR, LINE_LEN, subtitle_t::lines, NULL, read_line_from_input(), subtitle_t::start, SUB_MAX_TEXT, sub_readtext(), subtitle_t::text, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by sub_read_file().

## ◆ sub_readtext()

static char * sub_readtext | ( | char * | source,
|  | char ** | dest )
| static

References eol(), and NULL.

Referenced by sub_read_line_aqt(), sub_read_line_microdvd(), sub_read_line_mpl2(), sub_read_line_rt(), sub_read_line_subrip09(), and sub_read_line_vplayer().

## ◆ trail_space()

static void trail_space | ( | char * | s | ) |
| inlinestatic

Referenced by sub_read_line_jacobsub(), and sub_read_line_sami().