xine-lib: xine-lib-1.2.12/src/spu_dec/spudvb_decoder.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
spudvb_decoder.c File Reference
`#include <time.h>`
`#include <pthread.h>`
`#include <errno.h>`
`#include <xine/xine_internal.h>`
`#include <xine/spu.h>`
`#include <xine/osd.h>`
`#include "xine-engine/bswap.h"`

## Data Structures
struct | sparse_array_entry_t
struct | sparse_array_t
struct | visible_region_t
struct | page_t
struct | region_t
union | clut_union_t
struct | dds_t
struct | dvbsub_func_t
struct | dvb_spu_decoder_s

## Macros
#define | LOG_MODULE "spudvb"
#define | MAX_REGIONS 16
#define | SPU_MAX_WIDTH 1920
#define | SPU_MAX_HEIGHT 1080
#define | YUVA(r, g, b, a) (clut_t) { COMPUTE_V(r, g, b), COMPUTE_U(r, g, b), COMPUTE_V(r, g, b), a }
#define | GETBIT(s, v1, v2, tr)

## Typedefs
typedef struct dvb_spu_decoder_s | dvb_spu_decoder_t

## Functions
static void | sparse_array_new (sparse_array_t *sa)
static void | sparse_array_delete (sparse_array_t *sa)
static int | _sparse_array_find (sparse_array_t *sa, uint32_t key, uint32_t *pos)
static void | _sparse_array_sort (sparse_array_t *sa)
static int | sparse_array_set (sparse_array_t *sa, uint32_t key, uint32_t value)
static int | sparse_array_get (sparse_array_t *sa, uint32_t key, uint32_t *value)
static void | sparse_array_unset (sparse_array_t *sa, uint32_t key, uint32_t mask)
static void | reset_clut (dvbsub_func_t *dvbsub)
static void | update_region (region_t *reg, int region_id, int region_width, int region_height, int fill, int fill_color)
static void | do_plot (region_t *reg, int x, int y, unsigned char pixel)
static void | plot (dvbsub_func_t *dvbsub, int r, unsigned int run_length, unsigned char pixel)
static const uint8_t * | lookup_lut (const dvbsub_func_t *dvbsub, int r)
static unsigned char | next_datum (dvbsub_func_t *dvbsub, int width)
static void | decode_2bit_pixel_code_string (dvbsub_func_t *dvbsub, int r, int n)
static void | decode_4bit_pixel_code_string (dvbsub_func_t *dvbsub, int r, int n)
static void | decode_8bit_pixel_code_string (dvbsub_func_t *dvbsub, int r, int n)
static void | set_clut (dvbsub_func_t *dvbsub, int CLUT_id, int CLUT_entry_id, int Y_value, int Cr_value, int Cb_value, int T_value)
static void | process_CLUT_definition_segment (dvbsub_func_t *dvbsub)
static void | process_pixel_data_sub_block (dvbsub_func_t *dvbsub, int r, unsigned int pos, int ofs, int n)
static void | process_page_composition_segment (dvbsub_func_t *dvbsub)
static void | process_region_composition_segment (dvbsub_func_t *dvbsub)
static void | process_object_data_segment (dvbsub_func_t *dvbsub)
static void | process_display_definition_segment (dvbsub_func_t *dvbsub)
static void | unlock_mutex_cancellation_func (void *mutex_gen)
static void | _hide_overlays_locked (dvb_spu_decoder_t *this)
static void * | dvbsub_timer_func (void *this_gen)
static void | update_osd (dvb_spu_decoder_t *this, region_t *reg)
static void | downscale_region_image (region_t *reg, unsigned char *dest, int dest_width)
static void | recalculate_trans (dvb_spu_decoder_t *this)
static void | draw_subtitles (dvb_spu_decoder_t *this)
static void | _hide_overlays (dvb_spu_decoder_t *this)
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_stopped (dvb_spu_decoder_t *this)
static void | spudec_dispose (spu_decoder_t *this_gen)
static spu_decoder_t * | dvb_spu_class_open_plugin (spu_decoder_class_t *class_gen, xine_stream_t *stream)
static void * | init_spu_decoder_plugin (xine_t *xine, const void *data)

## Variables
static const uint32_t | supported_types [] = { BUF_SPU_DVB, 0 }
static const decoder_info_t | spudec_info
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ GETBIT

