1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
|
/*
* Copyright (C) 2000-2002 the xine project
*
* This file is part of xine, a free video player.
*
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* $Id: xine_internal.h,v 1.88 2002/06/10 13:41:55 miguelfreitas Exp $
*
*/
#ifndef HAVE_XINE_INTERNAL_H
#define HAVE_XINE_INTERNAL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <inttypes.h>
#ifdef XINE_COMPILE
#include "input/input_plugin.h"
#include "demuxers/demux.h"
#else
#include "input_plugin.h"
#include "demux.h"
#endif
#include "video_out.h"
#include "audio_out.h"
#include "metronom.h"
#include "spu_decoder.h"
#include "events.h"
#include "lrb.h"
#ifdef XINE_COMPILE
#include "libspudec/spu_decoder_api.h"
#else
#include "spu_decoder_api.h"
#endif
#include "osd.h"
#include "scratch.h"
#include "xineintl.h"
#define INPUT_PLUGIN_MAX 50
#define DEMUXER_PLUGIN_MAX 50
#define DECODER_PLUGIN_MAX 256
#define VIDEO_DECODER_IFACE_VERSION 9
#define AUDIO_DECODER_IFACE_VERSION 8
#define AUDIO_OUT_PLUGIN_MAX 50
#define VIDEO_OUT_PLUGIN_MAX 50
#define XINE_MAX_EVENT_LISTENERS 50
/*
* generic xine video decoder plugin interface
*
* for a dynamic plugin make sure you provide this function call:
* video_decoder_t *init_video_decoder_plugin (int iface_version,
* xine_t *xine);
*/
typedef struct video_decoder_s video_decoder_t;
struct video_decoder_s {
int interface_version;
int (*can_handle) (video_decoder_t *this, int buf_type);
void (*init) (video_decoder_t *this, vo_instance_t *video_out);
void (*decode_data) (video_decoder_t *this, buf_element_t *buf);
void (*reset) (video_decoder_t *this);
void (*flush) (video_decoder_t *this);
void (*close) (video_decoder_t *this);
char* (*get_identifier) (void);
void (*dispose) (video_decoder_t *this);
int priority;
};
/*
* generic xine audio decoder plugin interface
*
* for a dynamic plugin make sure you provide this function call:
* audio_decoder_t *init_audio_decoder_plugin (int iface_version,
* xine_t *xine);
*/
typedef struct audio_decoder_s audio_decoder_t;
struct audio_decoder_s {
int interface_version;
int (*can_handle) (audio_decoder_t *this, int buf_type);
void (*init) (audio_decoder_t *this, ao_instance_t *audio_out);
void (*decode_data) (audio_decoder_t *this, buf_element_t *buf);
void (*reset) (audio_decoder_t *this);
void (*close) (audio_decoder_t *this);
char* (*get_identifier) (void);
void (*dispose) (audio_decoder_t *this);
int priority;
};
/*
* gui callback functions
*
*/
/*
* player status constants:
*/
#define XINE_STOP 0
#define XINE_PLAY 1
#define XINE_QUIT 2
#define XINE_LOGO 3
/*
* log output
*/
#define XINE_LOG_FORMAT 0 /* stream format, decoders, video size... */
#define XINE_LOG_MSG 1 /* warnings, errors, ... */
#define XINE_LOG_PLUGIN 2
#define XINE_LOG_NUM 3 /* # of log buffers defined */
typedef void (*xine_event_listener_t) (void *user_data, xine_event_t *);
#define XINE_CODEC_AUDIO 0
#define XINE_CODEC_VIDEO 1
typedef void (*xine_report_codec_t) (void *user_data, int codec_type,
uint32_t fourcc, char *description, int handled);
struct xine_s {
/* private : */
metronom_t *metronom;
config_values_t *config;
/* MRL of displayed logo */
char *logo_mrl;
/* Logo manipulation mutex */
pthread_mutex_t logo_lock;
input_plugin_t *input_plugins[INPUT_PLUGIN_MAX];
int num_input_plugins;
input_plugin_t *cur_input_plugin;
/* kept to do proper ejecting (otherwise we eject the logo) */
input_plugin_t *last_input_plugin;
demux_plugin_t *demuxer_plugins[DEMUXER_PLUGIN_MAX];
int num_demuxer_plugins;
demux_plugin_t *cur_demuxer_plugin;
int demux_strategy;
int status;
int speed;
off_t cur_input_pos;
off_t cur_input_length;
int cur_input_time;
char cur_mrl[1024];
spu_functions_t *spu_out;
pthread_t spu_thread;
spu_decoder_t *spu_decoder_plugins[DECODER_PLUGIN_MAX];
spu_decoder_t *cur_spu_decoder_plugin;
int spu_finished;
spu_decoder_t *spu_decoders_loaded[DECODER_PLUGIN_MAX];
int num_spu_decoders_loaded;
/* *_user: -2 => off
-1 => auto (use *_auto value)
>=0 => respect the user's choice
*/
int audio_channel_user;
int audio_channel_auto;
int spu_channel_user;
int spu_channel_auto;
int spu_channel;
vo_driver_t *video_driver;
vo_instance_t *video_out;
fifo_buffer_t *video_fifo;
pthread_t video_thread;
video_decoder_t *video_decoder_plugins[DECODER_PLUGIN_MAX];
video_decoder_t *cur_video_decoder_plugin;
video_decoder_t *video_decoders_loaded[DECODER_PLUGIN_MAX];
int num_video_decoders_loaded;
int video_finished;
int video_in_discontinuity;
osd_renderer_t *osd_renderer;
osd_object_t *osd;
int osd_display;
ao_instance_t *audio_out;
fifo_buffer_t *audio_fifo;
lrb_t *audio_temp;
pthread_t audio_thread;
audio_decoder_t *audio_decoder_plugins[DECODER_PLUGIN_MAX];
audio_decoder_t *cur_audio_decoder_plugin;
audio_decoder_t *audio_decoders_loaded[DECODER_PLUGIN_MAX];
int num_audio_decoders_loaded;
uint32_t audio_track_map[50];
int audio_track_map_entries;
int audio_finished;
uint32_t audio_type;
/* Lock for xine player functions */
pthread_mutex_t xine_lock;
/* Lock for xxx_finished variables */
pthread_mutex_t finished_lock;
/* Array of event handlers. */
xine_event_listener_t event_listeners[XINE_MAX_EVENT_LISTENERS];
void *event_listener_user_data[XINE_MAX_EVENT_LISTENERS];
uint16_t num_event_listeners;
/* scratch string buffer */
char str[1024];
/* log output that may be presented to the user */
scratch_buffer_t *log_buffers[XINE_LOG_NUM];
int err;
pthread_t finished_thread;
int finished_thread_running;
xine_report_codec_t report_codec_cb;
void *report_codec_user_data;
int playing_logo;
};
/*
* read config file and init a config object
* (if it exists)
*/
config_values_t *xine_config_file_init (char *filename);
/*
* init xine - call once at startup
*/
xine_t *xine_init (vo_driver_t *vo,
ao_driver_t *ao,
config_values_t *config);
/*
* open a stream sekk to a given position and play it
*
* name : mrl to open
* start_pos : position in input source (0..65535)
* start_time : position measured in seconds from stream start
*
* if both parameters are !=0 start_pos will be used
* for non-seekable streams both values will be ignored
*
* returns 1 on succ, 0 on failure
*/
int xine_play (xine_t *this, char *MRL, int start_pos, int start_time);
int xine_play_internal (xine_t *this, char *MRL, int start_pos, int start_time);
/*
* set/get playback speed
*
* constants see below
*/
void xine_set_speed (xine_t *this, int speed);
int xine_get_speed (xine_t *this);
#define SPEED_PAUSE 0
#define SPEED_SLOW_4 1
#define SPEED_SLOW_2 2
#define SPEED_NORMAL 4
#define SPEED_FAST_2 8
#define SPEED_FAST_4 16
/*
* manually adjust a/v sync
*/
void xine_set_av_offset (xine_t *this, int offset_pts);
int xine_get_av_offset (xine_t *this);
/*
* stop playing
*/
void xine_stop_internal (xine_t *this);
void xine_stop (xine_t *this);
/*
* tell current input plugin to eject media.
*/
int xine_eject(xine_t *this);
/*
* return current status (XINE_PLAY/XINE_STOP...)
*/
int xine_get_status (xine_t *this);
/*
* get current position in stream
* returns position (range : 0 - 65535)
*/
int xine_get_current_position (xine_t *this);
/*
* get current position measured in seconds from
* the beginning of the stream
*/
int xine_get_current_time (xine_t *this);
/*
* estimate length of input stream in seconds
* may return 0 if stream is not seekable
*/
int xine_get_stream_length (xine_t *this);
/*
* return the current physical audio channel
*/
int xine_get_audio_channel (xine_t *this);
/*
* return the current logical audio channel
*/
int xine_get_audio_selection (xine_t *this);
/*
* try to find out current audio language
*/
void xine_get_audio_lang (xine_t *this, char *str);
/*
* set desired logical audio channel (-1 => auto)
*/
void xine_select_audio_channel (xine_t *this, int channel);
/*
* return the current SPU channel
*/
int xine_get_spu_channel (xine_t *this);
/*
* set desired SPU channel
*/
void xine_select_spu_channel (xine_t *this, int channel);
/*
* try to find out current spu language
*/
void xine_get_spu_lang (xine_t *this, char *str);
/*
* check if the stream is seekable (at the moment)
*/
int xine_is_stream_seekable (xine_t *this);
/*
* exit xine
*/
void xine_exit (xine_t *this);
/*
* browsing support
*/
/*
* some input plugins are browseable
* returns a list of ids of these plugins
*/
char **xine_get_browsable_input_plugin_ids (xine_t *this) ;
/*
* browse function
* asks input plugin named <plugin_id> to return
* a list of available MRLs in domain/directory <start_mrl>
*
* start_mrl may be NULL indicating the toplevel domain/dir
* returns start_mrl if start_mrl is a valid MRL, not a directory
* returns NULL if start_mrl is an invalid MRL, not even a directory
*/
mrl_t **xine_get_browse_mrls (xine_t *this, char *plugin_id,
char *start_mrl, int *num_mrls);
/*
* autoplay support
*/
/*
* some input plugins can generate autoplay lists
* returns a list of ids of these plugins
*/
char **xine_get_autoplay_input_plugin_ids (xine_t *this) ;
/*
* get autoplay MRL list for input plugin named <plugin_id>
*/
char **xine_get_autoplay_mrls (xine_t *this, char *plugin_id, int *num_mrls);
/*
* internal use only
*/
void xine_notify_stream_finished (xine_t *this);
void xine_report_codec( xine_t *this, int codec_type, uint32_t fourcc, uint32_t buf_type, int handled );
/*
* video decoder stuff
*/
/*
* init video decoders, allocate video fifo,
* start video decoder thread
*/
void video_decoder_init (xine_t *this);
/*
* quit video thread
*/
void video_decoder_shutdown (xine_t *this);
/*
* spu decoder stuff
*/
/*
* init audio decoders, allocate audio fifo,
* start audio decoder thread
*/
void audio_decoder_init (xine_t *this);
/*
* quit audio thread
*/
void audio_decoder_shutdown (xine_t *this);
/*
* Load input/demux/audio_out/video_out plugins
*/
/* plugin naming scheme */
#define XINE_INPUT_PLUGIN_PREFIXNAME "xineplug_inp_"
#define XINE_INPUT_PLUGIN_PREFIXNAME_LENGTH 13
#define XINE_DEMUXER_PLUGIN_PREFIXNAME "xineplug_dmx_"
#define XINE_DEMUXER_PLUGIN_PREFIXNAME_LENGTH 13
#define XINE_VIDEO_OUT_PLUGIN_PREFIXNAME "xineplug_vo_out_"
#define XINE_VIDEO_OUT_PLUGIN_PREFIXNAME_LENGTH 16
#define XINE_AUDIO_OUT_PLUGIN_PREFIXNAME "xineplug_ao_out_"
#define XINE_AUDIO_OUT_PLUGIN_PREFIXNAME_LENGTH 16
#define XINE_DECODER_PLUGIN_PREFIXNAME "xineplug_decode_"
#define XINE_DECODER_PLUGIN_PREFIXNAME_LENGTH 16
/*
* load all available demuxer plugins
*/
void load_demux_plugins (xine_t *this,
config_values_t *config);
/*
* list (open and close) all available demuxer plugins
*/
void xine_list_demux_plugins (config_values_t *config,
char **identifiers, char **mimetypes);
/*
* load all available input plugins
*/
void load_input_plugins (xine_t *this,
config_values_t *config);
/*
* load all available decoder plugins
*/
void load_decoder_plugins (xine_t *this,
config_values_t *config);
/*
* output driver load support functions
*/
/* video */
#define VISUAL_TYPE_X11 1
#define VISUAL_TYPE_AA 2
#define VISUAL_TYPE_FB 3
#define VISUAL_TYPE_GTK 4
#define VISUAL_TYPE_DFB 5
/*
* list_video_output_plugins
*
* returns a list of available video output plugins for
* the specified visual type - the list is sorted by plugin
* priority
*/
char **xine_list_video_output_plugins (int visual_type);
/*
* load_video_output_plugin
*
* load a specific video output plugin
*/
vo_driver_t *xine_load_video_output_plugin(config_values_t *config,
char *id, int visual_type, void *visual);
/*
* audio output plugin dynamic loading stuff
*/
/*
* list_audio_output_plugins
*
* returns a list of available audio output plugins
* the list returned is sorted by plugin priority
*/
char **xine_list_audio_output_plugins ();
/*
* load_audio_output_plugin
*
* load a specific audio output plugin
*/
ao_driver_t *xine_load_audio_output_plugin(config_values_t *config, char *id);
/*
* sending events
* event dispatcher mechanism
*/
/*
* register an event listener callback.
* returns 0 if the listener was registerd, non-zero if it could not.
*/
int xine_register_event_listener(xine_t *this, xine_event_listener_t listener,
void *user_data);
/*
* attempt to remove a registered event listener.
* returns 0 if the listener was removed, non-zero if not (e.g. not found).
*/
int xine_remove_event_listener(xine_t *this, xine_event_listener_t listener);
/*
* send an event to all listeners.
*/
void xine_send_event(xine_t *this, xine_event_t *event);
/*
* register an codec reporting callback.
* return 0 if ok
* obs: set to NULL to unregister
*/
int xine_register_report_codec_cb(xine_t *this, xine_report_codec_t report_codec,
void *user_data);
/*
* snapshot function
*
* returns:
* width, height : size of image (be aware that u,v may be subsampled)
* ratio_code : aspect ratio of the frame
* format : subsampling format YUV 4:2:0 or 4:2:2
* y : lumiance information
* u,v : subsample color information
*/
int xine_get_current_frame (xine_t *this, int *width, int *height,
int *ratio_code, int *format,
uint8_t **y, uint8_t **u,
uint8_t **v);
#define XINE_ASPECT_RATIO_SQUARE 1
#define XINE_ASPECT_RATIO_4_3 2
#define XINE_ASPECT_RATIO_ANAMORPHIC 3
#define XINE_ASPECT_RATIO_211_1 4
#define XINE_ASPECT_RATIO_DONT_TOUCH 42
osd_renderer_t *xine_get_osd_renderer (xine_t *this);
/*
* xine log functions
*/
char **xine_get_log_names (xine_t *this);
void xine_log (xine_t *this, int buf, const char *format, ...);
char **xine_get_log (xine_t *this, int buf);
int xine_get_log_section_count (xine_t *this);
/*
* xine error reporting
*/
#define XINE_ERROR_NONE 0
#define XINE_ERROR_NO_INPUT_PLUGIN 1
#define XINE_ERROR_NO_DEMUXER_PLUGIN 2
#define XINE_ERROR_DEMUXER_FAILED 3
int xine_get_error (xine_t *this);
/*
* demuxer helper functions from demux.c
*/
void xine_demux_flush_engine(xine_t *this);
void xine_demux_control_newpts( xine_t *this, int64_t pts, uint32_t flags );
void xine_demux_control_start( xine_t *this );
void xine_demux_control_end( xine_t *this, uint32_t flags );
#ifdef __cplusplus
}
#endif
#endif
|