xine-lib 1.2.13-20230125hg15249
xine_internal.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2000-2022 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
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
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
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;
265int _x_demux_read_header (input_plugin_t *input, void *buffer, off_t size) XINE_PROTECTED;
266int _x_demux_read_stream_header (xine_stream_t *stream, input_plugin_t *input, void *buffer, size_t size) XINE_PROTECTED;
267int _x_demux_check_extension (const char *mrl, const char *extensions);
268
269off_t _x_read_abort (xine_stream_t *stream, int fd, char *buf, off_t todo) XINE_PROTECTED;
270
272
275
276void _x_demux_send_data(fifo_buffer_t *fifo, uint8_t *data, int size,
277 int64_t pts, uint32_t type, uint32_t decoder_flags,
278 int input_normpos, int input_time, int total_time,
279 uint32_t frame_number) XINE_PROTECTED;
280
282 int size, int64_t pts, uint32_t type,
283 uint32_t decoder_flags, off_t input_normpos,
284 int input_time, int total_time,
285 uint32_t frame_number) XINE_USED XINE_PROTECTED;
286
287void _x_demux_send_mrl_reference (xine_stream_t *stream, int alternative,
288 const char *mrl, const char *title,
289 int start_time, int duration) XINE_PROTECTED;
290
291/*
292 * MRL escaped-character decoding (overwrites the source string)
293 */
294void _x_mrl_unescape(char *mrl) XINE_PROTECTED;
295
296/*
297 * Return a copy of mrl without authentication credentials
298 */
299char *_x_mrl_remove_auth(const char *mrl) XINE_PROTECTED;
300
301/*
302 * plugin_loader functions
303 *
304 */
305
306/* allow input plugins to use other input plugins */
309
310/* on-demand loading of generic modules / sub-plugins */
311struct xine_module_s; /* xine_module.h */
312struct xine_module_s *_x_find_module(xine_t *xine, const char *type, const char *id, unsigned sub_type, const void *params) XINE_PROTECTED;
313void _x_free_module(xine_t *xine, struct xine_module_s **pmodule) XINE_PROTECTED;
314
315/* on-demand loading of audio/video/spu decoder plugins */
316
321spu_decoder_t *_x_get_spu_decoder (xine_stream_t *stream, uint8_t stream_type) XINE_PROTECTED;
323/* check for decoder availability - but don't try to initialize it */
324int _x_decoder_available (xine_t *xine, uint32_t buftype) XINE_PROTECTED;
325
326/* on-demand loading of demux plugins */
330
331/*
332 * load_video_output_plugin
333 *
334 * load a specific video output plugin
335 */
336
338 const char *id, int visual_type,
339 const void *visual) XINE_PROTECTED;
340
341/*
342 * audio output plugin dynamic loading stuff
343 */
344
345/*
346 * load_audio_output_plugin
347 *
348 * load a specific audio output plugin
349 */
350
352
353
354void _x_set_speed (xine_stream_t *stream, int speed) XINE_PROTECTED;
355
357
358/* set when pauseing with port ticket granted, for XINE_PARAM_VO_SINGLE_STEP. */
359/* special values for fine speed. */
360# define XINE_LIVE_PAUSE_ON 0x7ffffffd
361# define XINE_LIVE_PAUSE_OFF 0x7ffffffc
362void _x_set_fine_speed (xine_stream_t *stream, int speed) XINE_PROTECTED;
363
365
366void _x_select_spu_channel (xine_stream_t *stream, int channel) XINE_PROTECTED;
367
369
371
373
374/*
375 * internal events
376 */
377
378/* sent by dvb frontend to inform ts demuxer of new pids */
379#define XINE_EVENT_PIDS_CHANGE 0x80000000
380/* sent by BluRay input plugin to inform ts demuxer about end of clip */
381#define XINE_EVENT_END_OF_CLIP 0x80000001
382
383/*
384 * pids change event - inform ts demuxer of new pids
385 */
386typedef struct {
387 int vpid; /* video program id */
388 int apid; /* audio program id */
390
391#ifdef __cplusplus
392}
393#endif
394
395#endif
396
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
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:593
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:386
int vpid
Definition xine_internal.h:387
int apid
Definition xine_internal.h:388
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:187
const char * name
Definition xine.c:1575
_xine_arg_type_t type
Definition xine.c:1574
void(* xine_event_listener_cb_t)(void *user_data, const xine_event_t *event)
Definition xine.h:2283
demux_plugin_t * _x_find_demux_plugin_by_name(xine_stream_t *stream, const char *name, input_plugin_t *input)
Definition load_plugins.c:2276
void _x_free_spu_decoder(xine_stream_t *stream, spu_decoder_t *decoder)
Definition load_plugins.c:3205
void _x_extra_info_merge(extra_info_t *dst, const extra_info_t *src)
Definition xine.c:140
spu_decoder_t * _x_get_spu_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition load_plugins.c:3148
int _x_lock_port_rewiring(xine_t *xine, int ms_to_time_out)
Definition xine.c:3800
char * _x_mrl_remove_auth(const char *mrl)
Definition xine.c:1495
video_decoder_t * _x_get_video_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition load_plugins.c:2890
int _x_query_buffers(xine_stream_t *stream, xine_query_buffers_t *query)
Definition xine.c:3747
demux_plugin_t * _x_find_demux_plugin(xine_stream_t *stream, input_plugin_t *input)
Definition load_plugins.c:2175
int _x_demux_start_thread(xine_stream_t *stream)
Definition demux.c:575
ao_driver_t * _x_load_audio_output_plugin(xine_t *self, const char *id)
Definition load_plugins.c:2680
void _x_select_spu_channel(xine_stream_t *stream, int channel)
Definition xine.c:3043
void _x_mrl_unescape(char *mrl)
Definition xine.c:1441
void _x_set_speed(xine_stream_t *stream, int speed)
Definition xine.c:3181
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:3189
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:2543
int _x_demux_stop_thread(xine_stream_t *stream)
Definition demux.c:610
void _x_free_input_plugin(xine_stream_t *stream, input_plugin_t *input)
Definition load_plugins.c:2156
int _x_decoder_available(xine_t *xine, uint32_t buftype)
Definition load_plugins.c:3044
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:897
int _x_keyframes_add(xine_stream_t *stream, xine_keyframes_entry_t *pos)
Register a stream keyframe to seek index.
Definition xine.c:3940
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:3697
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:851
void _x_free_module(xine_t *xine, struct xine_module_s **pmodule)
Definition load_plugins.c:2079
void _x_unlock_frontend(xine_stream_t *stream)
Definition xine.c:3818
int _x_get_spu_channel(xine_stream_t *stream)
Definition xine.c:3582
int _x_query_network_timeout(xine_t *xine)
Definition xine.c:2872
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:136
void _x_action_raise(xine_stream_t *stream)
Definition demux.c:824
int _x_message(xine_stream_t *stream, int type,...) XINE_SENTINEL
Definition xine_interface.c:1091
void _x_free_demux_plugin(xine_stream_t *stream, demux_plugin_t **demux)
Definition load_plugins.c:2406
int _x_demux_read_header(input_plugin_t *input, void *buffer, off_t size)
Definition demux.c:704
void _x_free_audio_decoder(xine_stream_t *stream, audio_decoder_t *decoder)
Definition load_plugins.c:3031
int _x_demux_called_from(xine_stream_t *stream)
Definition demux.c:567
int _x_query_unprocessed_osd_events(xine_stream_t *stream)
Definition xine.c:3824
audio_decoder_t * _x_get_audio_decoder(xine_stream_t *stream, uint8_t stream_type)
Definition load_plugins.c:2968
void _x_get_current_info(xine_stream_t *stream, extra_info_t *extra_info, int size)
Definition xine.c:3084
int _x_demux_seek(xine_stream_t *stream, off_t start_pos, int start_time, int playing)
Definition demux.c:992
int _x_action_pending(xine_stream_t *stream)
Definition demux.c:804
#define XINE_LOG_NUM
Definition xine_internal.h:67
int _x_get_fine_speed(xine_stream_t *stream)
Definition xine.c:3177
int _x_lock_frontend(xine_stream_t *stream, int ms_to_time_out)
Definition xine.c:3812
int _x_get_video_streamtype(xine_stream_t *)
Definition xine.c:3588
int _x_demux_read_stream_header(xine_stream_t *stream, input_plugin_t *input, void *buffer, size_t size)
Definition demux.c:651
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:2041
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:750
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:2954
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:111
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:4026
void _x_action_lower(xine_stream_t *stream)
Definition demux.c:832
int _x_get_audio_channel(xine_stream_t *stream)
Definition audio_decoder.c:626
int _x_demux_check_extension(const char *mrl, const char *extensions)
Definition demux.c:708
void _x_reset_relaxed_frame_drop_mode(xine_stream_t *stream)
Definition xine.c:3864
input_plugin_t * _x_find_input_plugin(xine_stream_t *stream, const char *mrl)
Definition load_plugins.c:2100
void _x_unlock_port_rewiring(xine_t *xine)
Definition xine.c:3806
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:945
void _x_trigger_relaxed_frame_drop_mode(xine_stream_t *stream)
Definition xine.c:3856
int _x_continue_stream_processing(xine_stream_t *stream)
Definition xine.c:3849
void _x_set_fine_speed(xine_stream_t *stream, int speed)
Definition xine.c:3116