#define GETBIT | ( |  | s,
|  |  | v1,
|  |  | v2,
|  |  | tr
| ) |  |

Value:
r = s + ((i & 1) ? v1 : 0) + ((i & 0x10) ? v2 : 0); \
g = s + ((i & 2) ? v1 : 0) + ((i & 0x20) ? v2 : 0); \
b = s + ((i & 4) ? v1 : 0) + ((i & 0x40) ? v2 : 0); \
a = tr

## ◆ LOG_MODULE

#define LOG_MODULE "spudvb"

## ◆ MAX_REGIONS

#define MAX_REGIONS 16

## ◆ SPU_MAX_HEIGHT

#define SPU_MAX_HEIGHT 1080

## ◆ SPU_MAX_WIDTH

#define SPU_MAX_WIDTH 1920

## ◆ YUVA

#define YUVA | ( |  | r,
|  |  | g,
|  |  | b,
|  |  | a
| ) |  | (clut_t) { COMPUTE_V(r, g, b), COMPUTE_U(r, g, b), COMPUTE_V(r, g, b), a }

## Typedef Documentation

## ◆ dvb_spu_decoder_t

typedef struct dvb_spu_decoder_s dvb_spu_decoder_t

## Function Documentation

## ◆ _hide_overlays()

static void _hide_overlays | ( | dvb_spu_decoder_t * | this | ) |
| static

References _hide_overlays_locked().

Referenced by spudec_decode_data(), and spudec_reset().

## ◆ _hide_overlays_locked()

static void _hide_overlays_locked | ( | dvb_spu_decoder_t * | this | ) |
| static

Referenced by _hide_overlays(), and dvbsub_timer_func().

## ◆ _sparse_array_find()

static int _sparse_array_find | ( | sparse_array_t * | sa,
|  | uint32_t | key,
|  | uint32_t * | pos
| ) |  |
| static

References sparse_array_t::entries, key, sparse_array_entry_t::key, and sparse_array_t::sorted_entries.

Referenced by _sparse_array_sort(), and sparse_array_get().

## ◆ _sparse_array_sort()

static void _sparse_array_sort | ( | sparse_array_t * | sa | ) |
| static

References _sparse_array_find(), sparse_array_t::entries, sparse_array_entry_t::key, lprintf, sparse_array_t::max_entries, sparse_array_t::sorted_entries, sparse_array_t::used_entries, and sparse_array_entry_t::value.

Referenced by sparse_array_get(), and sparse_array_unset().

## ◆ decode_2bit_pixel_code_string()

static void decode_2bit_pixel_code_string | ( | dvbsub_func_t * | dvbsub,
|  | int | r,
|  | int | n
| ) |  |
| static

References dvbsub_func_t::i, dvbsub_func_t::i_bits, lookup_lut(), next_datum(), and plot().

Referenced by process_pixel_data_sub_block().

## ◆ decode_4bit_pixel_code_string()

static void decode_4bit_pixel_code_string | ( | dvbsub_func_t * | dvbsub,
|  | int | r,
|  | int | n
| ) |  |
| static

References dvbsub_func_t::i, dvbsub_func_t::i_bits, lookup_lut(), next_datum(), and plot().

Referenced by process_pixel_data_sub_block().

## ◆ decode_8bit_pixel_code_string()

static void decode_8bit_pixel_code_string | ( | dvbsub_func_t * | dvbsub,
|  | int | r,
|  | int | n
| ) |  |
| static

References dvbsub_func_t::buf, dvbsub_func_t::i, and plot().

Referenced by process_pixel_data_sub_block().

## ◆ do_plot()

static void do_plot | ( | region_t * | reg,
|  | int | x,
|  | int | y,
|  | unsigned char | pixel
| ) |  |
| static

References region_t::empty, region_t::height, region_t::img, width, and region_t::width.

Referenced by plot().

## ◆ downscale_region_image()

static void downscale_region_image | ( | region_t * | reg,
|  | unsigned char * | dest,
|  | int | dest_width
| ) |  |
| static

References region_t::height, region_t::img, and region_t::width.

Referenced by draw_subtitles().

## ◆ draw_subtitles()

static void draw_subtitles | ( | dvb_spu_decoder_t * | this | ) |
| static

