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

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
spuhdmv_decoder.c File Reference
`#include <inttypes.h>`
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <xine/xine_internal.h>`
`#include <xine/buffer.h>`
`#include <xine/xineutils.h>`
`#include <xine/video_out.h>`
`#include <xine/video_overlay.h>`

## Data Structures
struct | subtitle_clut_s
struct | subtitle_object_s
struct | window_def_s
struct | composition_object_s
struct | composition_descriptor_s
struct | presentation_segment_s
struct | segment_buffer_t
struct | spuhdmv_decoder_s

## Macros
#define | LOG_MODULE "spu_hdmv"
#define | XINE_HDMV_TRACE lprintf
#define | MAX(a, b) (a>b)?(a):(b)
#define | LIST_REPLACE(list, obj, FREE_FUNC)
#define | LIST_DESTROY(list, FREE_FUNC)

## Typedefs
typedef struct subtitle_clut_s | subtitle_clut_t
typedef struct subtitle_object_s | subtitle_object_t
typedef struct window_def_s | window_def_t
typedef struct composition_object_s | composition_object_t
typedef struct composition_descriptor_s | composition_descriptor_t
typedef struct presentation_segment_s | presentation_segment_t
typedef struct spuhdmv_decoder_s | spuhdmv_decoder_t

## Enumerations
enum | { SEGTYPE_PALETTE = 0x14 , SEGTYPE_OBJECT = 0x15 , SEGTYPE_PRESENTATION_SEGMENT = 0x16 , SEGTYPE_WINDOW_DEFINITION = 0x17 , SEGTYPE_INTERACTIVE = 0x18 , SEGTYPE_END_OF_DISPLAY = 0x80 }

## Functions
static void | free_subtitle_object (void *ptr)
static void | free_presentation_segment (void *ptr)
static segment_buffer_t * | segbuf_init (void)
static void | segbuf_dispose (segment_buffer_t *buf)
static void | segbuf_reset (segment_buffer_t *buf)
static void | segbuf_parse_segment_header (segment_buffer_t *buf)
static void | segbuf_fill (segment_buffer_t *buf, uint8_t *data, size_t len)
static int | segbuf_segment_complete (segment_buffer_t *buf)
static void | segbuf_skip_segment (segment_buffer_t *buf)
static uint8_t | segbuf_segment_type (segment_buffer_t *buf)
static size_t | segbuf_data_length (segment_buffer_t *buf)
static uint8_t | segbuf_get_u8 (segment_buffer_t *buf)
static uint16_t | segbuf_get_u16 (segment_buffer_t *buf)
static uint32_t | segbuf_get_u24 (segment_buffer_t *buf)
static subtitle_clut_t * | segbuf_decode_palette (segment_buffer_t *buf)
static int | segbuf_decode_rle (segment_buffer_t *buf, subtitle_object_t *obj)
static subtitle_object_t * | segbuf_decode_object (segment_buffer_t *buf, subtitle_object_t *objects)
static window_def_t * | segbuf_decode_window_definition (segment_buffer_t *buf)
static int | segbuf_decode_video_descriptor (segment_buffer_t *buf)
static int | segbuf_decode_composition_descriptor (segment_buffer_t *buf, composition_descriptor_t *descr)
static composition_object_t * | segbuf_decode_composition_object (segment_buffer_t *buf)
static presentation_segment_t * | segbuf_decode_presentation_segment (segment_buffer_t *buf)
static rle_elem_t * | copy_crop_rle (subtitle_object_t *obj, composition_object_t *cobj)
static void | free_objs (spuhdmv_decoder_t *this)
static int | decode_palette (spuhdmv_decoder_t *this)
static int | decode_object (spuhdmv_decoder_t *this)
static int | decode_window_definition (spuhdmv_decoder_t *this)
static int | decode_presentation_segment (spuhdmv_decoder_t *this)
static int | show_overlay (spuhdmv_decoder_t *this, composition_object_t *cobj, unsigned int palette_id_ref, int overlay_index, int64_t pts, int force_update)
static void | hide_overlays (spuhdmv_decoder_t *this, int64_t pts)
static void | update_overlays (spuhdmv_decoder_t *this)
static void | decode_segment (spuhdmv_decoder_t *this)
static void | close_osd (spuhdmv_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 (spu_decoder_t *this_gen)
static spu_decoder_t * | open_plugin (spu_decoder_class_t *class_gen, xine_stream_t *stream)
static void * | init_plugin (xine_t *xine, const void *data)

## Variables
enum { ... } | eSegmentType
static const uint32_t | supported_types [] = { BUF_SPU_HDMV, 0 }
static const decoder_info_t | dec_info_data
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ LIST_DESTROY

#define LIST_DESTROY | ( |  | list,
|  |  | FREE_FUNC )

