xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
sputext_decoder.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <xine/buffer.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/osd.h>
#include "xine-engine/bswap.h"
#include "sputext_demuxer.h"

Data Structures

struct  sputext_class_s
 
struct  video2wnd_s
 
struct  sputext_decoder_s
 

Macros

#define LOG_MODULE   "libsputext"
 
#define LOG_VERBOSE
 
#define SUB_MAX_TEXT   5 /* lines */
 
#define SUB_BUFSIZE   256 /* chars per line */
 
#define ALIGN_LEFT   1
 
#define ALIGN_CENTER   2
 
#define ALIGN_RIGHT   3
 
#define ALIGN_BOTTOM   0
 
#define ALIGN_TOP   4
 
#define ALIGN_MIDDLE   8
 
#define GET_X_ALIGNMENT(a)   ((a) & 3)
 
#define GET_Y_ALIGNMENT(a)   ((a) - ((a) & 3))
 
#define SPU_PROJECTION_X   384
 
#define SPU_PROJECTION_Y   288
 
#define rgb2yuv(R, G, B)   ((((((66*R+129*G+25*B+128)>>8)+16)<<8)|(((112*R-94*G-18*B+128)>>8)+128))<<8|(((-38*R-74*G+112*B+128)>>8)+128))
 

Typedefs

typedef struct sputext_class_s sputext_class_t
 
typedef struct video2wnd_s video2wnd_t
 
typedef struct sputext_decoder_s sputext_decoder_t
 

Enumerations

enum  subtitle_size {
  SUBTITLE_SIZE_TINY = 0 , SUBTITLE_SIZE_SMALL , SUBTITLE_SIZE_NORMAL , SUBTITLE_SIZE_LARGE ,
  SUBTITLE_SIZE_VERY_LARGE , SUBTITLE_SIZE_HUGE , SUBTITLE_SIZE_NUM
}
 

Functions

static int update_font (sputext_decoder_t *this)
 
static const char * get_font (sputext_decoder_t *this)
 
static void update_font_size (sputext_decoder_t *this, int force_update)
 
static void update_output_size (sputext_decoder_t *this)
 
static int parse_utf8_size (const void *buf)
 
static int ogm_render_line_internal (sputext_decoder_t *this, int x, int y, const char *text, int render)
 
static int ogm_get_width (sputext_decoder_t *this, char *text)
 
static void ogm_render_line (sputext_decoder_t *this, int x, int y, char *text)
 
static void read_ssa_tag (sputext_decoder_t *this, const char *text, int *alignment, int *sub_x, int *sub_y, int *max_width)
 
static int is_cjk_encoding (const char *enc)
 
static void draw_subtitle (sputext_decoder_t *this, int64_t sub_start, int64_t sub_end)
 
static void spudec_decode_data (spu_decoder_t *this_gen, buf_element_t *buf)
 
static void spudec_reset (spu_decoder_t *this_gen)
 
static void spudec_discontinuity (spu_decoder_t *this_gen)
 
static void spudec_dispose (spu_decoder_t *this_gen)
 
static void update_vertical_offset (void *class_gen, xine_cfg_entry_t *entry)
 
static void update_osd_font (void *class_gen, xine_cfg_entry_t *entry)
 
static void update_subtitle_size (void *class_gen, xine_cfg_entry_t *entry)
 
static void update_use_unscaled (void *class_gen, xine_cfg_entry_t *entry)
 
static spu_decoder_tsputext_class_open_plugin (spu_decoder_class_t *class_gen, xine_stream_t *stream)
 
static void sputext_class_dispose (spu_decoder_class_t *class_gen)
 
static void update_src_encoding (void *class_gen, xine_cfg_entry_t *entry)
 
static void * init_spu_decoder_plugin (xine_t *xine, const void *data)
 

Variables

static const uint32_t sub_palette [22]
 
static const uint8_t sub_trans [22]
 
static const uint32_t supported_types [] = { BUF_SPU_TEXT, BUF_SPU_OGM, 0 }
 
static const decoder_info_t spudec_info
 
const plugin_info_t xine_plugin_info[] EXPORTED
 

Macro Definition Documentation

◆ ALIGN_BOTTOM

#define ALIGN_BOTTOM   0

Referenced by draw_subtitle().

◆ ALIGN_CENTER

#define ALIGN_CENTER   2

Referenced by draw_subtitle(), and read_ssa_tag().

◆ ALIGN_LEFT

#define ALIGN_LEFT   1

Referenced by draw_subtitle(), and read_ssa_tag().

◆ ALIGN_MIDDLE