References _X_SET_CLUT_CM, region_t::CLUT_id, downscale_region_image(), region_t::empty, region_t::height, region_t::img, lprintf, NULL, region_t::osd, osd_object_s::trans, update_osd(), VO_CAP_CUSTOM_EXTENT_OVERLAY, osd_object_s::width, and region_t::width.

Referenced by spudec_decode_data().

## ◆ dvb_spu_class_open_plugin()

static spu_decoder_t * dvb_spu_class_open_plugin | ( | spu_decoder_class_t * | class_gen,
|  | xine_stream_t * | stream
| ) |  |
| static

References _x_spu_calculate_opacity(), _x_spu_get_opacity(), dvbsub_timer_func(), LOG_MODULE, MAX_REGIONS, NULL, sparse_array_new(), spudec_decode_data(), spudec_discontinuity(), spudec_dispose(), spudec_dispose_stopped(), spudec_reset(), xine_stream_s::xine, XINE_VERBOSITY_LOG, and xprintf.

Referenced by init_spu_decoder_plugin().

## ◆ dvbsub_timer_func()

static void * dvbsub_timer_func | ( | void * | this_gen | ) |
| static

References _hide_overlays_locked(), lprintf, NULL, and unlock_mutex_cancellation_func().

Referenced by dvb_spu_class_open_plugin().

## ◆ init_spu_decoder_plugin()

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

References dvb_spu_class_open_plugin(), N_, NULL, and spu_decoder_class_s::open_plugin.

## ◆ lookup_lut()

static const uint8_t * lookup_lut | ( | const dvbsub_func_t * | dvbsub,
|  | int | r
| ) |  |
| static

References dvbsub_func_t::compat_depth, dvbsub_func_t::lut, dvbsub_func_t::lut24, dvbsub_func_t::lut28, and dvbsub_func_t::lut48.

Referenced by decode_2bit_pixel_code_string(), and decode_4bit_pixel_code_string().

## ◆ next_datum()

static unsigned char next_datum | ( | dvbsub_func_t * | dvbsub,
|  | int | width
| ) |  |
| static

References dvbsub_func_t::buf, dvbsub_func_t::i, dvbsub_func_t::i_bits, next_datum(), and width.

Referenced by decode_2bit_pixel_code_string(), decode_4bit_pixel_code_string(), and next_datum().

## ◆ plot()

static void plot | ( | dvbsub_func_t * | dvbsub,
|  | int | r,
|  | unsigned int | run_length,
|  | unsigned char | pixel
| ) |  |
| static

References do_plot(), dvbsub_func_t::regions, dvbsub_func_t::x, and dvbsub_func_t::y.

Referenced by decode_2bit_pixel_code_string(), decode_4bit_pixel_code_string(), and decode_8bit_pixel_code_string().

## ◆ process_CLUT_definition_segment()

static void process_CLUT_definition_segment | ( | dvbsub_func_t * | dvbsub | ) |
| static

References dvbsub_func_t::buf, dvbsub_func_t::i, lprintf, and set_clut().

Referenced by spudec_decode_data().

## ◆ process_display_definition_segment()

static void process_display_definition_segment | ( | dvbsub_func_t * | dvbsub | ) |
| static

References _X_BE_16, dvbsub_func_t::buf, dvbsub_func_t::dds, dds_t::height, dvbsub_func_t::i, lprintf, dds_t::version_number, dds_t::width, and dds_t::windowed.

Referenced by spudec_decode_data().

## ◆ process_object_data_segment()

static void process_object_data_segment | ( | dvbsub_func_t * | dvbsub | ) |
| static

References dvbsub_func_t::buf, dvbsub_func_t::curr_obj, dvbsub_func_t::i, region_t::img, dvbsub_func_t::max_regions, dvbsub_func_t::object_pos, dvbsub_func_t::page, page_t::page_id, process_pixel_data_sub_block(), dvbsub_func_t::regions, and sparse_array_get().

Referenced by spudec_decode_data().

## ◆ process_page_composition_segment()

static void process_page_composition_segment | ( | dvbsub_func_t * | dvbsub | ) |
| static

References dvbsub_func_t::buf, dvbsub_func_t::i, visible_region_t::is_visible, lprintf, MAX_REGIONS, dvbsub_func_t::max_regions, dvbsub_func_t::page, page_t::page_id, page_t::page_state, page_t::page_time_out, page_t::page_version_number, page_t::regions, visible_region_t::x, and visible_region_t::y.

