xine-lib  1.2.9
demux.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2000-2017 the xine project
3  *
4  * This file is part of xine, a free video player.
5  *
6  * xine is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * xine is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19  */
20 
21 #ifndef HAVE_DEMUX_H
22 #define HAVE_DEMUX_H
23 
24 #include <xine/input_plugin.h>
25 #include <xine/buffer.h>
26 #include <xine/xine_internal.h>
27 
28 #ifdef XINE_COMPILE
29 # include <xine/plugin_catalog.h>
30 #endif
31 
32 #define DEMUXER_PLUGIN_IFACE_VERSION 27
33 
34 #define DEMUX_OK 0
35 #define DEMUX_FINISHED 1
36 
37 #define DEMUX_CANNOT_HANDLE 0
38 #define DEMUX_CAN_HANDLE 1
39 
40 #define METHOD_BY_CONTENT 1
41 #define METHOD_BY_MRL 2
42 #define METHOD_EXPLICIT 3
43 
44 typedef struct demux_class_s demux_class_t ;
46 
47 struct demux_class_s {
48 
49  /*
50  * open a new instance of this plugin class
51  */
52  demux_plugin_t* (*open_plugin) (demux_class_t *this_gen, xine_stream_t *stream, input_plugin_t *input);
53 
57  const char *identifier;
58 
64  const char *description;
65 
69  const char *text_domain;
70 
75  const char* mimetypes;
76 
83  const char* extensions;
84 
85  /*
86  * close down, free all resources
87  */
88  void (*dispose) (demux_class_t *this_gen);
89 };
90 
91 #define default_demux_class_dispose (void (*) (demux_class_t *this_gen))free
92 
93 /*
94  * any demux plugin must implement these functions
95  */
96 
98 
99  /*
100  * send headers, followed by BUF_CONTROL_HEADERS_DONE down the
101  * fifos, then return. do not start demux thread (yet)
102  */
103 
104  void (*send_headers) (demux_plugin_t *this_gen);
105 
106  /*
107  * ask demux to seek
108  *
109  * for seekable streams, a start position can be specified
110  *
111  * start_pos : position in input source (0..65535)
112  * this is defined as most convenient to demuxer, can be
113  * either time or offset based.
114  * start_time : position measured in miliseconds from stream start
115  * playing : true if this is a new seek within an already playing stream
116  * false if playback of this stream has not started yet
117  *
118  * if both parameters are !=0 start_pos will be used
119  * for non-seekable streams both values will be ignored
120  *
121  * returns the demux status (like get_status, but immediately after
122  * starting the demuxer)
123  */
124 
125  int (*seek) (demux_plugin_t *this_gen,
126  off_t start_pos, int start_time, int playing );
127 
128  /*
129  * send a chunk of data down to decoder fifos
130  *
131  * the meaning of "chunk" is specific to every demux, usually
132  * it involves parsing one unit of data from stream.
133  *
134  * this function will be called from demux loop and should return
135  * the demux current status
136  */
137 
138  int (*send_chunk) (demux_plugin_t *this_gen);
139 
140  /*
141  * free resources
142  */
143 
144  void (*dispose) (demux_plugin_t *this_gen) ;
145 
146  /*
147  * returns DEMUX_OK or DEMUX_FINISHED
148  */
149 
150  int (*get_status) (demux_plugin_t *this_gen) ;
151 
152  /*
153  * gets stream length in miliseconds (might be estimated)
154  * may return 0 for non-seekable streams
155  */
156 
157  int (*get_stream_length) (demux_plugin_t *this_gen);
158 
159  /*
160  * return capabilities of demuxed stream
161  */
162 
163  uint32_t (*get_capabilities) (demux_plugin_t *this_gen);
164 
165  /*
166  * request optional data from input plugin.
167  */
168  int (*get_optional_data) (demux_plugin_t *this_gen, void *data, int data_type);
169 
170  /*
171  * "backwards" link to plugin class
172  */
173 
175 
182 #ifdef XINE_COMPILE
184 #else
185  void *node;
186 #endif
187 } ;
188 
189 #define default_demux_plugin_dispose (void (*) (demux_plugin_t *this_gen))free
190 
191 /*
192  * possible capabilites a demux plugin can have:
193  */
194 #define DEMUX_CAP_NOCAP 0x00000000
195 
196 /*
197  * DEMUX_CAP_AUDIOLANG:
198  * DEMUX_CAP_SPULANG:
199  * demux plugin knows something about audio/spu languages,
200  * e.g. knows that audio stream #0 is english,
201  * audio stream #1 is german, ... Same bits as INPUT
202  * capabilities .
203  */
204 
205 #define DEMUX_CAP_AUDIOLANG 0x00000008
206 #define DEMUX_CAP_SPULANG 0x00000010
207 
208 /*
209  * DEMUX_CAP_CHAPTERS:
210  * The media streams provided by this plugin have an internal
211  * structure dividing it into segments usable for navigation.
212  * For those plugins, the behaviour of the skip button in UIs
213  * should be changed from "next MRL" to "next chapter" by
214  * sending XINE_EVENT_INPUT_NEXT.
215  * Same bits as INPUT capabilities.
216  */
217 
218 #define DEMUX_CAP_CHAPTERS 0x00000080
219 
220 
221 #define DEMUX_OPTIONAL_UNSUPPORTED 0
222 #define DEMUX_OPTIONAL_SUCCESS 1
223 
224 #define DEMUX_OPTIONAL_DATA_AUDIOLANG 2
225 #define DEMUX_OPTIONAL_DATA_SPULANG 3
226 
227 #endif
const char * extensions
space separated list of file extensions this demuxer is likely to handle
Definition: demux.h:83
int(* get_status)(demux_plugin_t *this_gen)
Definition: demux.h:150
int(* get_optional_data)(demux_plugin_t *this_gen, void *data, int data_type)
Definition: demux.h:168
const char * text_domain
Optional non-standard catalog to use with dgettext() for description.
Definition: demux.h:69
Definition: plugin_catalog.h:44
plugin_node_t * node
Pointer to the loaded plugin node.
Definition: demux.h:183
Definition: demux.h:97
int(* seek)(demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
Definition: demux.h:125
void(* dispose)(demux_class_t *this_gen)
Definition: demux.h:88
void(* dispose)(demux_plugin_t *this_gen)
Definition: demux.h:144
Definition: xine_internal.h:210
const char * identifier
short human readable identifier for this plugin class
Definition: demux.h:57
Definition: demux.h:47
static int input(void)
Definition: goomsl_lex.c:1495
Definition: input_plugin.h:92
int(* send_chunk)(demux_plugin_t *this_gen)
Definition: demux.h:138
int(* get_stream_length)(demux_plugin_t *this_gen)
Definition: demux.h:157
const char * description
human readable (verbose = 1 line) description for this plugin class
Definition: demux.h:64
const char * mimetypes
MIME types supported for this plugin.
Definition: demux.h:75
demux_class_t * demux_class
Definition: demux.h:174
uint32_t(* get_capabilities)(demux_plugin_t *this_gen)
Definition: demux.h:163
void(* send_headers)(demux_plugin_t *this_gen)
Definition: demux.h:104