#define ALIGN_MIDDLE   8

Referenced by draw_subtitle().

◆ ALIGN_RIGHT

#define ALIGN_RIGHT   3

Referenced by draw_subtitle(), and read_ssa_tag().

◆ ALIGN_TOP

#define ALIGN_TOP   4

Referenced by draw_subtitle().

◆ GET_X_ALIGNMENT

#define GET_X_ALIGNMENT ( a)    ((a) & 3)

Referenced by draw_subtitle(), and read_ssa_tag().

◆ GET_Y_ALIGNMENT

#define GET_Y_ALIGNMENT ( a)    ((a) - ((a) & 3))

Referenced by draw_subtitle().

◆ LOG_MODULE

#define LOG_MODULE   "libsputext"

◆ LOG_VERBOSE

#define LOG_VERBOSE

◆ rgb2yuv

#define rgb2yuv ( R,
G,
B )   ((((((66*R+129*G+25*B+128)>>8)+16)<<8)|(((112*R-94*G-18*B+128)>>8)+128))<<8|(((-38*R-74*G+112*B+128)>>8)+128))

◆ SPU_PROJECTION_X

#define SPU_PROJECTION_X   384

Referenced by update_output_size().

◆ SPU_PROJECTION_Y

#define SPU_PROJECTION_Y   288

Referenced by update_output_size().

◆ SUB_BUFSIZE

#define SUB_BUFSIZE   256 /* chars per line */

◆ SUB_MAX_TEXT

#define SUB_MAX_TEXT   5 /* lines */

Typedef Documentation

◆ sputext_class_t

◆ sputext_decoder_t

◆ video2wnd_t

typedef struct video2wnd_s video2wnd_t

Enumeration Type Documentation

◆ subtitle_size

Enumerator
SUBTITLE_SIZE_TINY 
SUBTITLE_SIZE_SMALL 
SUBTITLE_SIZE_NORMAL 
SUBTITLE_SIZE_LARGE 
SUBTITLE_SIZE_VERY_LARGE 
SUBTITLE_SIZE_HUGE 
SUBTITLE_SIZE_NUM 

Function Documentation

◆ draw_subtitle()

static void draw_subtitle ( sputext_decoder_t * this,
int64_t sub_start,
int64_t sub_end )
static

◆ get_font()

static const char * get_font ( sputext_decoder_t * this)
inlinestatic

References update_font().

Referenced by draw_subtitle(), and update_font_size().

◆ init_spu_decoder_plugin()

static void * init_spu_decoder_plugin ( xine_t * xine,
const void * data )
static

◆ is_cjk_encoding()

static int is_cjk_encoding ( const char * enc)
static

Referenced by draw_subtitle().

◆ ogm_get_width()

static int ogm_get_width ( sputext_decoder_t * this,
char * text )
inlinestatic

References ogm_render_line_internal().

Referenced by draw_subtitle().

◆ ogm_render_line()

static void ogm_render_line ( sputext_decoder_t * this,
int x,
int y,
char * text )
inlinestatic

References ogm_render_line_internal().

Referenced by draw_subtitle().

◆ ogm_render_line_internal()

static int ogm_render_line_internal ( sputext_decoder_t * this,
int x,
int y,
const char * text,
int render )
static

◆ parse_utf8_size()

static int parse_utf8_size ( const void * buf)
static

◆ read_ssa_tag()

static void read_ssa_tag ( sputext_decoder_t * this,
const char * text,
int * alignment,
int * sub_x,
int * sub_y,
int * max_width )
static

◆ spudec_decode_data()

static void spudec_decode_data ( spu_decoder_t * this_gen,
buf_element_t * buf )
static

◆ spudec_discontinuity()

static void spudec_discontinuity ( spu_decoder_t * this_gen)
static

◆ spudec_dispose()

static void spudec_dispose ( spu_decoder_t * this_gen)
static

References _x_freep(), and NULL.

Referenced by sputext_class_open_plugin().

◆ spudec_reset()

static void spudec_reset ( spu_decoder_t * this_gen)
static

References height, lprintf, and width.

Referenced by sputext_class_open_plugin().

◆ sputext_class_dispose()

static void sputext_class_dispose ( spu_decoder_class_t * class_gen)
static

References _x_freep(), and NULL.

Referenced by init_spu_decoder_plugin().

◆ sputext_class_open_plugin()

static spu_decoder_t * sputext_class_open_plugin ( spu_decoder_class_t * class_gen,
xine_stream_t * stream )
static

◆ update_font()

static int update_font ( sputext_decoder_t * this)
inlinestatic