Referenced by spudec_decode_data().

## ◆ process_pixel_data_sub_block()

static void process_pixel_data_sub_block | ( | dvbsub_func_t * | dvbsub,
|  | int | r,
|  | unsigned int | pos,
|  | int | ofs,
|  | int | n
| ) |  |
| static

References dvbsub_func_t::buf, decode_2bit_pixel_code_string(), decode_4bit_pixel_code_string(), decode_8bit_pixel_code_string(), dvbsub_func_t::i, lprintf, dvbsub_func_t::lut, dvbsub_func_t::lut24, dvbsub_func_t::lut28, dvbsub_func_t::lut48, dvbsub_func_t::x, and dvbsub_func_t::y.

Referenced by process_object_data_segment().

## ◆ process_region_composition_segment()

static void process_region_composition_segment | ( | dvbsub_func_t * | dvbsub | ) |
| static

References dvbsub_func_t::buf, region_t::CLUT_id, dvbsub_func_t::compat_depth, dvbsub_func_t::i, lprintf, MAX_REGIONS, dvbsub_func_t::max_regions, dvbsub_func_t::object_pos, dvbsub_func_t::page, page_t::page_id, dvbsub_func_t::regions, sparse_array_set(), sparse_array_unset(), update_region(), and region_t::version_number.

Referenced by spudec_decode_data().

## ◆ recalculate_trans()

static void recalculate_trans | ( | dvb_spu_decoder_t * | this | ) |
| static

References _x_spu_calculate_opacity(), _x_spu_get_opacity(), clut_union_t::c, dvbsub_func_t::colours, clut_s::foo, dvbsub_func_t::max_regions, dvbsub_func_t::trans, v, and clut_s::y.

Referenced by spudec_decode_data().

## ◆ reset_clut()

static void reset_clut | ( | dvbsub_func_t * | dvbsub | ) |
| static

References dvbsub_func_t::colours, default_clut, GETBIT, dvbsub_func_t::lut, dvbsub_func_t::lut24, dvbsub_func_t::lut28, dvbsub_func_t::lut48, MAX_REGIONS, dvbsub_func_t::trans, and YUVA.

Referenced by spudec_reset().

## ◆ set_clut()

static void set_clut | ( | dvbsub_func_t * | dvbsub,
|  | int | CLUT_id,
|  | int | CLUT_entry_id,
|  | int | Y_value,
|  | int | Cr_value,
|  | int | Cb_value,
|  | int | T_value
| ) |  |
| static

References clut_union_t::c, dvbsub_func_t::colours, clut_s::cr, clut_s::foo, and MAX_REGIONS.

Referenced by process_CLUT_definition_segment().

## ◆ sparse_array_delete()

static void sparse_array_delete | ( | sparse_array_t * | sa | ) |
| static

References _x_freep(), sparse_array_t::entries, sparse_array_t::max_entries, sparse_array_t::sorted_entries, and sparse_array_t::used_entries.

Referenced by spudec_dispose_stopped().

## ◆ sparse_array_get()

static int sparse_array_get | ( | sparse_array_t * | sa,
|  | uint32_t | key,
|  | uint32_t * | value
| ) |  |
| static

References _sparse_array_find(), _sparse_array_sort(), sparse_array_t::entries, key, sparse_array_t::sorted_entries, sparse_array_t::used_entries, and sparse_array_entry_t::value.

Referenced by process_object_data_segment().

## ◆ sparse_array_new()

static void sparse_array_new | ( | sparse_array_t * | sa | ) |
| static

References sparse_array_t::entries, sparse_array_t::max_entries, NULL, sparse_array_t::sorted_entries, and sparse_array_t::used_entries.

Referenced by dvb_spu_class_open_plugin().

## ◆ sparse_array_set()

static int sparse_array_set | ( | sparse_array_t * | sa,
|  | uint32_t | key,
|  | uint32_t | value
| ) |  |
| static

References sparse_array_t::entries, key, sparse_array_entry_t::key, sparse_array_t::max_entries, sparse_array_t::used_entries, and sparse_array_entry_t::value.

Referenced by process_region_composition_segment().

