Go to the documentation of this file.
35 # include <sys/time.h>
54 #if defined(WIN32) && !defined(XINE_LIBRARY_COMPILE)
55 # define DL_IMPORT __declspec(dllimport)
56 # define extern DL_IMPORT extern
68 #ifdef HAVE_NAMELESS_STRUCT_IN_UNION
69 # define DLIST_H(l) (&(l)->h)
70 # define DLIST_T(l) (&(l)->t)
72 struct {
dnode_t *head, *
null, *tail; };
77 # define DLIST_H(l) ((void *)(&(l)->head))
78 # define DLIST_T(l) ((void *)(&(l)->null))
86 #define DLIST_IS_EMPTY(l) ((l)->head == DLIST_T(l))
88 #define DLIST_REMOVE(n) { \
89 dnode_t *dl_rm_this = n; \
90 dnode_t *dl_rm_prev = dl_rm_this->prev; \
91 dnode_t *dl_rm_next = dl_rm_this->next; \
92 dl_rm_next->prev = dl_rm_prev; \
93 dl_rm_prev->next = dl_rm_next; \
96 #define DLIST_ADD_HEAD(n,l) { \
97 dlist_t *dl_ah_list = l; \
98 dnode_t *dl_ah_node = n; \
99 dnode_t *dl_ah_head = dl_ah_list->head; \
100 dl_ah_node->next = dl_ah_head; \
101 dl_ah_node->prev = DLIST_H(dl_ah_list); \
102 dl_ah_list->head = dl_ah_node; \
103 dl_ah_head->prev = dl_ah_node; \
106 #define DLIST_ADD_TAIL(n,l) { \
107 dlist_t *dl_at_list = l; \
108 dnode_t *dl_at_node = n; \
109 dnode_t *dl_at_tail = dl_at_list->tail; \
110 dl_at_node->next = DLIST_T(dl_at_list); \
111 dl_at_node->prev = dl_at_tail; \
112 dl_at_tail->next = dl_at_node; \
113 dl_at_list->tail = dl_at_node; \
116 #define DLIST_INSERT(n,h) { \
117 dnode_t *dl_i_node = n; \
118 dnode_t *dl_i_here = h; \
119 dnode_t *dl_i_prev = dl_i_here->prev; \
120 dl_i_prev->next = dl_i_node; \
121 dl_i_here->prev = dl_i_node; \
122 dl_i_node->next = dl_i_here; \
123 dl_i_node->prev = dl_i_prev; \
126 #define DLIST_INIT(l) { \
127 dlist_t *dl_in_list = l; \
128 dl_in_list->head = DLIST_T(dl_in_list); \
129 dl_in_list->null = NULL; \
130 dl_in_list->tail = DLIST_H(dl_in_list); }
161 #define MM_ACCEL_MLIB 0x00000001
164 #define MM_ACCEL_X86_MMX 0x80000000
165 #define MM_ACCEL_X86_3DNOW 0x40000000
166 #define MM_ACCEL_X86_MMXEXT 0x20000000
167 #define MM_ACCEL_X86_SSE 0x10000000
168 #define MM_ACCEL_X86_SSE2 0x08000000
169 #define MM_ACCEL_X86_SSE3 0x04000000
170 #define MM_ACCEL_X86_SSSE3 0x02000000
171 #define MM_ACCEL_X86_SSE4 0x01000000
172 #define MM_ACCEL_X86_SSE42 0x00800000
173 #define MM_ACCEL_X86_AVX 0x00400000
176 #define MM_ACCEL_PPC_ALTIVEC 0x04000000
177 #define MM_ACCEL_PPC_CACHE32 0x02000000
181 #define MM_ACCEL_SPARC_VIS 0x01000000
182 #define MM_ACCEL_SPARC_VIS2 0x00800000
185 #define MM_MMX MM_ACCEL_X86_MMX
186 #define MM_3DNOW MM_ACCEL_X86_3DNOW
187 #define MM_MMXEXT MM_ACCEL_X86_MMXEXT
188 #define MM_SSE MM_ACCEL_X86_SSE
189 #define MM_SSE2 MM_ACCEL_X86_SSE2
198 extern void *(* xine_fast_memcpy)(
void *to,
const void *from,
size_t len)
XINE_PROTECTED;
201 #define xine_small_memcpy(xsm_to,xsm_from,xsm_len) memcpy (xsm_to, xsm_from, xsm_len)
203 #if (defined(__GNUC__) && (__GNUC__ >= 4)) || defined(__clang__)
204 # if defined(ARCH_X86)
205 # undef xine_small_memcpy
209 __asm__ __volatile__ (
211 :
"=S" (from),
"=D" (t2),
"=c" (l2),
"=m" (*(
struct {
char foo[len];} *)to)
212 :
"0" (from),
"1" (t2),
"2" (l2)
240 #if defined(__GNUC__)
241 # define xine_container_of(ptr, type, member) \
243 const typeof(((type *)0)->member) *__mptr = (ptr); \
244 (type *)((char *)__mptr - offsetof(type, member)); \
247 # define xine_container_of(ptr, type, member) \
248 ((type *)((char *)(1 ? (ptr) : &((type *)0)->member) - offsetof(type, member)))
264 void **p = (
void **)ptr;
286 #ifndef XINE_MEM_ALIGN
287 # define XINE_MEM_ALIGN 32
294 #define xine_freep_aligned(xinefreepptr) do {xine_free_aligned (*(xinefreepptr)); *(xinefreepptr) = NULL; } while (0)
324 #if defined(WIN32) || defined(__CYGWIN__)
346 #define xine_strpbrk(S, ACCEPT) strpbrk((S), (ACCEPT))
347 #define xine_strsep(STRINGP, DELIM) strsep((STRINGP), (DELIM))
348 #define xine_setenv(NAME, VAL, XX) setenv((NAME), (VAL), (XX))
408 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dest,
int y_dest_pitch,
409 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dest,
int u_dest_pitch,
410 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dest,
int v_dest_pitch,
413 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dest,
int y_dest_pitch,
414 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dest,
int u_dest_pitch,
415 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dest,
int v_dest_pitch,
418 (
const unsigned char *y_src,
int y_src_pitch,
419 const unsigned char *u_src,
int u_src_pitch,
420 const unsigned char *v_src,
int v_src_pitch,
421 unsigned char *yuy2_map,
int yuy2_pitch,
424 (
const unsigned char *yuy2_map,
int yuy2_pitch,
425 unsigned char *y_dst,
int y_dst_pitch,
426 unsigned char *u_dst,
int u_dst_pitch,
427 unsigned char *v_dst,
int v_dst_pitch,
432 #define SCALESHIFT 16
433 #define SCALEFACTOR (1<<SCALESHIFT)
434 #define CENTERSAMPLE 128
437 #define COMPUTE_Y(r, g, b) \
439 ((y_r_table[r] + y_g_table[g] + y_b_table[b]) >> SCALESHIFT)
440 #define COMPUTE_U(r, g, b) \
442 ((u_r_table[r] + u_g_table[g] + uv_br_table[b]) >> SCALESHIFT)
443 #define COMPUTE_V(r, g, b) \
445 ((uv_br_table[r] + v_g_table[g] + v_b_table[b]) >> SCALESHIFT)
460 #define UNPACK_BGR15(packed_pixel, r, g, b) \
461 b = (packed_pixel & 0x7C00) >> 7; \
462 g = (packed_pixel & 0x03E0) >> 2; \
463 r = (packed_pixel & 0x001F) << 3;
465 #define UNPACK_BGR16(packed_pixel, r, g, b) \
466 b = (packed_pixel & 0xF800) >> 8; \
467 g = (packed_pixel & 0x07E0) >> 3; \
468 r = (packed_pixel & 0x001F) << 3;
470 #define UNPACK_RGB15(packed_pixel, r, g, b) \
471 r = (packed_pixel & 0x7C00) >> 7; \
472 g = (packed_pixel & 0x03E0) >> 2; \
473 b = (packed_pixel & 0x001F) << 3;
475 #define UNPACK_RGB16(packed_pixel, r, g, b) \
476 r = (packed_pixel & 0xF800) >> 8; \
477 g = (packed_pixel & 0x07E0) >> 3; \
478 b = (packed_pixel & 0x001F) << 3;
504 uint8_t *y_dst,
int y_pitch,
505 uint8_t *u_dst,
int u_pitch,
506 uint8_t *v_dst,
int v_pitch,
511 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dst,
int y_dst_pitch,
512 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dst,
int u_dst_pitch,
513 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dst,
int v_dst_pitch,
516 (
const unsigned char *src,
int src_pitch,
517 unsigned char *dst,
int dst_pitch,
521 const uint8_t *uv_src,
int uv_src_pitch,
522 uint8_t *y_dst,
int y_dst_pitch,
523 uint8_t *u_dst,
int u_dst_pitch,
524 uint8_t *v_dst,
int v_dst_pitch,
534 #if !defined(__GNUC__) || __GNUC__ < 3
535 # define EXPECT_TRUE(x) (x)
536 # define EXPECT_FALSE(x) (x)
538 # define EXPECT_TRUE(x) __builtin_expect((x),1)
539 # define EXPECT_FALSE(x) __builtin_expect((x),0)
543 #define _x_assert(exp) \
546 fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \
547 __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \
550 #define _x_assert(exp) \
553 fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \
554 __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \
563 fprintf(stderr, "abort: %s:%d: %s: Aborting.\n", \
564 __FILE__, __LINE__, __XINE_FUNCTION__); \
566 _x_abort_is_deprecated(); \
573 #define LOG_MODULE __FILE__
576 #define LOG_MODULE_STRING printf("%s: ", LOG_MODULE );
579 #define LONG_LOG_MODULE_STRING \
580 printf("%s: (%s:%d) ", LOG_MODULE, __XINE_FUNCTION__, __LINE__ );
582 #define LONG_LOG_MODULE_STRING LOG_MODULE_STRING
586 #if defined(__GNUC__) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
587 #define lprintf(fmt, args...) \
589 LONG_LOG_MODULE_STRING \
590 printf(fmt, ##args); \
595 #define lprintf(fmtargs) \
597 LONG_LOG_MODULE_STRING \
598 printf("%s", fmtargs); \
602 #define lprintf(...) \
604 LONG_LOG_MODULE_STRING \
605 printf(__VA_ARGS__); \
611 #if defined(DEBUG) && defined(XINE_COMPILE)
613 #elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
614 #define lprintf(...) do {} while(0)
615 #elif defined(__GNUC__)
616 #define lprintf(fmt, args...) do {} while(0)
617 #elif defined(_MSC_VER)
618 void __inline
lprintf(
const char *
fmt, ...) {}
620 #define lprintf(...) do {} while(0)
624 #if defined(__GNUC__) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
625 #define llprintf(cat, fmt, args...) \
628 LONG_LOG_MODULE_STRING \
629 printf( fmt, ##args ); \
634 #define llprintf(cat, fmtargs) \
637 LONG_LOG_MODULE_STRING \
638 printf( "%s", fmtargs ); \
642 #define llprintf(cat, ...) \
645 LONG_LOG_MODULE_STRING \
646 printf( __VA_ARGS__ ); \
652 #if defined(__GNUC__) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901L)
653 #define xprintf(xine, verbose, fmt, args...) \
655 if((xine) && (xine)->verbosity >= verbose){ \
656 xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \
661 void xine_xprintf(
xine_t *xine,
int verbose,
const char *
fmt, ...);
662 #define xprintf xine_xprintf
664 #define xprintf(xine, verbose, ...) \
666 if((xine) && (xine)->verbosity >= verbose){ \
667 xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \
676 # define XINE_PROFILE(function) \
678 struct timeval current_time; \
680 gettimeofday(¤t_time, NULL); \
681 dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \
683 gettimeofday(¤t_time, NULL); \
684 dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \
685 printf("%s: (%s:%d) took %lf seconds\n", \
686 LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \
688 # define XINE_PROFILE_ACCUMULATE(function) \
690 struct timeval current_time; \
691 static double dtime = 0; \
692 gettimeofday(¤t_time, NULL); \
693 dtime -= current_time.tv_sec + (current_time.tv_usec / 1000000.0); \
695 gettimeofday(¤t_time, NULL); \
696 dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \
697 printf("%s: (%s:%d) took %lf seconds\n", \
698 LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \
701 # define XINE_PROFILE(function) function
702 # define XINE_PROFILE_ACCUMULATE(function) function
Definition: xine_internal.h:80
Definition: xineutils.h:137
void * xine_xcalloc(size_t nmemb, size_t size)
Wrapper around calloc() function.
Definition: utils.c:296
dnode_t *volatile tail
Definition: xineutils.h:82
char * xine_strcat_realloc(char **dest, const char *append)
Definition: utils.c:775
Definition: xineutils.h:64
int xine_socket_cloexec(int domain, int type, int protocol)
Definition: utils.c:837
char * locked_by
Definition: xineutils.h:140
int xine_profiler_allocate_slot(const char *label)
Definition: monitor.c:51
void xine_profiler_stop_count(int id)
Definition: monitor.c:96
#define XINE_MALLOC
Definition: attributes.h:139
unsigned int row_count
Definition: xineutils.h:397
rgb2yuy2_t * rgb2yuy2_alloc(int color_matrix, const char *format)
Definition: color.c:1768
void xine_profiler_start_count(int id)
Definition: monitor.c:88
int xine_cpu_count(void) XINE_CONST
Definition: cpu_accel.c:489
char * _x_asprintf(const char *format,...) XINE_FORMAT_PRINTF(1
void(* yuy2_to_yv12)(const unsigned char *yuy2_map, int yuy2_pitch, unsigned char *y_dst, int y_dst_pitch, unsigned char *u_dst, int u_dst_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height)
Definition: color.c:110
int xine_mutex_init(xine_mutex_t *mutex, const pthread_mutexattr_t *mutexattr, const char *id)
Definition: xine_mutex.c:33
void(* yuv9_to_yv12)(const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
Definition: color.c:94
void rgb2yuy2_free(rgb2yuy2_t *rgb2yuy2)
Definition: color.c:1943
int y_r_table[256]
Definition: color.c:78
char int xine_open_cloexec(const char *name, int flags)
Definition: utils.c:815
void * xine_mallocz_aligned(size_t size)
Definition: utils.c:856
void xine_profiler_init(void)
Definition: monitor.c:45
void(* yv12_to_yuy2)(const unsigned char *y_src, int y_src_pitch, const unsigned char *u_src, int u_src_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *yuy2_map, int yuy2_pitch, int width, int height, int progressive)
Definition: color.c:104
int v_g_table[256]
Definition: color.c:87
void _x_report_audio_format_tag(xine_t *, const char *module, uint32_t)
Definition: buffer_types.c:627
char * xine_get_system_encoding(void)
Definition: utils.c:646
#define lprintf(...)
Definition: xineutils.h:620
const char * xine_guess_spu_encoding(void)
Definition: utils.c:694
void rgb2yv12_slice(rgb2yuy2_t *rgb2yuy2, const uint8_t *src, int src_stride, uint8_t *y_dst, int y_pitch, uint8_t *u_dst, int u_pitch, uint8_t *v_dst, int v_pitch, int width, int height)
Definition: color.c:2231
void(* yuv444_to_yuy2)(const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch)
Definition: color.c:92
int xine_create_cloexec(const char *name, int flags, mode_t mode)
Definition: utils.c:826
int v_b_table[256]
Definition: color.c:86
void rgb2yuy2_palette(rgb2yuy2_t *rgb2yuy2, const uint8_t *pal, int num_colors, int bits_per_pixel)
Definition: color.c:1947
int u_r_table[256]
Definition: color.c:84
unsigned char * u
Definition: xineutils.h:394
NULL
Definition: xine_plugin.c:78
#define xine_small_memcpy(xsm_to, xsm_from, xsm_len)
Definition: xineutils.h:201
static XINE_DEPRECATED void _x_abort_is_deprecated(void)
Definition: xineutils.h:560
static void _x_freep_wipe_string(char **pp)
Definition: xineutils.h:269
static void _x_freep(void *ptr)
Definition: xineutils.h:263
int fmt
Definition: color.c:1758
uint32_t xine_crc32_ieee(uint32_t crc, const uint8_t *data, size_t len)
Definition: utils.c:998
unsigned int width
Definition: gfontrle.c:4
int u_g_table[256]
Definition: color.c:85
int u_b_table[256]
Definition: color.c:89
int y_b_table[256]
Definition: color.c:80
void xine_hexdump(const void *buf, int length)
Definition: utils.c:576
void * xine_memdup0(const void *src, size_t length)
Definition: utils.c:317
void(* yuv411_to_yv12)(const unsigned char *y_src, int y_src_pitch, unsigned char *y_dest, int y_dest_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dest, int u_dest_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dest, int v_dest_pitch, int width, int height)
Definition: color.c:99
size_t xine_base64_encode(uint8_t *from, char *to, size_t size)
Definition: utils.c:918
void * xine_memdup(const void *src, size_t length)
Definition: utils.c:308
int v_r_table[256]
Definition: color.c:90
void _x_nv12_to_yv12(const uint8_t *y_src, int y_src_pitch, const uint8_t *uv_src, int uv_src_pitch, uint8_t *y_dst, int y_dst_pitch, uint8_t *u_dst, int u_dst_pitch, uint8_t *v_dst, int v_dst_pitch, int width, int height)
void xine_usec_sleep(unsigned usec)
Definition: utils.c:546
int xine_mutex_lock(xine_mutex_t *mutex, const char *who)
Definition: xine_mutex.c:46
#define XINE_FORMAT_PRINTF(fmt, var)
Definition: attributes.h:127
void * xine_realloc_aligned(void *ptr, size_t size)
Definition: utils.c:890
void init_yuv_conversion(void)
Definition: color.c:1686
#define XINE_CONST
Definition: attributes.h:151
uint32_t xine_crc16_ansi(uint32_t crc, const uint8_t *data, size_t len)
Definition: utils.c:1071
#define XINE_DEPRECATED
Definition: attributes.h:85
Definition: xineutils.h:79
int xine_monotonic_clock(struct timeval *tv, struct timezone *tz)
Definition: utils.c:727
int y_g_table[256]
Definition: color.c:79
const char name[16]
Definition: memcpy.c:569
pthread_mutex_t mutex
Definition: xineutils.h:138
unsigned int height
Definition: gfontrle.c:5
int xine_mutex_destroy(xine_mutex_t *mutex)
Definition: xine_mutex.c:78
void * xine_malloc_aligned(size_t size)
Definition: utils.c:869
struct dnode_st * prev
Definition: xineutils.h:65
void * xine_xmalloc(size_t size) XINE_DEPRECATED
Allocate and clean memory size_t 'size', then return the pointer to the allocated memory.
Definition: utils.c:271
enable disable number of frames of telecine pattern sync required before mode change make frames evenly spaced for film mode(24 fps)" ) PARAM_ITEM( POST_PARAM_TYPE_BOOL
size_t xine_base64_decode(const char *from, uint8_t *to)
Definition: utils.c:943
uint32_t xine_mm_accel(void) XINE_CONST
Definition: cpu_accel.c:390
Definition: xineutils.h:391
dnode_t *volatile head
Definition: xineutils.h:80
void yv12_to_yv12(const unsigned char *y_src, int y_src_pitch, unsigned char *y_dst, int y_dst_pitch, const unsigned char *u_src, int u_src_pitch, unsigned char *u_dst, int u_dst_pitch, const unsigned char *v_src, int v_src_pitch, unsigned char *v_dst, int v_dst_pitch, int width, int height)
Definition: copy.c:48
struct dnode_st * next
Definition: xineutils.h:65
unsigned char * y
Definition: xineutils.h:393
void free_yuv_planes(yuv_planes_t *yuv_planes)
Definition: color.c:140
char * xine_chomp(char *str)
Definition: utils.c:525
#define XINE_PROTECTED
Definition: attributes.h:73
unsigned char * v
Definition: xineutils.h:395
void yuy2_to_yuy2(const unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch, int width, int height)
Definition: copy.c:59
void rgb2yuy2_slice(rgb2yuy2_t *rgb2yuy2, const uint8_t *in, int ipitch, uint8_t *out, int opitch, int width, int height)
int uv_br_table[256]
Definition: color.c:82
void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height)
Definition: color.c:122
const char * xine_get_homedir(void)
Definition: utils.c:380
unsigned int row_width
Definition: xineutils.h:396
void _x_report_video_fourcc(xine_t *, const char *module, uint32_t)
Definition: buffer_types.c:615
void xine_free_aligned(void *ptr)
Definition: utils.c:882
int xine_mutex_unlock(xine_mutex_t *mutex, const char *who)
Definition: xine_mutex.c:71
struct yuv_planes_s yuv_planes_t
void xine_profiler_print_results(void)
Definition: monitor.c:105