xine-lib: xine-lib-1.2.13/include/xine/spu_decoder.h Source File

xine-lib 1.2.13-20230125hg15249

spu_decoder.h
Go to the documentation of this file.
1/*
2 * spu_decoder_api.h
3 *
4 * Copyright (C) James Courtier-Dutton James@superbug.demon.co.uk - July 2001
5 *
6 * This file is part of xine, a unix video player.
7 *
8 * xine is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * xine is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with GNU Make; see the file COPYING. If not, write to
20 * the Free Software Foundation,
21 *
22 */
23
24#ifndef HAVE_SPU_API_H
25#define HAVE_SPU_API_H
26
27#include <xine/attributes.h>
28#include <xine/os_types.h>
29#include <xine/buffer.h>
30
31struct plugin_node_s;
32
33#define SPU_DECODER_IFACE_VERSION 17
34
35/*
36 * generic xine spu decoder plugin interface
37 */
38
39 typedef struct spu_decoder_class_s spu_decoder_class_t;
40 typedef struct spu_decoder_s spu_decoder_t;
41
42 struct spu_decoder_class_s {
43
44 /*
45 * open a new instance of this plugin class
46 */
47 spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this_gen, xine_stream_t *stream);
48
52 const char *identifier;
53
59 const char *description;
60
64 const char *text_domain;
65
66 /*
67 * free all class-related resources
68 */
69 void (*dispose) (spu_decoder_class_t *this_gen);
70};
71
72#define default_spu_decoder_class_dispose (void (*) (spu_decoder_class_t *this_gen))free
73
74 struct spu_decoder_s {
75
76 /*
77 * decode data from buf and feed the overlay to overlay manager
78 */
79 void (*decode_data) (spu_decoder_t *this_gen, buf_element_t *buf);
80
81 /*
82 * reset decoder after engine flush (prepare for new
83 * SPU data not related to recently decoded data)
84 */
85 void (*reset) (spu_decoder_t *this_gen);
86
87 /*
88 * inform decoder that a time reference discontinuity has happened.
89 * that is, it must forget any currently held pts value
90 */
91 void (*discontinuity) (spu_decoder_t *this_gen);
92
93 /*
94 * close down, free all resources
95 */
96 void (*dispose) (spu_decoder_t *this_gen);
97
98 /*
99 * When the SPU decoder also handles data used in user interaction,
100 * you can query the related information here. The typical example
101 * for this is DVD NAV packets which are handled by the SPU decoder
102 * and can be received readily parsed from here.
103 * The caller and the decoder must agree on the structure which is
104 * passed here.
105 * This function pointer may be NULL, if the plugin does not have
106 * such functionality.
107 */
108 int (*get_interact_info) (spu_decoder_t *this_gen, void *data);
109
110 /*
111 * When the SPU decoder also handles menu overlays for user inter-
112 * action, you can set a menu button here. The typical example for
113 * this is DVD menus.
114 * This function pointer may be NULL, if the plugin does not have
115 * such functionality.
116 */
117 void (*set_button) (spu_decoder_t *this_gen, int32_t button, int32_t mode);
118
125 struct plugin_node_s *node XINE_PRIVATE_FIELD;
126};
127
128
129/* SPU decoders differ from video and audio decoders in one significant
130 * way: unlike audio and video, SPU streams are not continuous;
131 * this results in another difference, programmers have to consider:
132 * while both audio and video decoders are automatically blocked in
133 * their get_buffer()/get_frame() methods when the output cannot take
134 * any more data, this does not work for SPU, because it could take
135 * minutes before the next free slot becomes available and we must not
136 * block the decoder thread for that long;
137 * therefore, we provide a convenience function for SPU decoders which
138 * implements a wait until a timestamp sufficiently close to the VPTS
139 * of the next SPU is reached, but the waiting will end before that,
140 * if some outside condition requires us to release the decoder thread
141 * to other tasks;
142 * if this functions returns with 1, noone needs the decoder thread and
143 * you may continue waiting; if it returns 0, finish whatever you are
144 * doing and return;
145 * the usual pattern for SPU decoders is this:
146 *
147 * do {
148 * spu = prepare_spu();
149 * int thread_vacant = _x_spu_decoder_sleep(this->stream, spu->vpts);
150 * int success = process_spu(spu);
151 * } while (!success && thread_vacant);
152 */
153int _x_spu_decoder_sleep(xine_stream_t *, int64_t next_spu_vpts) XINE_PROTECTED;
154
155#endif /* HAVE_SPUDEC_H */
buffer.h
attributes.h
XINE_PROTECTED
#define XINE_PROTECTED
Definition attributes.h:75
os_types.h
_x_spu_decoder_sleep
int _x_spu_decoder_sleep(xine_stream_t *, int64_t next_spu_vpts)
Definition video_decoder.c:70
buf_element_s
Definition buffer.h:338
plugin_node_s
Definition plugin_catalog.h:44
spu_decoder_class_s
Definition spu_decoder.h:42
spu_decoder_class_s::dispose
void(* dispose)(spu_decoder_class_t *this_gen)
Definition spu_decoder.h:69
spu_decoder_class_s::description
const char * description
human readable (verbose = 1 line) description for this plugin class
Definition spu_decoder.h:59
spu_decoder_class_s::identifier
const char * identifier
short human readable identifier for this plugin class
Definition spu_decoder.h:52
spu_decoder_class_s::text_domain
const char * text_domain
Optional non-standard catalog to use with dgettext() for description.
Definition spu_decoder.h:64
spu_decoder_s
Definition spu_decoder.h:74
spu_decoder_s::discontinuity
void(* discontinuity)(spu_decoder_t *this_gen)
Definition spu_decoder.h:91
spu_decoder_s::set_button
void(* set_button)(spu_decoder_t *this_gen, int32_t button, int32_t mode)
Definition spu_decoder.h:117
spu_decoder_s::dispose
void(* dispose)(spu_decoder_t *this_gen)
Definition spu_decoder.h:96
spu_decoder_s::reset
void(* reset)(spu_decoder_t *this_gen)
Definition spu_decoder.h:85
spu_decoder_s::decode_data
void(* decode_data)(spu_decoder_t *this_gen, buf_element_t *buf)
Definition spu_decoder.h:79
spu_decoder_s::get_interact_info
int(* get_interact_info)(spu_decoder_t *this_gen, void *data)
Definition spu_decoder.h:108
spu_decoder_s::XINE_PRIVATE_FIELD
struct plugin_node_s *node XINE_PRIVATE_FIELD
Pointer to the loaded plugin node.
Definition spu_decoder.h:125
xine_stream_s
Definition xine_internal.h:123
mode
enable disable number of frames of telecine pattern sync required before mode change make frames evenly spaced for film mode(24 fps)" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL