29#ifndef XINE_PRIVATE_H__
30#define XINE_PRIVATE_H__
32#ifndef XINE_LIBRARY_COMPILE
33# error xine_private.h is for libxine private use only!
35#if defined(HAVE_CONFIG_H) && !defined(__XINE_LIB_CONFIG_H__)
36# error config.h not included
41#if SUPPORT_ATTRIBUTE_VISIBILITY_INTERNAL
42# define INTERNAL __attribute__((visibility("internal")))
43#elif SUPPORT_ATTRIBUTE_VISIBILITY_DEFAULT
44# define INTERNAL __attribute__((__visibility__("default")))
49#if defined (__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 ))
50# define XINE_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
51# define XINE_ENABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
53# define XINE_DISABLE_DEPRECATION_WARNINGS
54# define XINE_ENABLE_DEPRECATION_WARNINGS
58# define EXTERN_C_START extern "C" {
59# define EXTERN_C_STOP }
61# define EXTERN_C_START
73 const uint32_t eor = ~((
byte << 24) | (
byte << 16) | (
byte << 8) |
byte);
77 } u = { s - ((uintptr_t)s & 3) };
78 const uint32_t *p = u.u;
83 {{0xff, 0xff, 0xff, 0xff}},
84 {{0x00, 0xff, 0xff, 0xff}},
85 {{0x00, 0x00, 0xff, 0xff}},
86 {{0x00, 0x00, 0x00, 0xff}},
88 static const uint8_t rest[32] = {
89 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4,
90 0, 4, 3, 4, 2, 4, 3, 4, 1, 4, 3, 4, 2, 4, 3, 4
96 uint32_t w = (*p++ ^ eor) & mask[(uintptr_t)s & 3].v;
98 w = w & 0x80808080 & ((w & 0x7f7f7f7f) + 0x01010101);
104 w = (w * 0x00204081) & 0xffffffff;
106 return ((
const char *)p - s) - rest[endian.b[0] + w];
110#if (HAVE_ATOMIC_VARS > 0)
111# if (HAVE_ATOMIC_VARS == 1)
112# include <stdatomic.h>
113# define XINE_ATINT_T atomic_int
114# define XINE_ATINIT(xatfa_refs,xatfa_n) atomic_init (&(xatfa_refs), (xatfa_n))
115# define XINE_ATFA(xatfa_refs,xatfa_n) atomic_fetch_add_explicit (&(xatfa_refs), (xatfa_n), memory_order_acq_rel)
116# define XINE_ATGET(xatfa_refs) atomic_load_explicit (&(xatfa_refs), memory_order_acquire)
117# elif (HAVE_ATOMIC_VARS == 2)
118# define XINE_ATINT_T int
119# define XINE_ATINIT(xatfa_refs,xatfa_n) __atomic_store_n (&(xatfa_refs), (xatfa_n), __ATOMIC_RELAXED)
120# define XINE_ATFA(xatfa_refs,xatfa_n) __atomic_fetch_add (&(xatfa_refs), (xatfa_n), __ATOMIC_ACQ_REL)
121# define XINE_ATGET(xatfa_refs) __atomic_load_n (&(xatfa_refs), __ATOMIC_ACQUIRE)
123# define XINE_ATINT_T volatile int
124# define XINE_ATINIT(xatfa_refs,xatfa_n) xatfa_refs = xatfa_n
125# define XINE_ATFA(xatfa_refs,xatfa_n) __sync_fetch_and_add (&(xatfa_refs), (xatfa_n))
126# if defined (ARCH_X86)
127# define XINE_ATGET(xatfa_refs) (xatfa_refs)
129# define XINE_ATGET(xatfa_refs) __sync_fetch_and_add (&(xatfa_refs), 0)
135 void (*destructor) (
void *object);
140 void (*destructor) (
void *
object),
void *
object) {
143 XINE_ATINIT (refs->
refs, 1);
147 return XINE_ATFA (refs->
refs, n) + n;
151 int v = XINE_ATFA (refs->
refs, -n) - n;
158 return XINE_ATGET (refs->
refs);
166 void (*destructor) (
void *object);
171 void (*destructor) (
void *
object),
void *
object) {
180 pthread_mutex_lock (&refs->
mutex);
183 pthread_mutex_unlock (&refs->
mutex);
189 pthread_mutex_lock (&refs->
mutex);
192 pthread_mutex_unlock (&refs->
mutex);
194 pthread_mutex_destroy (&refs->
mutex);
202 pthread_mutex_lock (&refs->
mutex);
204 pthread_mutex_unlock (&refs->
mutex);
272#if defined(HAVE_PTHREAD_RWLOCK)
273# define xine_rwlock_t pthread_rwlock_t
274# define xine_rwlock_init_default(l) pthread_rwlock_init (l, NULL)
275# define xine_rwlock_rdlock(l) pthread_rwlock_rdlock (l)
276# define xine_rwlock_tryrdlock(l) pthread_rwlock_tryrdlock (l)
277# define xine_rwlock_timedrdlock(l,t) pthread_rwlock_timedrdlock (l, t)
278# define xine_rwlock_wrlock(l) pthread_rwlock_wrlock (l)
279# define xine_rwlock_trywrlock(l) pthread_rwlock_trywrlock (l)
280# define xine_rwlock_timedwrlock(l,t) pthread_rwlock_timedwrlock (l, t)
281# define xine_rwlock_unlock(l) pthread_rwlock_unlock (l)
282# define xine_rwlock_destroy(l) pthread_rwlock_destroy (l)
284# define xine_rwlock_t pthread_mutex_t
285# define xine_rwlock_init_default(l) pthread_mutex_init (l, NULL)
286# define xine_rwlock_rdlock(l) pthread_mutex_lock (l)
287# define xine_rwlock_tryrdlock(l) pthread_mutex_trylock (l)
288# define xine_rwlock_timedrdlock(l,t) pthread_mutex_timedlock (l, t)
289# define xine_rwlock_wrlock(l) pthread_mutex_lock (l)
290# define xine_rwlock_trywrlock(l) pthread_mutex_trylock (l)
291# define xine_rwlock_timedwrlock(l,t) pthread_mutex_timedlock (l, t)
292# define xine_rwlock_unlock(l) pthread_mutex_unlock (l)
293# define xine_rwlock_destroy(l) pthread_mutex_destroy (l)
296#ifdef HAVE_POSIX_TIMERS
297# define xine_gettime(t) clock_gettime (CLOCK_REALTIME, t)
302 r = gettimeofday (&tv,
NULL);
304 ts->tv_sec = tv.tv_sec;
305 ts->tv_nsec = tv.tv_usec * 1000;
311#if (defined(__GNUC__) || defined(__clang__)) && defined(ARCH_X86)
312static inline uint32_t
xine_uint_mul_div (uint32_t num, uint32_t mul, uint32_t den) {
313 register uint32_t eax = num, edx;
315 __asm__ __volatile__ (
329 :
"=a" (eax),
"=d" (edx),
"=r" (mul),
"=g" (den)
330 :
"0" (eax),
"2" (mul),
"3" (den)
340 return ((uint64_t)num * mul + (den >> 1)) / den;
345 const uint8_t *p = (
const uint8_t *)*s;
351 *s = (
const char *)p;
356 }
while ((
z > 9) && (
z != (
'-' ^
'0')));
357 if (
z == (
'-' ^
'0')) {
372 *s = (
const char *)(p - 1);
377 const uint8_t *p = (
const uint8_t *)*s;
383 *s = (
const char *)p;
394 *s = (
const char *)(p - 1);
399 const uint8_t *p = (
const uint8_t *)*s;
402#if defined(__WORDSIZE) && (__WORDSIZE == 32)
408 *s = (
const char *)p;
414#if defined(__WORDSIZE) && (__WORDSIZE == 32)
420 *s = (
const char *)(p - 1);
423 }
while (!(u & 0xf0000000));
429 v = (
v << 3) + (
v << 1) +
z;
432 *s = (
const char *)(p - 1);
436#define XINE_MAX_INT32_STR 13
438 uint8_t b[24], *t = b + 11, *q = (uint8_t *)*s;
448 *--t = u % 10u +
'0';
452 *s = (
char *)(q + (b + 11 - t));
456 uint8_t b[24], *t = b + 11, *q = (uint8_t *)*s;
459 *--t =
v % 10u +
'0';
463 *s = (
char *)(q + (b + 11 - t));
466#define XINE_MAX_INT64_STR 21
468 uint8_t b[44], *t = b + 21, *q = (uint8_t *)*s;
471 *--t =
v % 10u +
'0';
475 *s = (
char *)(q + (b + 21 - t));
479#define xine_uint2str(s,v) do { \
480 if (sizeof (v) == 8) \
481 xine_uint64_2str (s, v); \
483 xine_uint32_2str (s, v); \
487# define PTR_IN_RANGE(_ptr,_start,_size) \
488 ((uintptr_t)((uint8_t *)(_ptr) - (uint8_t *)(_start)) < (uintptr_t)(_size))
490# define PTR_IN_RANGE(_ptr,_start,_size) \
491 ((uint8_t *)(_ptr) >= (uint8_t *)(_start) && ((uint8_t *)(_ptr) < (uint8_t *)(_start) + (_size)))
506 XINE_IP_PREF_AUTO = 0,
517#define SPEED_FLAG_IGNORE_CHANGE 1
518#define SPEED_FLAG_CHANGING 2
519#define SPEED_FLAG_WANT_LIVE 4
520#define SPEED_FLAG_WANT_NEW 8
542 uint8_t tab[256 * 2];
598#define XINE_NUM_SIDE_STREAMS 4
634 pthread_mutex_t
lock;
648 pthread_mutex_t
lock;
656 pthread_mutex_t
lock;
672#define XINE_NUM_CURR_EXTRA_INFOS 2
691 pthread_mutex_t
lock;
704#define _XINE_EI_RING_SIZE 16
716#define XINE_NBC_EVENT_AUDIO_DRY 1
static int input(void)
Definition goomsl_lex.c:1495
int _x_scan_plugins(xine_t *this)
Load plugins into catalog.
Definition load_plugins.c:1939
void _x_dispose_plugins(xine_t *this)
Dispose (shutdown) all currently loaded plugins.
Definition load_plugins.c:3595
Definition audio_out.h:43
Definition audio_decoder.h:73
Definition broadcaster.c:82
Definition video_decoder.h:73
Definition video_out.h:50
Definition net_buf_ctrl.c:83
Definition xine_private.h:494
pthread_mutex_t speed_change_lock
Definition xine_private.h:524
xine_ticket_t * port_ticket
Definition xine_private.h:497
int network_timeout
Definition xine_private.h:504
void * log_cb_user_data
Definition xine_private.h:501
int speed_change_new_speed
Definition xine_private.h:523
@ XINE_IP_PREF_4_6
Definition xine_private.h:508
@ XINE_IP_PREF_4
Definition xine_private.h:507
int speed_change_new_live
Definition xine_private.h:522
xine_log_cb_t log_cb
Definition xine_private.h:500
xine_t x
Definition xine_private.h:495
uint32_t speed_change_flags
Definition xine_private.h:521
pthread_cond_t speed_change_done
Definition xine_private.h:525
int flags
Definition xine_private.h:503
int black
Definition xine_private.h:538
char * decoder_pri_help
Definition xine_private.h:533
int gen
Definition xine_private.h:540
pthread_mutex_t log_lock
Definition xine_private.h:498
uint32_t join_av
Definition xine_private.h:512
Definition xine_private.h:163
int refs
Definition xine_private.h:165
void * object
Definition xine_private.h:167
pthread_mutex_t mutex
Definition xine_private.h:164
void(* destructor)(void *object)
Definition xine_private.h:166
Definition xine_internal.h:80
Definition xine_private.h:546
xine_post_out_t video_source
Definition xine_private.h:683
struct xine_stream_private_st * side_streams[4]
Definition xine_private.h:603
int delay_finish_event
Definition xine_private.h:677
uint32_t id_flag
Definition xine_private.h:605
pthread_mutex_t lock
Definition xine_private.h:622
int64_t pts
Definition xine_private.h:708
int id3v2_tag_size
Definition xine_private.h:608
int headers_audio
Definition xine_private.h:636
uint32_t thread_running
Definition xine_private.h:665
xine_stream_t s
Definition xine_private.h:547
demux_plugin_t * plugin
Definition xine_private.h:654
int stream_info[XINE_STREAM_INFO_MAX]
Definition xine_private.h:613
struct xine_stream_private_st::@126 index
uint8_t video_decoder_ei_fast[256]
Definition xine_private.h:706
uint32_t thread_created
Definition xine_private.h:664
uint32_t gapless_switch
Definition xine_private.h:558
extra_info_t ei
Definition xine_private.h:709
uint32_t audio_thread_created
Definition xine_private.h:552
struct xine_stream_private_st::@122 first_frame
xine_refs_t current_extra_info_index
Definition xine_private.h:673
uint32_t video_decoder_ei_index
Definition xine_private.h:705
pthread_mutex_t info_lock
Definition xine_private.h:612
int spu_track_map_entries
Definition xine_private.h:588
int headers_video
Definition xine_private.h:637
pthread_cond_t resume
Definition xine_private.h:658
int err
Definition xine_private.h:681
pthread_mutex_t frontend_lock
Definition xine_private.h:596
uint32_t emergency_brake
Definition xine_private.h:554
uint32_t action_pending
Definition xine_private.h:662
struct xine_stream_private_st::@124 event
extra_info_t * video_decoder_extra_info
Definition xine_private.h:567
video_decoder_t * video_decoder_plugin
Definition xine_private.h:566
int audio_track_map_entries
Definition xine_private.h:571
xine_keyframes_entry_t * array
Definition xine_private.h:692
xine_refs_t refs
Definition xine_private.h:688
int nbc_refs
Definition xine_private.h:642
char * meta_info_public[XINE_STREAM_INFO_MAX]
Definition xine_private.h:617
xine_list_t * queues
Definition xine_private.h:649
extra_info_t current_extra_info[2]
Definition xine_private.h:674
char * meta_info[XINE_STREAM_INFO_MAX]
Definition xine_private.h:618
uint32_t finished_naturally
Definition xine_private.h:560
uint32_t max_seek_bufs
Definition xine_private.h:667
uint32_t slave_is_subtitle
Definition xine_private.h:553
pthread_t audio_thread
Definition xine_private.h:574
int audio_channel_user
Definition xine_private.h:583
input_class_t * eject_class
Definition xine_private.h:562
uint32_t keep_ao_driver_open
Definition xine_private.h:559
pthread_t video_thread
Definition xine_private.h:565
int finisheds_audio
Definition xine_private.h:638
pthread_cond_t reached
Definition xine_private.h:623
xine_post_out_t audio_source
Definition xine_private.h:684
pthread_mutex_t meta_lock
Definition xine_private.h:616
int used
Definition xine_private.h:693
int video_decoder_streamtype
Definition xine_private.h:568
input_class_t * query_input_plugins[2]
Definition xine_private.h:702
int lastadd
Definition xine_private.h:693
pthread_t thread
Definition xine_private.h:655
int slave_affection
Definition xine_private.h:679
uint32_t flag
Definition xine_private.h:629
int audio_decoder_streamtype
Definition xine_private.h:573
int size
Definition xine_private.h:693
uint32_t start_buffers_sent
Definition xine_private.h:669
uint32_t disable_decoder_flush_at_discontinuity
Definition xine_private.h:696
uint32_t audio_type
Definition xine_private.h:578
audio_decoder_t * audio_decoder_plugin
Definition xine_private.h:575
int video_seek_count
Definition xine_private.h:675
broadcaster_t * broadcaster
Definition xine_private.h:686
int video_channel
Definition xine_private.h:569
int demuxers_running
Definition xine_private.h:640
pthread_mutex_t action_lock
Definition xine_private.h:657
uint32_t seekable
Definition xine_private.h:699
pthread_cond_t changed
Definition xine_private.h:635
struct xine_stream_private_st::@125 demux
uint32_t input_caps
Definition xine_private.h:663
xine_nbc_t * nbc
Definition xine_private.h:643
extra_info_t * audio_decoder_extra_info
Definition xine_private.h:576
pthread_mutex_t pair
Definition xine_private.h:660
int status
Definition xine_private.h:549
int spu_channel_pan_scan
Definition xine_private.h:592
uint32_t video_thread_created
Definition xine_private.h:551
uint32_t early_finish_event
Definition xine_private.h:557
struct xine_stream_private_st::@123 counter
int finisheds_video
Definition xine_private.h:639
Definition xine_internal.h:123
uint32_t v
Definition utils.c:1157
uint8_t z[4]
Definition utils.c:1156
_xine_arg_type_t type
Definition xine.c:1574
void(* xine_log_cb_t)(void *user_data, int section)
Definition xine.h:937
#define XINE_STREAM_INFO_MAX
Definition xine_internal.h:69
NULL
Definition xine_plugin.c:78
#define INTERNAL
Definition xine_private.h:46
xine_fast_text_t * xine_fast_text_load(const char *filename, size_t max_size)
Definition utils.c:1305
int _x_audio_decoder_init(xine_stream_t *stream)
Definition audio_decoder.c:514
void xine_current_extra_info_set(xine_stream_private_t *stream, const extra_info_t *info)
Definition xine.c:168
static void xine_int32_2str(char **s, int32_t v)
Definition xine_private.h:437
void xine_nbc_event(xine_stream_private_t *stream, uint32_t type)
Definition net_buf_ctrl.c:556
static void xine_uint64_2str(char **s, uint64_t v)
Definition xine_private.h:467
void _x_audio_decoder_shutdown(xine_stream_t *stream)
Definition audio_decoder.c:601
static uint64_t xine_str2uint64(const char **s)
Definition xine_private.h:398
void xine_probe_fast_memcpy(xine_t *xine)
Benchmark available memcpy methods.
Definition memcpy.c:712
void _x_video_decoder_shutdown(xine_stream_t *stream)
Definition video_decoder.c:673
int _x_set_file_close_on_exec(int fd)
Make file descriptors and sockets uninheritable.
Definition utils.c:796
struct xine_stream_private_st xine_stream_private_t
char * xine_fast_text_line(xine_fast_text_t *xft, size_t *linesize)
Definition utils.c:1353
#define XINE_NUM_CURR_EXTRA_INFOS
Definition xine_private.h:672
void _x_free_audio_driver(xine_t *xine, ao_driver_t **driver)
Definition load_plugins.c:2770
#define xine_rwlock_t
Definition xine_private.h:284
static int32_t xine_str2int32(const char **s)
Definition xine_private.h:344
#define EXTERN_C_STOP
Definition xine_private.h:62
static uint32_t xine_find_byte(const char *s, uint32_t byte)
Definition xine_private.h:72
static int xine_refs_sub(xine_refs_t *refs, int n)
Definition xine_private.h:187
static int xine_refs_add(xine_refs_t *refs, int n)
Definition xine_private.h:178
static uint32_t xine_uint_mul_div(uint32_t num, uint32_t mul, uint32_t den)
Definition xine_private.h:339
static int xine_refs_get(xine_refs_t *refs)
Definition xine_private.h:200
static void xine_refs_init(xine_refs_t *refs, void(*destructor)(void *object), void *object)
Definition xine_private.h:170
void xine_fast_text_unload(xine_fast_text_t **xft)
Definition utils.c:1420
static uint32_t xine_str2uint32(const char **s)
Definition xine_private.h:376
static void xine_uint32_2str(char **s, uint32_t v)
Definition xine_private.h:455
int xine_fbc_set(fifo_buffer_t *fifo, int on)
Definition buffer.c:132
int _x_set_socket_close_on_exec(int s)
Definition utils.c:805
int _x_video_decoder_init(xine_stream_t *stream)
Definition video_decoder.c:599
static int xine_gettime(struct timespec *ts)
Definition xine_private.h:299
input_plugin_t * _x_rip_plugin_get_instance(xine_stream_t *stream, const char *filename)
Definition input_rip.c:806
#define EXTERN_C_START
Definition xine_private.h:61
#define XINE_NUM_SIDE_STREAMS
Definition xine_private.h:598
demux_plugin_t * _x_find_demux_plugin_last_probe(xine_stream_t *stream, const char *last_demux_name, input_plugin_t *input)
Definition load_plugins.c:2324
input_plugin_t * _x_cache_plugin_get_instance(xine_stream_t *stream)
Definition input_cache.c:406
void _x_free_video_driver(xine_t *xine, vo_driver_t **driver)
Definition load_plugins.c:2787
#define _XINE_EI_RING_SIZE
Definition xine_private.h:704