## ◆ sparse_array_unset()

static void sparse_array_unset | ( | sparse_array_t * | sa,
|  | uint32_t | key,
|  | uint32_t | mask
| ) |  |
| static

References _sparse_array_sort(), sparse_array_t::entries, key, sparse_array_entry_t::key, NULL, sparse_array_t::sorted_entries, and sparse_array_t::used_entries.

Referenced by process_region_composition_segment().

## ◆ spudec_decode_data()

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

References _hide_overlays(), BUF_FLAG_SPECIAL, BUF_SPECIAL_SPU_DVB_DESCRIPTOR, BUF_SPU_DVB, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, draw_subtitles(), metronom_clock_s::get_current_time, metronom_s::get_option, LOG_MODULE, lprintf, METRONOM_SPU_OFFSET, METRONOM_VPTS_OFFSET, process_CLUT_definition_segment(), process_display_definition_segment(), process_object_data_segment(), process_page_composition_segment(), process_region_composition_segment(), buf_element_s::pts, recalculate_trans(), buf_element_s::size, buf_element_s::type, xine_fast_memcpy, XINE_VERBOSITY_LOG, and xprintf.

Referenced by dvb_spu_class_open_plugin().

## ◆ spudec_discontinuity()

static void spudec_discontinuity | ( | spu_decoder_t * | this_gen | ) |
| static

Referenced by dvb_spu_class_open_plugin().

## ◆ spudec_dispose()

static void spudec_dispose | ( | spu_decoder_t * | this_gen | ) |
| static

References NULL, and spudec_dispose_stopped().

Referenced by dvb_spu_class_open_plugin().

## ◆ spudec_dispose_stopped()

static void spudec_dispose_stopped | ( | dvb_spu_decoder_t * | this | ) |
| static

References _x_freep(), MAX_REGIONS, and sparse_array_delete().

Referenced by dvb_spu_class_open_plugin(), and spudec_dispose().

## ◆ spudec_reset()

static void spudec_reset | ( | spu_decoder_t * | this_gen | ) |
| static

References _hide_overlays(), MAX_REGIONS, and reset_clut().

Referenced by dvb_spu_class_open_plugin().

## ◆ unlock_mutex_cancellation_func()

static void unlock_mutex_cancellation_func | ( | void * | mutex_gen | ) |
| static

Referenced by dvbsub_timer_func().

## ◆ update_osd()

static void update_osd | ( | dvb_spu_decoder_t * | this,
|  | region_t * | reg
| ) |  |
| static

References osd_object_s::height, region_t::height, region_t::img, NULL, region_t::osd, osd_object_s::width, and region_t::width.

Referenced by draw_subtitles().

## ◆ update_region()

static void update_region | ( | region_t * | reg,
|  | int | region_id,
|  | int | region_width,
|  | int | region_height,
|  | int | fill,
|  | int | fill_color
| ) |  |
| static

References _x_freep(), region_t::empty, region_t::height, region_t::img, lprintf, SPU_MAX_HEIGHT, SPU_MAX_WIDTH, and region_t::width.

Referenced by process_region_composition_segment().

## Variable Documentation

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{PLUGIN_SPU_DECODER, 17, "spudvb", XINE_VERSION_CODE, &spudec_info,
&init_spu_decoder_plugin},
{PLUGIN_NONE, 0, NULL, 0, NULL, NULL}
}
init_spu_decoder_plugin
static void * init_spu_decoder_plugin(xine_t *xine, const void *data)
Definition: spudvb_decoder.c:1381
spudec_info
static const decoder_info_t spudec_info
Definition: spudvb_decoder.c:1398
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition: xine_internal.h:57
NULL
NULL
Definition: xine_plugin.c:78
PLUGIN_NONE
#define PLUGIN_NONE
Definition: xine_plugin.h:29
PLUGIN_SPU_DECODER
#define PLUGIN_SPU_DECODER
Definition: xine_plugin.h:34

## ◆ spudec_info

const decoder_info_t spudec_info
| static

Initial value:
= {
.supported_types = supported_types,
.priority = 1,
}
supported_types
static const uint32_t supported_types[]
Definition: spudvb_decoder.c:1396

## ◆ supported_types

const uint32_t supported_types[] = { BUF_SPU_DVB, 0 }
| static