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
68#if (HAVE_ATOMIC_VARS > 0)
69# if (HAVE_ATOMIC_VARS == 1)
70# include <stdatomic.h>
71# define XINE_ATINT_T atomic_int
72# define XINE_ATINIT(xatfa_refs,xatfa_n) atomic_init (&(xatfa_refs), (xatfa_n))
73# define XINE_ATFA(xatfa_refs,xatfa_n) atomic_fetch_add_explicit (&(xatfa_refs), (xatfa_n), memory_order_acq_rel)
74# define XINE_ATGET(xatfa_refs) atomic_load_explicit (&(xatfa_refs), memory_order_acquire)
75# elif (HAVE_ATOMIC_VARS == 2)
76# define XINE_ATINT_T int
77# define XINE_ATINIT(xatfa_refs,xatfa_n) __atomic_store_n (&(xatfa_refs), (xatfa_n), __ATOMIC_RELAXED)
78# define XINE_ATFA(xatfa_refs,xatfa_n) __atomic_fetch_add (&(xatfa_refs), (xatfa_n), __ATOMIC_ACQ_REL)
79# define XINE_ATGET(xatfa_refs) __atomic_load_n (&(xatfa_refs), __ATOMIC_ACQUIRE)
81# define XINE_ATINT_T volatile int
82# define XINE_ATINIT(xatfa_refs,xatfa_n) xatfa_refs = xatfa_n
83# define XINE_ATFA(xatfa_refs,xatfa_n) __sync_fetch_and_add (&(xatfa_refs), (xatfa_n))
84# if defined (ARCH_X86)
85# define XINE_ATGET(xatfa_refs) (xatfa_refs)
87# define XINE_ATGET(xatfa_refs) __sync_fetch_and_add (&(xatfa_refs), 0)
93 void (*destructor) (
void *object);
98 void (*destructor) (
void *
object),
void *
object) {
101 XINE_ATINIT (refs->
refs, 1);
105 return XINE_ATFA (refs->
refs, n) + n;
109 int v = XINE_ATFA (refs->
refs, -n) - n;
116 return XINE_ATGET (refs->
refs);
124 void (*destructor) (
void *object);
129 void (*destructor) (
void *
object),
void *
object) {
138 pthread_mutex_lock (&refs->
mutex);
141 pthread_mutex_unlock (&refs->
mutex);
147 pthread_mutex_lock (&refs->
mutex);
150 pthread_mutex_unlock (&refs->
mutex);
152 pthread_mutex_destroy (&refs->
mutex);
160 pthread_mutex_lock (&refs->
mutex);
162 pthread_mutex_unlock (&refs->
mutex);
230#if defined(HAVE_PTHREAD_RWLOCK)
231# define xine_rwlock_t pthread_rwlock_t
232# define xine_rwlock_init_default(l) pthread_rwlock_init (l, NULL)
233# define xine_rwlock_rdlock(l) pthread_rwlock_rdlock (l)
234# define xine_rwlock_tryrdlock(l) pthread_rwlock_tryrdlock (l)
235# define xine_rwlock_timedrdlock(l,t) pthread_rwlock_timedrdlock (l, t)
236# define xine_rwlock_wrlock(l) pthread_rwlock_wrlock (l)
237# define xine_rwlock_trywrlock(l) pthread_rwlock_trywrlock (l)
238# define xine_rwlock_timedwrlock(l,t) pthread_rwlock_timedwrlock (l, t)
239# define xine_rwlock_unlock(l) pthread_rwlock_unlock (l)
240# define xine_rwlock_destroy(l) pthread_rwlock_destroy (l)
242# define xine_rwlock_t pthread_mutex_t
243# define xine_rwlock_init_default(l) pthread_mutex_init (l, NULL)
244# define xine_rwlock_rdlock(l) pthread_mutex_lock (l)
245# define xine_rwlock_tryrdlock(l) pthread_mutex_trylock (l)
246# define xine_rwlock_timedrdlock(l,t) pthread_mutex_timedlock (l, t)
247# define xine_rwlock_wrlock(l) pthread_mutex_lock (l)
248# define xine_rwlock_trywrlock(l) pthread_mutex_trylock (l)
249# define xine_rwlock_timedwrlock(l,t) pthread_mutex_timedlock (l, t)
250# define xine_rwlock_unlock(l) pthread_mutex_unlock (l)
251# define xine_rwlock_destroy(l) pthread_mutex_destroy (l)
254#ifdef HAVE_POSIX_TIMERS
255# define xine_gettime(t) clock_gettime (CLOCK_REALTIME, t)
260 r = gettimeofday (&tv,
NULL);
262 ts->tv_sec = tv.tv_sec;
263 ts->tv_nsec = tv.tv_usec * 1000;
269#if (defined(__GNUC__) || defined(__clang__)) && defined(ARCH_X86)
270static inline uint32_t
xine_uint_mul_div (uint32_t num, uint32_t mul, uint32_t den) {
271 register uint32_t eax = num, edx;
273 __asm__ __volatile__ (
287 :
"=a" (eax),
"=d" (edx),
"=r" (mul),
"=g" (den)
288 :
"0" (eax),
"2" (mul),
"3" (den)
298 return ((uint64_t)num * mul + (den >> 1)) / den;
303 const uint8_t *p = (
const uint8_t *)*s;
309 *s = (
const char *)p;
314 }
while ((z > 9) && (z != (
'-' ^
'0')));
315 if (z == (
'-' ^
'0')) {
330 *s = (
const char *)(p - 1);
335 const uint8_t *p = (
const uint8_t *)*s;
341 *s = (
const char *)p;
352 *s = (
const char *)(p - 1);
357 const uint8_t *p = (
const uint8_t *)*s;
360#if defined(__WORDSIZE) && (__WORDSIZE == 32)
366 *s = (
const char *)p;
372#if defined(__WORDSIZE) && (__WORDSIZE == 32)
378 *s = (
const char *)(p - 1);
381 }
while (!(u & 0xf0000000));
387 v = (v << 3) + (v << 1) + z;
390 *s = (
const char *)(p - 1);
394#define XINE_MAX_INT32_STR 13
396 uint8_t b[24], *t = b + 11, *q = (uint8_t *)*s;
406 *--t = u % 10u +
'0';
410 *s = (
char *)(q + (b + 11 - t));
414 uint8_t b[24], *t = b + 11, *q = (uint8_t *)*s;
417 *--t = v % 10u +
'0';
421 *s = (
char *)(q + (b + 11 - t));
424#define XINE_MAX_INT64_STR 21
426 uint8_t b[44], *t = b + 21, *q = (uint8_t *)*s;
429 *--t = v % 10u +
'0';
433 *s = (
char *)(q + (b + 21 - t));
437#define xine_uint2str(s,v) do { \
438 if (sizeof (v) == 8) \
439 xine_uint64_2str (s, v); \
441 xine_uint32_2str (s, v); \
445# define PTR_IN_RANGE(_ptr,_start,_size) \
446 ((uintptr_t)((uint8_t *)(_ptr) - (uint8_t *)(_start)) < (uintptr_t)(_size))
448# define PTR_IN_RANGE(_ptr,_start,_size) \
449 ((uint8_t *)(_ptr) >= (uint8_t *)(_start) && ((uint8_t *)(_ptr) < (uint8_t *)(_start) + (_size)))
464 XINE_IP_PREF_AUTO = 0,
475#define SPEED_FLAG_IGNORE_CHANGE 1
476#define SPEED_FLAG_CHANGING 2
477#define SPEED_FLAG_WANT_LIVE 4
478#define SPEED_FLAG_WANT_NEW 8
542#define XINE_NUM_SIDE_STREAMS 4
575 pthread_mutex_t
lock;
589 pthread_mutex_t
lock;
597 pthread_mutex_t
lock;
613#define XINE_NUM_CURR_EXTRA_INFOS 2
632 pthread_mutex_t
lock;
648#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:1673
void _x_dispose_plugins(xine_t *this)
Dispose (shutdown) all currently loaded plugins.
Definition: load_plugins.c:3351
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:72
Definition: xine_private.h:452
pthread_mutex_t speed_change_lock
Definition: xine_private.h:482
xine_ticket_t * port_ticket
Definition: xine_private.h:455
int network_timeout
Definition: xine_private.h:462
void * log_cb_user_data
Definition: xine_private.h:459
int speed_change_new_speed
Definition: xine_private.h:481
int speed_change_new_live
Definition: xine_private.h:480
xine_log_cb_t log_cb
Definition: xine_private.h:458
xine_t x
Definition: xine_private.h:453
uint32_t speed_change_flags
Definition: xine_private.h:479
@ XINE_IP_PREF_4_6
Definition: xine_private.h:466
@ XINE_IP_PREF_4
Definition: xine_private.h:465
pthread_cond_t speed_change_done
Definition: xine_private.h:483
int flags
Definition: xine_private.h:461
pthread_mutex_t log_lock
Definition: xine_private.h:456
uint32_t join_av
Definition: xine_private.h:470
Definition: xine_private.h:121
int refs
Definition: xine_private.h:123
void * object
Definition: xine_private.h:125
pthread_mutex_t mutex
Definition: xine_private.h:122
void(* destructor)(void *object)
Definition: xine_private.h:124
Definition: xine_internal.h:80
Definition: xine_private.h:490
xine_post_out_t video_source
Definition: xine_private.h:624
struct xine_stream_private_st * side_streams[4]
Definition: xine_private.h:547
int delay_finish_event
Definition: xine_private.h:618
uint32_t id_flag
Definition: xine_private.h:549
pthread_mutex_t lock
Definition: xine_private.h:563
int headers_audio
Definition: xine_private.h:577
uint32_t thread_running
Definition: xine_private.h:606
xine_stream_t s
Definition: xine_private.h:491
demux_plugin_t * plugin
Definition: xine_private.h:595
int stream_info[XINE_STREAM_INFO_MAX]
Definition: xine_private.h:554
uint32_t thread_created
Definition: xine_private.h:605
uint32_t gapless_switch
Definition: xine_private.h:502
uint32_t audio_thread_created
Definition: xine_private.h:496
xine_refs_t current_extra_info_index
Definition: xine_private.h:614
pthread_mutex_t info_lock
Definition: xine_private.h:553
int spu_track_map_entries
Definition: xine_private.h:532
int headers_video
Definition: xine_private.h:578
pthread_cond_t resume
Definition: xine_private.h:599
extra_info_t ei[2]
Definition: xine_private.h:642
int err
Definition: xine_private.h:622
pthread_mutex_t frontend_lock
Definition: xine_private.h:540
uint32_t emergency_brake
Definition: xine_private.h:498
uint32_t action_pending
Definition: xine_private.h:603
extra_info_t * video_decoder_extra_info
Definition: xine_private.h:511
video_decoder_t * video_decoder_plugin
Definition: xine_private.h:510
int audio_track_map_entries
Definition: xine_private.h:515
xine_keyframes_entry_t * array
Definition: xine_private.h:633
xine_refs_t refs
Definition: xine_private.h:629
int nbc_refs
Definition: xine_private.h:583
char * meta_info_public[XINE_STREAM_INFO_MAX]
Definition: xine_private.h:558
xine_list_t * queues
Definition: xine_private.h:590
extra_info_t current_extra_info[2]
Definition: xine_private.h:615
char * meta_info[XINE_STREAM_INFO_MAX]
Definition: xine_private.h:559
uint32_t finished_naturally
Definition: xine_private.h:504
uint32_t max_seek_bufs
Definition: xine_private.h:608
uint32_t slave_is_subtitle
Definition: xine_private.h:497
pthread_t audio_thread
Definition: xine_private.h:518
int audio_channel_user
Definition: xine_private.h:527
input_class_t * eject_class
Definition: xine_private.h:506
uint32_t keep_ao_driver_open
Definition: xine_private.h:503
pthread_t video_thread
Definition: xine_private.h:509
int finisheds_audio
Definition: xine_private.h:579
pthread_cond_t reached
Definition: xine_private.h:564
xine_post_out_t audio_source
Definition: xine_private.h:625
struct xine_stream_private_st::@91 demux
struct xine_stream_private_st::@92 index
pthread_mutex_t meta_lock
Definition: xine_private.h:557
int used
Definition: xine_private.h:634
int video_decoder_streamtype
Definition: xine_private.h:512
input_class_t * query_input_plugins[2]
Definition: xine_private.h:640
int lastadd
Definition: xine_private.h:634
pthread_t thread
Definition: xine_private.h:596
int slave_affection
Definition: xine_private.h:620
uint32_t flag
Definition: xine_private.h:570
int audio_decoder_streamtype
Definition: xine_private.h:517
int size
Definition: xine_private.h:634
uint32_t start_buffers_sent
Definition: xine_private.h:610
uint32_t disable_decoder_flush_at_discontinuity
Definition: xine_private.h:637
struct xine_stream_private_st::@89 counter
struct xine_stream_private_st::@88 first_frame
uint32_t audio_type
Definition: xine_private.h:522
audio_decoder_t * audio_decoder_plugin
Definition: xine_private.h:519
int video_seek_count
Definition: xine_private.h:616
broadcaster_t * broadcaster
Definition: xine_private.h:627
int video_channel
Definition: xine_private.h:513
int demuxers_running
Definition: xine_private.h:581
pthread_mutex_t action_lock
Definition: xine_private.h:598
pthread_cond_t changed
Definition: xine_private.h:576
uint32_t input_caps
Definition: xine_private.h:604
xine_nbc_t * nbc
Definition: xine_private.h:584
extra_info_t * audio_decoder_extra_info
Definition: xine_private.h:520
pthread_mutex_t pair
Definition: xine_private.h:601
int status
Definition: xine_private.h:493
int spu_channel_pan_scan
Definition: xine_private.h:536
uint32_t video_thread_created
Definition: xine_private.h:495
uint32_t early_finish_event
Definition: xine_private.h:501
struct xine_stream_private_st::@90 event
int finisheds_video
Definition: xine_private.h:580
Definition: xine_internal.h:123
void(* xine_log_cb_t)(void *user_data, int section)
Definition: xine.h:931
#define XINE_STREAM_INFO_MAX
Definition: xine_internal.h:69
NULL
Definition: xine_plugin.c:78
#define INTERNAL
Definition: xine_private.h:46
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:150
static void xine_int32_2str(char **s, int32_t v)
Definition: xine_private.h:395
void xine_nbc_event(xine_stream_private_t *stream, uint32_t type)
Definition: net_buf_ctrl.c:352
static void xine_uint64_2str(char **s, uint64_t v)
Definition: xine_private.h:425
void _x_audio_decoder_shutdown(xine_stream_t *stream)
Definition: audio_decoder.c:593
static uint64_t xine_str2uint64(const char **s)
Definition: xine_private.h:356
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:659
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
#define XINE_NUM_CURR_EXTRA_INFOS
Definition: xine_private.h:613
void _x_free_audio_driver(xine_t *xine, ao_driver_t **driver)
Definition: load_plugins.c:2534
#define xine_rwlock_t
Definition: xine_private.h:242
static int32_t xine_str2int32(const char **s)
Definition: xine_private.h:302
#define EXTERN_C_STOP
Definition: xine_private.h:62
static int xine_refs_sub(xine_refs_t *refs, int n)
Definition: xine_private.h:145
static int xine_refs_add(xine_refs_t *refs, int n)
Definition: xine_private.h:136
static uint32_t xine_uint_mul_div(uint32_t num, uint32_t mul, uint32_t den)
Definition: xine_private.h:297
static int xine_refs_get(xine_refs_t *refs)
Definition: xine_private.h:158
static void xine_refs_init(xine_refs_t *refs, void(*destructor)(void *object), void *object)
Definition: xine_private.h:128
static uint32_t xine_str2uint32(const char **s)
Definition: xine_private.h:334
static void xine_uint32_2str(char **s, uint32_t v)
Definition: xine_private.h:413
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:585
static int xine_gettime(struct timespec *ts)
Definition: xine_private.h:257
input_plugin_t * _x_rip_plugin_get_instance(xine_stream_t *stream, const char *filename)
Definition: input_rip.c:550
#define EXTERN_C_START
Definition: xine_private.h:61
#define XINE_NUM_SIDE_STREAMS
Definition: xine_private.h:542
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:2062
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:2551