Value:
while (list) { \
void *tmp = (void*)list; \
list = list->next; \
FREE_FUNC(tmp); \
}

Referenced by decode_presentation_segment(), free_objs(), and free_presentation_segment().

## ◆ LIST_REPLACE

#define LIST_REPLACE | ( |  | list,
|  |  | obj,
|  |  | FREE_FUNC )

Value:
do { \
unsigned int id = obj->id; \
\
/* insert to list */ \
obj->next = list; \
list = obj; \
\
/* remove old */ \
while (obj->next && obj->next->id != id) \
obj = obj->next; \
if (obj->next) { \
void *tmp = (void*)obj->next; \
obj->next = obj->next->next; \
FREE_FUNC(tmp); \
} \
} while (0);

Referenced by decode_object(), decode_palette(), and decode_window_definition().

## ◆ LOG_MODULE

#define LOG_MODULE "spu_hdmv"

Referenced by decode_segment(), and update_overlays().

## ◆ MAX

#define MAX | ( |  | a,
|  |  | b ) (a>b)?(a):(b)

Referenced by segbuf_decode_object().

## ◆ XINE_HDMV_TRACE

#define XINE_HDMV_TRACE lprintf

Referenced by decode_segment(), hide_overlays(), segbuf_decode_composition_descriptor(), segbuf_decode_composition_object(), segbuf_decode_object(), segbuf_decode_palette(), segbuf_decode_presentation_segment(), segbuf_decode_video_descriptor(), segbuf_decode_window_definition(), segbuf_get_u8(), segbuf_parse_segment_header(), segbuf_skip_segment(), and show_overlay().

## Typedef Documentation

## ◆ composition_descriptor_t

typedef struct composition_descriptor_s composition_descriptor_t

## ◆ composition_object_t

typedef struct composition_object_s composition_object_t

## ◆ presentation_segment_t

typedef struct presentation_segment_s presentation_segment_t

## ◆ spuhdmv_decoder_t

typedef struct spuhdmv_decoder_s spuhdmv_decoder_t

## ◆ subtitle_clut_t

typedef struct subtitle_clut_s subtitle_clut_t

## ◆ subtitle_object_t

typedef struct subtitle_object_s subtitle_object_t

## ◆ window_def_t

typedef struct window_def_s window_def_t

## Enumeration Type Documentation

## ◆ anonymous enum

anonymous enum

Enumerator
SEGTYPE_PALETTE |
SEGTYPE_OBJECT |
SEGTYPE_PRESENTATION_SEGMENT |
SEGTYPE_WINDOW_DEFINITION |
SEGTYPE_INTERACTIVE |
SEGTYPE_END_OF_DISPLAY |

## Function Documentation

## ◆ close_osd()

static void close_osd | ( | spuhdmv_decoder_t * | this | ) |
| static

References video_overlay_manager_s::free_handle.

Referenced by spudec_discontinuity(), spudec_dispose(), and spudec_reset().

## ◆ copy_crop_rle()

static rle_elem_t * copy_crop_rle | ( | subtitle_object_t * | obj,
|  | composition_object_t * | cobj )
| static

References subtitle_object_s::num_rle, and subtitle_object_s::rle.

Referenced by show_overlay().

## ◆ decode_object()

static int decode_object | ( | spuhdmv_decoder_t * | this | ) |
| static

References free_subtitle_object(), LIST_REPLACE, and segbuf_decode_object().

Referenced by decode_segment().

## ◆ decode_palette()

static int decode_palette | ( | spuhdmv_decoder_t * | this | ) |
| static

References LIST_REPLACE, and segbuf_decode_palette().

Referenced by decode_segment().

## ◆ decode_presentation_segment()

static int decode_presentation_segment | ( | spuhdmv_decoder_t * | this | ) |
| static

References presentation_segment_s::comp_descr, free_objs(), free_presentation_segment(), LIST_DESTROY, presentation_segment_s::pts, segbuf_decode_presentation_segment(), and composition_descriptor_s::state.

Referenced by decode_segment().

## ◆ decode_segment()

static void decode_segment | ( | spuhdmv_decoder_t * | this | ) |
| static