Referenced by draw_subtitle(), and get_font().

◆ update_font_size()

static void update_font_size ( sputext_decoder_t * this,
int force_update )
static

◆ update_osd_font()

static void update_osd_font ( void * class_gen,
xine_cfg_entry_t * entry )
static

◆ update_output_size()

static void update_output_size ( sputext_decoder_t * this)
static

◆ update_src_encoding()

static void update_src_encoding ( void * class_gen,
xine_cfg_entry_t * entry )
static

◆ update_subtitle_size()

static void update_subtitle_size ( void * class_gen,
xine_cfg_entry_t * entry )
static

◆ update_use_unscaled()

static void update_use_unscaled ( void * class_gen,
xine_cfg_entry_t * entry )
static

◆ update_vertical_offset()

static void update_vertical_offset ( void * class_gen,
xine_cfg_entry_t * entry )
static

Variable Documentation

◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED
Initial value:
= {
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
static void * init_spu_decoder_plugin(xine_t *xine, const void *data)
Definition sputext_decoder.c:1148
static const decoder_info_t spudec_info
Definition sputext_decoder.c:1236
void * init_sputext_demux_class(xine_t *xine, const void *data)
Definition sputext_demuxer.c:1473
#define XINE_VERSION_CODE
Definition xine_internal.h:57
NULL
Definition xine_plugin.c:78
#define PLUGIN_DEMUX
Definition xine_plugin.h:31
#define PLUGIN_NONE
Definition xine_plugin.h:29
#define PLUGIN_SPU_DECODER
Definition xine_plugin.h:34
#define PLUGIN_MUST_PRELOAD
Definition xine_plugin.h:46

◆ spudec_info

const decoder_info_t spudec_info
static
Initial value:
= {
.supported_types = supported_types,
.priority = 1,
}
static const uint32_t supported_types[]
Definition sputext_decoder.c:1234

◆ sub_palette

const uint32_t sub_palette[22]
static
Initial value:
={
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 50 +129* 10 +25* 10 +128)>>8)+16)<<8)|(((112* 50 -94* 10 -18* 10 +128)>>8)+128))<<8|(((-38* 50 -74* 10 +112* 10 +128)>>8)+128)),
((((((66* 120 +129* 20 +25* 20 +128)>>8)+16)<<8)|(((112* 120 -94* 20 -18* 20 +128)>>8)+128))<<8|(((-38* 120 -74* 20 +112* 20 +128)>>8)+128)),
((((((66* 185 +129* 50 +25* 50 +128)>>8)+16)<<8)|(((112* 185 -94* 50 -18* 50 +128)>>8)+128))<<8|(((-38* 185 -74* 50 +112* 50 +128)>>8)+128)),
((((((66* 255 +129* 70 +25* 70 +128)>>8)+16)<<8)|(((112* 255 -94* 70 -18* 70 +128)>>8)+128))<<8|(((-38* 255 -74* 70 +112* 70 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 0 +25* 0 +128)>>8)+16)<<8)|(((112* 0 -94* 0 -18* 0 +128)>>8)+128))<<8|(((-38* 0 -74* 0 +112* 0 +128)>>8)+128)),
((((((66* 0 +129* 30 +25* 50 +128)>>8)+16)<<8)|(((112* 0 -94* 30 -18* 50 +128)>>8)+128))<<8|(((-38* 0 -74* 30 +112* 50 +128)>>8)+128)),
((((((66* 0 +129* 90 +25* 120 +128)>>8)+16)<<8)|(((112* 0 -94* 90 -18* 120 +128)>>8)+128))<<8|(((-38* 0 -74* 90 +112* 120 +128)>>8)+128)),
((((((66* 0 +129* 140 +25* 185 +128)>>8)+16)<<8)|(((112* 0 -94* 140 -18* 185 +128)>>8)+128))<<8|(((-38* 0 -74* 140 +112* 185 +128)>>8)+128)),
((((((66* 0 +129* 170 +25* 255 +128)>>8)+16)<<8)|(((112* 0 -94* 170 -18* 255 +128)>>8)+128))<<8|(((-38* 0 -74* 170 +112* 255 +128)>>8)+128))
}

Referenced by draw_subtitle().

◆ sub_trans

const uint8_t sub_trans[22]
static
Initial value:
={
0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15,
0, 0, 3, 6, 8, 10, 12, 14, 15, 15, 15
}

Referenced by draw_subtitle().

◆ supported_types

const uint32_t supported_types[] = { BUF_SPU_TEXT, BUF_SPU_OGM, 0 }
static