xine-lib 1.2.11
xine_internal.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2019 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_XINE_INTERNAL_H
22#define HAVE_XINE_INTERNAL_H
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28/*
29 * include public part of xine header
30 */
31
32#include <xine.h>
33#include <xine/tickets.h>
34#include <xine/refcounter.h>
35#include <xine/input_plugin.h>
36#include <xine/demux.h>
37#include <xine/video_out.h>
38#include <xine/audio_out.h>
39#include <xine/metronom.h>
40#include <xine/osd.h>
41#include <xine/xineintl.h>
42#include <xine/plugin_catalog.h>
43#include <xine/video_decoder.h>
44#include <xine/audio_decoder.h>
45#include <xine/spu_decoder.h>
46#include <xine/scratch.h>
47#include <xine/broadcaster.h>
48#include <xine/io_helper.h>
49#include <xine/info_helper.h>
50#include <xine/alphablend.h>
51
52#define XINE_MAX_EVENT_LISTENERS 50
53#define XINE_MAX_EVENT_TYPES 100
54#define XINE_MAX_TICKET_HOLDER_THREADS 64
55
56/* used by plugin loader */
57#define XINE_VERSION_CODE XINE_MAJOR_VERSION*10000+XINE_MINOR_VERSION*100+XINE_SUB_VERSION
58
59
60/*
61 * log constants
62 */
63
64#define XINE_LOG_MSG 0 /* warnings, errors, ... */
65#define XINE_LOG_PLUGIN 1
66#define XINE_LOG_TRACE 2
67#define XINE_LOG_NUM 3 /* # of log buffers defined */
68
69#define XINE_STREAM_INFO_MAX 99
70
71/*
72 * the "big" xine struct, holding everything together
73 */
74
75#ifndef XDG_BASEDIR_H
76/* present here for internal convenience only */
77typedef struct { void *reserved; } xdgHandle;
78#endif
79
80struct xine_s {
81
83
85
87
89 const char *save_path;
90
91 /* log output that may be presented to the user */
93
95 pthread_mutex_t streams_lock;
96
98
101};
102
103/*
104 * xine event queue
105 */
106
109 pthread_mutex_t lock;
110 pthread_cond_t new_event;
111 pthread_cond_t events_processed;
113 pthread_t *listener_thread;
117};
118
119/*
120 * xine_stream - per-stream parts of the xine engine
121 */
122
124
125 /* reference to xine context */
127
128 /* metronom instance used by current stream */
130
131 /* demuxers use input_plugin to read data */
133
134 /* used by video decoders, may change by port rewire */
136
137 /* demuxers send data to video decoders using this fifo */
139
140 /* used by audio decoders, may change by port rewire */
142
143 /* demuxers send data to audio decoders using this fifo */
145
146 /* provide access to osd api */
148
149 /* master/slave streams */
150 xine_stream_t *master; /* usually a pointer to itself */
152
153 /* input_dvd uses this one. is it possible to add helper functions instead? */
155
156 /* dxr3 use this one, should be possible to fix to use the port instead */
158
159 /* these definitely should be made private! */
166
167 /* current content detection method, see METHOD_BY_xxx */
169};
170
171/* when explicitly noted, some functions accept an anonymous stream,
172 * which is a valid stream that does not want to be addressed. */
173#define XINE_ANON_STREAM ((xine_stream_t *)-1)
174
175typedef struct
176{
177 int total;
178 int ready;
179 int avail;
180}
182
183typedef struct
184{
189}
191
192/*
193 * private function prototypes:
194 */
195
198int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *num_audio_buffers, int *num_video_frames, int *num_audio_frames) XINE_PROTECTED;
199int _x_lock_port_rewiring(xine_t *xine, int ms_to_time_out) XINE_PROTECTED;
201int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out) XINE_PROTECTED;
204int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing) XINE_PROTECTED;
208
209void _x_handle_stream_end (xine_stream_t *stream, int non_user) XINE_PROTECTED;
210
211/* report message to UI. usually these are async errors */
212
213int _x_message(xine_stream_t *stream, int type, ...) XINE_SENTINEL XINE_PROTECTED;
214
215/* flush the message queues */
216
218
219/* extra_info operations */
221
223
224void _x_get_current_info (xine_stream_t *stream, extra_info_t *extra_info, int size) XINE_PROTECTED;
225
226
234
242
243
244/* demuxer helper functions from demux.c */
245
246/*
247 * Flush audio and video buffers. It is called from demuxers on
248 * seek/stop, and may be useful when user input changes a stream and
249 * xine-lib has cached buffers that have yet to be played.
250 *
251 * warning: after clearing decoders fifos an absolute discontinuity
252 * indication must be sent. relative discontinuities are likely
253 * to cause "jumps" on metronom.
254 */
256
257void _x_demux_control_nop (xine_stream_t *stream, uint32_t flags) XINE_PROTECTED;
258void _x_demux_control_newpts (xine_stream_t *stream, int64_t pts, uint32_t flags) XINE_PROTECTED;
261void _x_demux_control_end (xine_stream_t *stream, uint32_t flags) XINE_PROTECTED;
264int _x_demux_read_header (input_plugin_t *input, void *buffer, off_t size) XINE_PROTECTED;
265int _x_demux_check_extension (const char *mrl, const char *extensions);
266
267off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED;
268
270
273
274void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size,
275 int64_t pts, uint32_t type, uint32_t decoder_flags,
276 int input_normpos, int input_time, int total_time,
277 uint32_t frame_number) XINE_PROTECTED;
278
280 int size, int64_t pts, uint32_t type,
281 uint32_t decoder_flags, off_t input_normpos,
282 int input_time, int total_time,
283 uint32_t frame_number) XINE_USED XINE_PROTECTED;
284
285void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative,
286 const char *mrl, const char *title,
287 int start_time, int duration) XINE_PROTECTED;
288
289/*
290 * MRL escaped-character decoding (overwrites the source string)
291 */
292void _x_mrl_unescape(char *mrl) XINE_PROTECTED;
293
294/*
295 * Return a copy of mrl without authentication credentials
296 */
297char *_x_mrl_remove_auth(const char *mrl) XINE_PROTECTED;
298
299/*
300 * plugin_loader functions
301 *
302 */
303
304/* allow input plugins to use other input plugins */
307
308/* on-demand loading of generic modules / sub-plugins */
309struct xine_module_s; /* xine_module.h */
310struct xine_module_s *_x_find_module(xine_t *xine, const char *type, const char *id, unsigned sub_type, const void *params) XINE_PROTECTED;
311void _x_free_module(xine_t *xine, struct xine_module_s **pmodule) XINE_PROTECTED;
312
313/* on-demand loading of audio/video/spu decoder plugins */
314
319spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) XINE_PROTECTED;
321/* check for decoder availability - but don't try to initialize it */
322int _x_decoder_available (xine_t *xine, uint32_t buftype) XINE_PROTECTED;
323
324/* on-demand loading of demux plugins */
328
329/*
330 * load_video_output_plugin
331 *
332 * load a specific video output plugin
333 */
334
336 const char *id, int visual_type,
337 const void *visual) XINE_PROTECTED;
338
339/*
340 * audio output plugin dynamic loading stuff
341 */
342
343/*
344 * load_audio_output_plugin
345 *
346 * load a specific audio output plugin
347 */
348
350
351
352void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED;
353
355
356/* set when pauseing with port ticket granted, for XINE_PARAM_VO_SINGLE_STEP. */
357/* special values for fine speed. */
358# define XINE_LIVE_PAUSE_ON 0x7ffffffd
359# define XINE_LIVE_PAUSE_OFF 0x7ffffffc
360void _x_set_fine_speed (xine_stream_t *stream, int speed) XINE_PROTECTED;
361
363
364void _x_select_spu_channel (xine_stream_t *stream, int channel) XINE_PROTECTED;
365
367
369
371
372/*
373 * internal events
374 */
375
376/* sent by dvb frontend to inform ts demuxer of new pids */
377#define XINE_EVENT_PIDS_CHANGE 0x80000000
378/* sent by BluRay input plugin to inform ts demuxer about end of clip */
379#define XINE_EVENT_END_OF_CLIP 0x80000001
380
381/*
382 * pids change event - inform ts demuxer of new pids
383 */
384typedef struct {
385 int vpid; /* video program id */
386 int apid; /* audio program id */
388
389#ifdef __cplusplus
390}
391#endif
392
393#endif
394
static int input(void)
Definition: goomsl_lex.c:1495
#define XINE_USED
Definition: attributes.h:60
#define XINE_PROTECTED
Definition: attributes.h:75
#define XINE_SENTINEL
Definition: attributes.h:81
const char name[16]
Definition: memcpy.c:570
Definition: audio_out.h:43
Definition: audio_decoder.h:73
Definition: configfile.h:83
Definition: demux.h:96
Structure to pass information from input or demuxer plugins to output frames (past decoder).
Definition: buffer.h:318
Definition: buffer.h:583
Definition: input_plugin.h:90
Definition: metronom.h:199
Definition: metronom.h:71
Definition: osd.h:82
Definition: plugin_catalog.h:53
Definition: scratch.h:35
Definition: spu_decoder.h:74
Definition: video_decoder.h:73
Definition: video_out.h:50
Definition: xine_internal.h:77
void * reserved
Definition: xine_internal.h:77
Definition: audio_out.h:172
Definition: xine_internal.h:107
pthread_cond_t events_processed
Definition: xine_internal.h:111
pthread_t * listener_thread
Definition: xine_internal.h:113
pthread_mutex_t lock
Definition: xine_internal.h:109
xine_list_t * events
Definition: xine_internal.h:108
pthread_cond_t new_event
Definition: xine_internal.h:110
xine_stream_t * stream
Definition: xine_internal.h:112
void * user_data
Definition: xine_internal.h:114
int callback_running
Definition: xine_internal.h:116
xine_event_listener_cb_t callback
Definition: xine_internal.h:115
Definition: xine.h:244
Definition: list.c:51
Definition: xine_module.h:62
Definition: xine_internal.h:384
int vpid
Definition: xine_internal.h:385
int apid
Definition: xine_internal.h:386
Definition: xine_internal.h:176
int avail
Definition: xine_internal.h:179
int total
Definition: xine_internal.h:177
int ready
Definition: xine_internal.h:178
Definition: xine_internal.h:184
xine_query_buffers_data_t vi
Definition: xine_internal.h:185
xine_query_buffers_data_t ai
Definition: xine_internal.h:186
xine_query_buffers_data_t vo
Definition: xine_internal.h:187
xine_query_buffers_data_t ao
Definition: xine_internal.h:188
Definition: xine_internal.h:80
int verbosity
Definition: xine_internal.h:86
config_values_t * config
Definition: xine_internal.h:82
pthread_mutex_t streams_lock
Definition: xine_internal.h:95
xdgHandle basedir_handle
Definition: xine_internal.h:100
int demux_strategy
Definition: xine_internal.h:88
metronom_clock_t * clock
Definition: xine_internal.h:97
const char * save_path
Definition: xine_internal.h:89
scratch_buffer_t * log_buffers[3]
Definition: xine_internal.h:92
xine_list_t * streams
Definition: xine_internal.h:94
plugin_catalog_t * plugin_catalog
Definition: xine_internal.h:84
Definition: xine_internal.h:123
xine_audio_port_t *volatile audio_out
Definition: xine_internal.h:141
int spu_channel_user
Definition: xine_internal.h:162
input_plugin_t * input_plugin
Definition: xine_internal.h:132
fifo_buffer_t * audio_fifo
Definition: xine_internal.h:144
xine_stream_t * slave
Definition: xine_internal.h:151
xine_video_port_t *volatile video_out
Definition: xine_internal.h:135
fifo_buffer_t * video_fifo
Definition: xine_internal.h:138
xine_stream_t * master
Definition: xine_internal.h:150
metronom_t * metronom
Definition: xine_internal.h:129
int audio_channel_auto
Definition: xine_internal.h:160
xine_t * xine
Definition: xine_internal.h:126
int spu_channel_letterbox
Definition: xine_internal.h:164
osd_renderer_t * osd_renderer
Definition: xine_internal.h:147
int spu_decoder_streamtype
Definition: xine_internal.h:161
int content_detection_method
Definition: xine_internal.h:168
int spu_channel_auto
Definition: xine_internal.h:163
spu_decoder_t * spu_decoder_plugin
Definition: xine_internal.h:154
vo_driver_t * video_driver
Definition: xine_internal.h:157
int spu_channel
Definition: xine_internal.h:165
Definition: video_out.h:176
void(* xine_event_listener_cb_t)(void *user_data, const xine_event_t *event)
Definition: xine.h:2265
demux_plugin_t * _x_find_demux_plugin_by_name(xine_stream_t *stream, const char *name, input_plugin_t *input)
Definition: load_plugins.c:2014
void _x_free_spu_decoder(xine_stream_t *stream, spu_decoder_t *decoder)
Definition: load_plugins.c:2969
spu_decoder_t * _x_get_spu_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition: load_plugins.c:2912
int _x_lock_port_rewiring(xine_t *xine, int ms_to_time_out)
Definition: xine.c:3594
char * _x_mrl_remove_auth(const char *mrl)
Definition: xine.c:1469
void _x_extra_info_merge(extra_info_t *dst, extra_info_t *src)
Definition: xine.c:122
video_decoder_t * _x_get_video_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition: load_plugins.c:2654
int _x_query_buffers(xine_stream_t *stream, xine_query_buffers_t *query)
Definition: xine.c:3541
demux_plugin_t * _x_find_demux_plugin(xine_stream_t *stream, input_plugin_t *input)
Definition: load_plugins.c:1989
int _x_demux_start_thread(xine_stream_t *stream)
Definition: demux.c:554
ao_driver_t * _x_load_audio_output_plugin(xine_t *self, const char *id)
Definition: load_plugins.c:2444
void _x_select_spu_channel(xine_stream_t *stream, int channel)
Definition: xine.c:2837
void _x_mrl_unescape(char *mrl)
Definition: xine.c:1415
void _x_set_speed(xine_stream_t *stream, int speed)
Definition: xine.c:2975
void _x_demux_control_nop(xine_stream_t *stream, uint32_t flags)
Definition: demux.c:318
int _x_get_speed(xine_stream_t *stream)
Definition: xine.c:2983
vo_driver_t * _x_load_video_output_plugin(xine_t *this_gen, const char *id, int visual_type, const void *visual)
Definition: load_plugins.c:2281
int _x_demux_stop_thread(xine_stream_t *stream)
Definition: demux.c:588
void _x_free_input_plugin(xine_stream_t *stream, input_plugin_t *input)
Definition: load_plugins.c:1881
int _x_decoder_available(xine_t *xine, uint32_t buftype)
Definition: load_plugins.c:2808
int _x_demux_read_send_data(fifo_buffer_t *fifo, input_plugin_t *input, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, off_t input_normpos, int input_time, int total_time, uint32_t frame_number) XINE_USED
Definition: demux.c:864
int _x_keyframes_add(xine_stream_t *stream, xine_keyframes_entry_t *pos)
Register a stream keyframe to seek index.
Definition: xine.c:3734
int _x_query_buffer_usage(xine_stream_t *stream, int *num_video_buffers, int *num_audio_buffers, int *num_video_frames, int *num_audio_frames)
Definition: xine.c:3491
void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size, int64_t pts, uint32_t type, uint32_t decoder_flags, int input_normpos, int input_time, int total_time, uint32_t frame_number)
Definition: demux.c:818
void _x_free_module(xine_t *xine, struct xine_module_s **pmodule)
Definition: load_plugins.c:1809
void _x_unlock_frontend(xine_stream_t *stream)
Definition: xine.c:3612
int _x_get_spu_channel(xine_stream_t *stream)
Definition: xine.c:3376
int _x_query_network_timeout(xine_t *xine)
Definition: xine.c:2666
void _x_demux_control_headers_done(xine_stream_t *stream)
Definition: demux.c:184
void _x_extra_info_reset(extra_info_t *extra_info)
Definition: xine.c:118
void _x_action_raise(xine_stream_t *stream)
Definition: demux.c:791
int _x_message(xine_stream_t *stream, int type,...) XINE_SENTINEL
Definition: xine_interface.c:1011
void _x_free_demux_plugin(xine_stream_t *stream, demux_plugin_t **demux)
Definition: load_plugins.c:2144
int _x_demux_read_header(input_plugin_t *input, void *buffer, off_t size)
Definition: demux.c:629
void _x_free_audio_decoder(xine_stream_t *stream, audio_decoder_t *decoder)
Definition: load_plugins.c:2795
int _x_query_unprocessed_osd_events(xine_stream_t *stream)
Definition: xine.c:3618
audio_decoder_t * _x_get_audio_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition: load_plugins.c:2732
void _x_get_current_info(xine_stream_t *stream, extra_info_t *extra_info, int size)
Definition: xine.c:2878
int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing)
Definition: demux.c:959
int _x_action_pending(xine_stream_t *stream)
Definition: demux.c:771
#define XINE_LOG_NUM
Definition: xine_internal.h:67
int _x_get_fine_speed(xine_stream_t *stream)
Definition: xine.c:2971
int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out)
Definition: xine.c:3606
int _x_get_video_streamtype(xine_stream_t *)
Definition: xine.c:3382
void _x_demux_flush_engine(xine_stream_t *stream)
Definition: demux.c:61
struct xine_module_s * _x_find_module(xine_t *xine, const char *type, const char *id, unsigned sub_type, const void *params)
Definition: load_plugins.c:1771
void _x_demux_control_start(xine_stream_t *stream)
Definition: demux.c:256
off_t _x_read_abort(xine_stream_t *stream, int fd, char *buf, off_t todo)
Definition: demux.c:717
void _x_demux_control_end(xine_stream_t *stream, uint32_t flags)
Definition: demux.c:295
void _x_free_video_decoder(xine_stream_t *stream, video_decoder_t *decoder)
Definition: load_plugins.c:2718
void _x_flush_events_queues(xine_stream_t *stream)
Definition: events.c:698
void _x_handle_stream_end(xine_stream_t *stream, int non_user)
Definition: xine.c:93
void _x_demux_control_newpts(xine_stream_t *stream, int64_t pts, uint32_t flags)
Definition: demux.c:126
int _x_keyframes_set(xine_stream_t *stream, xine_keyframes_entry_t *list, int size)
Register a list of stream keyframes.
Definition: xine.c:3820
void _x_action_lower(xine_stream_t *stream)
Definition: demux.c:799
int _x_get_audio_channel(xine_stream_t *stream)
Definition: audio_decoder.c:618
int _x_demux_check_extension(const char *mrl, const char *extensions)
Definition: demux.c:675
void _x_reset_relaxed_frame_drop_mode(xine_stream_t *stream)
Definition: xine.c:3658
input_plugin_t * _x_find_input_plugin(xine_stream_t *stream, const char *mrl)
Definition: load_plugins.c:1830
void _x_unlock_port_rewiring(xine_t *xine)
Definition: xine.c:3600
void _x_demux_send_mrl_reference(xine_stream_t *stream, int alternative, const char *mrl, const char *title, int start_time, int duration)
Definition: demux.c:912
void _x_trigger_relaxed_frame_drop_mode(xine_stream_t *stream)
Definition: xine.c:3650
int _x_continue_stream_processing(xine_stream_t *stream)
Definition: xine.c:3643
void _x_set_fine_speed(xine_stream_t *stream, int speed)
Definition: xine.c:2910