References decode_object(), decode_palette(), decode_presentation_segment(), decode_window_definition(), free_objs(), LOG_MODULE, segbuf_segment_type(), SEGTYPE_END_OF_DISPLAY, SEGTYPE_INTERACTIVE, SEGTYPE_OBJECT, SEGTYPE_PALETTE, SEGTYPE_PRESENTATION_SEGMENT, SEGTYPE_WINDOW_DEFINITION, update_overlays(), XINE_HDMV_TRACE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by spudec_decode_data().

## ◆ decode_window_definition()

static int decode_window_definition | ( | spuhdmv_decoder_t * | this | ) |
| static

References LIST_REPLACE, and segbuf_decode_window_definition().

Referenced by decode_segment().

## ◆ free_objs()

static void free_objs | ( | spuhdmv_decoder_t * | this | ) |
| static

References free_presentation_segment(), free_subtitle_object(), and LIST_DESTROY.

Referenced by decode_presentation_segment(), decode_segment(), spudec_dispose(), and spudec_reset().

## ◆ free_presentation_segment()

static void free_presentation_segment | ( | void * | ptr | ) |
| static

References presentation_segment_s::comp_objs, and LIST_DESTROY.

Referenced by decode_presentation_segment(), free_objs(), and segbuf_decode_presentation_segment().

## ◆ free_subtitle_object()

static void free_subtitle_object | ( | void * | ptr | ) |
| static

References _x_freep().

Referenced by decode_object(), free_objs(), and segbuf_decode_object().

## ◆ hide_overlays()

static void hide_overlays | ( | spuhdmv_decoder_t * | this,
|  | int64_t | pts )
| static

References video_overlay_manager_s::add_event, metronom_s::got_spu_packet, NULL, OVERLAY_EVENT_HIDE, video_overlay_event_s::vpts, and XINE_HDMV_TRACE.

Referenced by update_overlays().

## ◆ init_plugin()

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

References spu_decoder_s::dispose, NULL, open_plugin(), and spu_decoder_class_s::open_plugin.

## ◆ open_plugin()

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

References NULL, segbuf_init(), spudec_decode_data(), spudec_discontinuity(), spudec_dispose(), and spudec_reset().

Referenced by init_plugin().

## ◆ segbuf_data_length()

static size_t segbuf_data_length | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::segment_data, and segment_buffer_t::segment_end.

Referenced by segbuf_decode_object(), and segbuf_decode_palette().

## ◆ segbuf_decode_composition_descriptor()

static int segbuf_decode_composition_descriptor | ( | segment_buffer_t * | buf,
|  | composition_descriptor_t * | descr )
| static

References segment_buffer_t::error, composition_descriptor_s::number, segbuf_get_u16(), segbuf_get_u8(), composition_descriptor_s::state, and XINE_HDMV_TRACE.

Referenced by segbuf_decode_presentation_segment().

## ◆ segbuf_decode_composition_object()

static composition_object_t * segbuf_decode_composition_object | ( | segment_buffer_t * | buf | ) |
| static

References composition_object_s::crop_height, composition_object_s::crop_horiz_pos, composition_object_s::crop_vert_pos, composition_object_s::crop_width, composition_object_s::cropped_flag, segment_buffer_t::error, composition_object_s::forced_flag, NULL, composition_object_s::object_id_ref, segbuf_get_u16(), segbuf_get_u8(), composition_object_s::window_id_ref, XINE_HDMV_TRACE, composition_object_s::xpos, and composition_object_s::ypos.

Referenced by segbuf_decode_presentation_segment().

## ◆ segbuf_decode_object()

static subtitle_object_t * segbuf_decode_object | ( | segment_buffer_t * | buf,
|  | subtitle_object_t * | objects )
| static

References _x_freep(), subtitle_object_s::data_len, segment_buffer_t::error, free_subtitle_object(), subtitle_object_s::height, subtitle_object_s::id, MAX, subtitle_object_s::next, NULL, subtitle_object_s::raw_data, subtitle_object_s::raw_data_len, subtitle_object_s::raw_data_size, segbuf_data_length(), segbuf_decode_rle(), segbuf_get_u16(), segbuf_get_u24(), segbuf_get_u8(), segment_buffer_t::segment_data, subtitle_object_s::width, and XINE_HDMV_TRACE.

Referenced by decode_object().

## ◆ segbuf_decode_palette()

static subtitle_clut_t * segbuf_decode_palette | ( | segment_buffer_t * | buf | ) |
| static

References _X_SET_CLUT_CM, subtitle_clut_s::color, segment_buffer_t::error, subtitle_clut_s::id, NULL, segbuf_data_length(), segbuf_get_u8(), subtitle_clut_s::trans, and XINE_HDMV_TRACE.

Referenced by decode_palette().

## ◆ segbuf_decode_presentation_segment()

static presentation_segment_t * segbuf_decode_presentation_segment | ( | segment_buffer_t * | buf | ) |
| static

References presentation_segment_s::comp_descr, presentation_segment_s::comp_objs, segment_buffer_t::error, free_presentation_segment(), composition_object_s::next, NULL, presentation_segment_s::object_number, presentation_segment_s::palette_id_ref, presentation_segment_s::palette_update_flag, segbuf_decode_composition_descriptor(), segbuf_decode_composition_object(), segbuf_decode_video_descriptor(), segbuf_get_u8(), and XINE_HDMV_TRACE.

Referenced by decode_presentation_segment().

## ◆ segbuf_decode_rle()

static int segbuf_decode_rle | ( | segment_buffer_t * | buf,
|  | subtitle_object_t * | obj )
| static

References rle_elem_s::color, subtitle_object_s::data_size, segment_buffer_t::error, height, subtitle_object_s::height, rle_elem_s::len, subtitle_object_s::num_rle, subtitle_object_s::rle, rle_size, segbuf_get_u8(), subtitle_object_s::width, and width.

Referenced by segbuf_decode_object().

## ◆ segbuf_decode_video_descriptor()

static int segbuf_decode_video_descriptor | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::error, height, segbuf_get_u16(), segbuf_get_u8(), width, and XINE_HDMV_TRACE.

Referenced by segbuf_decode_presentation_segment().

## ◆ segbuf_decode_window_definition()

static window_def_t * segbuf_decode_window_definition | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::error, window_def_s::height, window_def_s::id, NULL, segbuf_get_u16(), segbuf_get_u8(), window_def_s::width, XINE_HDMV_TRACE, window_def_s::xpos, and window_def_s::ypos.

Referenced by decode_window_definition().

## ◆ segbuf_dispose()

static void segbuf_dispose | ( | segment_buffer_t * | buf | ) |
| static

References _x_freep(), and segment_buffer_t::buf.

Referenced by spudec_dispose().

## ◆ segbuf_fill()

static void segbuf_fill | ( | segment_buffer_t * | buf,
|  | uint8_t * | data,
|  | size_t | len )
| static

References segment_buffer_t::buf, segment_buffer_t::data_size, segment_buffer_t::len, and segbuf_parse_segment_header().

Referenced by spudec_decode_data().

## ◆ segbuf_get_u16()

static uint16_t segbuf_get_u16 | ( | segment_buffer_t * | buf | ) |
| static

References segbuf_get_u8().

Referenced by segbuf_decode_composition_descriptor(), segbuf_decode_composition_object(), segbuf_decode_object(), segbuf_decode_video_descriptor(), and segbuf_decode_window_definition().

## ◆ segbuf_get_u24()

static uint32_t segbuf_get_u24 | ( | segment_buffer_t * | buf | ) |
| static

References segbuf_get_u8().

Referenced by segbuf_decode_object().

## ◆ segbuf_get_u8()

static uint8_t segbuf_get_u8 | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::error, segment_buffer_t::segment_data, segment_buffer_t::segment_end, and XINE_HDMV_TRACE.

Referenced by segbuf_decode_composition_descriptor(), segbuf_decode_composition_object(), segbuf_decode_object(), segbuf_decode_palette(), segbuf_decode_presentation_segment(), segbuf_decode_rle(), segbuf_decode_video_descriptor(), segbuf_decode_window_definition(), segbuf_get_u16(), and segbuf_get_u24().

## ◆ segbuf_init()

static segment_buffer_t * segbuf_init | ( | void |  | ) |
| static

Referenced by open_plugin().

## ◆ segbuf_parse_segment_header()

static void segbuf_parse_segment_header | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::buf, segment_buffer_t::error, segment_buffer_t::len, segbuf_reset(), segment_buffer_t::segment_data, segment_buffer_t::segment_end, segment_buffer_t::segment_len, segment_buffer_t::segment_type, and XINE_HDMV_TRACE.

Referenced by segbuf_fill(), and segbuf_skip_segment().

## ◆ segbuf_reset()

