xine-lib  1.2.9
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/os_types.h>
28 #include <xine/buffer.h>
29 
30 #ifdef XINE_COMPILE
31 # include <xine/plugin_catalog.h>
32 #endif
33 
34 #define SPU_DECODER_IFACE_VERSION 17
35 
36 /*
37  * generic xine spu decoder plugin interface
38  */
39 
42 
44 
45  /*
46  * open a new instance of this plugin class
47  */
48  spu_decoder_t* (*open_plugin) (spu_decoder_class_t *this_gen, xine_stream_t *stream);
49 
53  const char *identifier;
54 
60  const char *description;
61 
65  const char *text_domain;
66 
67  /*
68  * free all class-related resources
69  */
70  void (*dispose) (spu_decoder_class_t *this_gen);
71 };
72 
73 #define default_spu_decoder_class_dispose (void (*) (spu_decoder_class_t *this_gen))free
74 
75 struct spu_decoder_s {
76 
77  /*
78  * decode data from buf and feed the overlay to overlay manager
79  */
80  void (*decode_data) (spu_decoder_t *this_gen, buf_element_t *buf);
81 
82  /*
83  * reset decoder after engine flush (prepare for new
84  * SPU data not related to recently decoded data)
85  */
86  void (*reset) (spu_decoder_t *this_gen);
87 
88  /*
89  * inform decoder that a time reference discontinuity has happened.
90  * that is, it must forget any currently held pts value
91  */
92  void (*discontinuity) (spu_decoder_t *this_gen);
93 
94  /*
95  * close down, free all resources
96  */
97  void (*dispose) (spu_decoder_t *this_gen);
98 
99  /*
100  * When the SPU decoder also handles data used in user interaction,
101  * you can query the related information here. The typical example
102  * for this is DVD NAV packets which are handled by the SPU decoder
103  * and can be received readily parsed from here.
104  * The caller and the decoder must agree on the structure which is
105  * passed here.
106  * This function pointer may be NULL, if the plugin does not have
107  * such functionality.
108  */
109  int (*get_interact_info) (spu_decoder_t *this_gen, void *data);
110 
111  /*
112  * When the SPU decoder also handles menu overlays for user inter-
113  * action, you can set a menu button here. The typical example for
114  * this is DVD menus.
115  * This function pointer may be NULL, if the plugin does not have
116  * such functionality.
117  */
118  void (*set_button) (spu_decoder_t *this_gen, int32_t button, int32_t mode);
119 
126 #ifdef XINE_COMPILE
128 #else
129  void *node;
130 #endif
131 };
132 
133 
134 /* SPU decoders differ from video and audio decoders in one significant
135  * way: unlike audio and video, SPU streams are not continuous;
136  * this results in another difference, programmers have to consider:
137  * while both audio and video decoders are automatically blocked in
138  * their get_buffer()/get_frame() methods when the output cannot take
139  * any more data, this does not work for SPU, because it could take
140  * minutes before the next free slot becomes available and we must not
141  * block the decoder thread for that long;
142  * therefore, we provide a convenience function for SPU decoders which
143  * implements a wait until a timestamp sufficiently close to the VPTS
144  * of the next SPU is reached, but the waiting will end before that,
145  * if some outside condition requires us to release the decoder thread
146  * to other tasks;
147  * if this functions returns with 1, noone needs the decoder thread and
148  * you may continue waiting; if it returns 0, finish whatever you are
149  * doing and return;
150  * the usual pattern for SPU decoders is this:
151  *
152  * do {
153  * spu = prepare_spu();
154  * int thread_vacant = _x_spu_decoder_sleep(this->stream, spu->vpts);
155  * int success = process_spu(spu);
156  * } while (!success && thread_vacant);
157  */
158 int _x_spu_decoder_sleep(xine_stream_t *, int64_t next_spu_vpts) XINE_PROTECTED;
159 
160 #endif /* HAVE_SPUDEC_H */
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
int _x_spu_decoder_sleep(xine_stream_t *, int64_t next_spu_vpts)
Definition: video_decoder.c:68
void(* dispose)(spu_decoder_t *this_gen)
Definition: spu_decoder.h:97
Definition: buffer.h:334
void(* reset)(spu_decoder_t *this_gen)
Definition: spu_decoder.h:86
const char * text_domain
Optional non-standard catalog to use with dgettext() for description.
Definition: spu_decoder.h:65
Definition: plugin_catalog.h:44
const char * identifier
short human readable identifier for this plugin class
Definition: spu_decoder.h:53
void(* dispose)(spu_decoder_class_t *this_gen)
Definition: spu_decoder.h:70
void(* decode_data)(spu_decoder_t *this_gen, buf_element_t *buf)
Definition: spu_decoder.h:80
Definition: spu_decoder.h:75
Definition: xine_internal.h:210
void(* discontinuity)(spu_decoder_t *this_gen)
Definition: spu_decoder.h:92
const char * description
human readable (verbose = 1 line) description for this plugin class
Definition: spu_decoder.h:60
int(* get_interact_info)(spu_decoder_t *this_gen, void *data)
Definition: spu_decoder.h:109
Definition: spu_decoder.h:43
void(* set_button)(spu_decoder_t *this_gen, int32_t button, int32_t mode)
Definition: spu_decoder.h:118
#define XINE_PROTECTED
Definition: attributes.h:73
plugin_node_t * node
Pointer to the loaded plugin node.
Definition: spu_decoder.h:127