static void segbuf_reset | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::buf, segment_buffer_t::error, segment_buffer_t::len, segment_buffer_t::segment_data, segment_buffer_t::segment_end, segment_buffer_t::segment_len, and segment_buffer_t::segment_type.

Referenced by segbuf_parse_segment_header(), and spudec_reset().

## ◆ segbuf_segment_complete()

static int segbuf_segment_complete | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::len, and segment_buffer_t::segment_len.

Referenced by segbuf_skip_segment(), and spudec_decode_data().

## ◆ segbuf_segment_type()

static uint8_t segbuf_segment_type | ( | segment_buffer_t * | buf | ) |
| static

References segment_buffer_t::segment_type.

Referenced by decode_segment().

## ◆ segbuf_skip_segment()

static void segbuf_skip_segment | ( | segment_buffer_t * | buf | ) |
| static

References _x_assert, segment_buffer_t::buf, segment_buffer_t::len, segbuf_parse_segment_header(), segbuf_segment_complete(), segment_buffer_t::segment_len, and XINE_HDMV_TRACE.

Referenced by spudec_decode_data().

## ◆ show_overlay()

static int show_overlay | ( | spuhdmv_decoder_t * | this,
|  | composition_object_t * | cobj,
|  | unsigned int | palette_id_ref,
|  | int | overlay_index,
|  | int64_t | pts,
|  | int | force_update )
| static

References video_overlay_manager_s::add_event, subtitle_clut_s::color, vo_overlay_s::color, copy_crop_rle(), vo_overlay_s::data_size, video_overlay_manager_s::get_handle, metronom_s::got_spu_packet, subtitle_object_s::height, vo_overlay_s::height, vo_overlay_s::hili_bottom, vo_overlay_s::hili_left, vo_overlay_s::hili_right, vo_overlay_s::hili_top, subtitle_clut_s::id, subtitle_object_s::id, window_def_s::id, subtitle_clut_s::next, subtitle_object_s::next, window_def_s::next, subtitle_object_s::num_rle, vo_overlay_s::num_rle, composition_object_s::object_id_ref, OVERLAY_EVENT_SHOW, vo_overlay_s::rgb_clut, subtitle_object_s::rle, vo_overlay_s::rle, composition_object_s::shown, subtitle_clut_s::shown, subtitle_object_s::shown, window_def_s::shown, subtitle_clut_s::trans, vo_overlay_s::trans, vo_overlay_s::unscaled, video_overlay_event_s::vpts, subtitle_object_s::width, vo_overlay_s::width, composition_object_s::window_id_ref, vo_overlay_s::x, XINE_HDMV_TRACE, composition_object_s::xpos, vo_overlay_s::y, and composition_object_s::ypos.

Referenced by update_overlays().

## ◆ spudec_decode_data()

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

References BUF_SPU_HDMV, buf_element_s::content, decode_segment(), buf_element_s::pts, spu_decoder_s::reset, segbuf_fill(), segbuf_segment_complete(), segbuf_skip_segment(), buf_element_s::size, buf_element_s::type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ spudec_discontinuity()

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

References close_osd().

Referenced by open_plugin().

## ◆ spudec_dispose()

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

References close_osd(), free_objs(), and segbuf_dispose().

Referenced by open_plugin().

## ◆ spudec_reset()

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

References close_osd(), free_objs(), and segbuf_reset().

Referenced by open_plugin().

## ◆ update_overlays()

static void update_overlays | ( | spuhdmv_decoder_t * | this | ) |
| static

References presentation_segment_s::comp_objs, hide_overlays(), LOG_MODULE, composition_object_s::next, presentation_segment_s::next, presentation_segment_s::object_number, presentation_segment_s::palette_id_ref, presentation_segment_s::pts, show_overlay(), presentation_segment_s::shown, XINE_VERBOSITY_LOG, and xprintf.

Referenced by decode_segment().

## Variable Documentation

## ◆ dec_info_data

const decoder_info_t dec_info_data
| static

Initial value:
= {
.supported_types = supported_types,
.priority = 5,
}
supported_types
static const uint32_t supported_types[]
Definition spuhdmv_decoder.c:1112

## ◆ []

enum { ... } eSegmentType

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_SPU_DECODER, 17, "spuhdmv", XINE_VERSION_CODE, &dec_info_data, &init_plugin },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
dec_info_data
static const decoder_info_t dec_info_data
Definition spuhdmv_decoder.c:1114
init_plugin
static void * init_plugin(xine_t *xine, const void *data)
Definition spuhdmv_decoder.c:1097
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

## ◆ supported_types

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