34 # include <sys/time.h> 53 #if defined(WIN32) && !defined(XINE_LIBRARY_COMPILE) 54 # define DL_IMPORT __declspec(dllimport) 55 # define extern DL_IMPORT extern 62 #define DLIST_IS_EMPTY(l) ((void *)((l)->head) == (void *)(&(l)->null)) 64 #define DLIST_REMOVE(n) { \ 65 dnode_t *dl_rm_this = (dnode_t *)(n); \ 66 dnode_t *dl_rm_prev = dl_rm_this->prev; \ 67 dnode_t *dl_rm_next = dl_rm_this->next; \ 68 dl_rm_next->prev = dl_rm_prev; \ 69 dl_rm_prev->next = dl_rm_next; \ 72 #define DLIST_ADD_HEAD(n,l) { \ 73 dlist_t *dl_ah_list = (dlist_t *)(l); \ 74 dnode_t *dl_ah_node = (dnode_t *)(n); \ 75 dnode_t *dl_ah_head = dl_ah_list->head; \ 76 dl_ah_node->next = dl_ah_head; \ 77 dl_ah_node->prev = (void *)dl_ah_list; \ 78 dl_ah_list->head = dl_ah_node; \ 79 dl_ah_head->prev = dl_ah_node; \ 82 #define DLIST_ADD_TAIL(n,l) { \ 83 dlist_t *dl_at_list = (dlist_t *)(l); \ 84 dnode_t *dl_at_node = (dnode_t *)(n); \ 85 dnode_t *dl_at_tail = dl_at_list->tail; \ 86 dl_at_node->next = (void *)(&dl_at_list->null); \ 87 dl_at_node->prev = dl_at_tail; \ 88 dl_at_tail->next = dl_at_node; \ 89 dl_at_list->tail = dl_at_node; \ 92 #define DLIST_INIT(l) { \ 93 dlist_t *dl_in_list = (dlist_t *)(l); \ 94 dl_in_list->head = (void *)(&dl_in_list->null); \ 95 dl_in_list->null = NULL; \ 96 dl_in_list->tail = (void *)(&dl_in_list->head); } 135 #define MM_ACCEL_MLIB 0x00000001 138 #define MM_ACCEL_X86_MMX 0x80000000 139 #define MM_ACCEL_X86_3DNOW 0x40000000 140 #define MM_ACCEL_X86_MMXEXT 0x20000000 141 #define MM_ACCEL_X86_SSE 0x10000000 142 #define MM_ACCEL_X86_SSE2 0x08000000 143 #define MM_ACCEL_X86_SSE3 0x04000000 144 #define MM_ACCEL_X86_SSSE3 0x02000000 145 #define MM_ACCEL_X86_SSE4 0x01000000 146 #define MM_ACCEL_X86_SSE42 0x00800000 147 #define MM_ACCEL_X86_AVX 0x00400000 150 #define MM_ACCEL_PPC_ALTIVEC 0x04000000 151 #define MM_ACCEL_PPC_CACHE32 0x02000000 155 #define MM_ACCEL_SPARC_VIS 0x01000000 156 #define MM_ACCEL_SPARC_VIS2 0x00800000 159 #define MM_MMX MM_ACCEL_X86_MMX 160 #define MM_3DNOW MM_ACCEL_X86_3DNOW 161 #define MM_MMXEXT MM_ACCEL_X86_MMXEXT 162 #define MM_SSE MM_ACCEL_X86_SSE 163 #define MM_SSE2 MM_ACCEL_X86_SSE2 171 extern void *(* xine_fast_memcpy)(
void *to,
const void *from,
size_t len)
XINE_PROTECTED;
198 void **p = (
void **)ptr;
213 #ifndef XINE_MEM_ALIGN 214 # define XINE_MEM_ALIGN 32 221 #define xine_freep_aligned(xinefreepptr) do {xine_free_aligned (*(xinefreepptr)); *(xinefreepptr) = NULL; } while (0) 251 #if defined(WIN32) || defined(__CYGWIN__) 273 #define xine_strpbrk(S, ACCEPT) strpbrk((S), (ACCEPT)) 274 #define xine_strsep(STRINGP, DELIM) strsep((STRINGP), (DELIM)) 275 #define xine_setenv(NAME, VAL, XX) setenv((NAME), (VAL), (XX)) 335 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dest,
int y_dest_pitch,
336 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dest,
int u_dest_pitch,
337 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dest,
int v_dest_pitch,
340 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dest,
int y_dest_pitch,
341 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dest,
int u_dest_pitch,
342 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dest,
int v_dest_pitch,
345 (
const unsigned char *y_src,
int y_src_pitch,
346 const unsigned char *u_src,
int u_src_pitch,
347 const unsigned char *v_src,
int v_src_pitch,
348 unsigned char *yuy2_map,
int yuy2_pitch,
351 (
const unsigned char *yuy2_map,
int yuy2_pitch,
352 unsigned char *y_dst,
int y_dst_pitch,
353 unsigned char *u_dst,
int u_dst_pitch,
354 unsigned char *v_dst,
int v_dst_pitch,
358 #define SCALESHIFT 16 359 #define SCALEFACTOR (1<<SCALESHIFT) 360 #define CENTERSAMPLE 128 363 #define COMPUTE_Y(r, g, b) \ 365 ((y_r_table[r] + y_g_table[g] + y_b_table[b]) >> SCALESHIFT) 366 #define COMPUTE_U(r, g, b) \ 368 ((u_r_table[r] + u_g_table[g] + uv_br_table[b]) >> SCALESHIFT) 369 #define COMPUTE_V(r, g, b) \ 371 ((uv_br_table[r] + v_g_table[g] + v_b_table[b]) >> SCALESHIFT) 386 #define UNPACK_BGR15(packed_pixel, r, g, b) \ 387 b = (packed_pixel & 0x7C00) >> 7; \ 388 g = (packed_pixel & 0x03E0) >> 2; \ 389 r = (packed_pixel & 0x001F) << 3; 391 #define UNPACK_BGR16(packed_pixel, r, g, b) \ 392 b = (packed_pixel & 0xF800) >> 8; \ 393 g = (packed_pixel & 0x07E0) >> 3; \ 394 r = (packed_pixel & 0x001F) << 3; 396 #define UNPACK_RGB15(packed_pixel, r, g, b) \ 397 r = (packed_pixel & 0x7C00) >> 7; \ 398 g = (packed_pixel & 0x03E0) >> 2; \ 399 b = (packed_pixel & 0x001F) << 3; 401 #define UNPACK_RGB16(packed_pixel, r, g, b) \ 402 r = (packed_pixel & 0xF800) >> 8; \ 403 g = (packed_pixel & 0x07E0) >> 3; \ 404 b = (packed_pixel & 0x001F) << 3; 423 extern void rgb2yuy2_slice (
void *rgb2yuy2,
const uint8_t *in,
int ipitch, uint8_t *out,
int opitch,
425 extern void rgb2yuy2_palette (
void *rgb2yuy2,
const uint8_t *pal,
int num_colors,
int bits_per_pixel)
431 (
const unsigned char *y_src,
int y_src_pitch,
unsigned char *y_dst,
int y_dst_pitch,
432 const unsigned char *u_src,
int u_src_pitch,
unsigned char *u_dst,
int u_dst_pitch,
433 const unsigned char *v_src,
int v_src_pitch,
unsigned char *v_dst,
int v_dst_pitch,
436 (
const unsigned char *src,
int src_pitch,
437 unsigned char *dst,
int dst_pitch,
447 #if !defined(__GNUC__) || __GNUC__ < 3 448 # define EXPECT_TRUE(x) (x) 449 # define EXPECT_FALSE(x) (x) 451 # define EXPECT_TRUE(x) __builtin_expect((x),1) 452 # define EXPECT_FALSE(x) __builtin_expect((x),0) 456 #define _x_assert(exp) \ 459 fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \ 460 __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \ 463 #define _x_assert(exp) \ 466 fprintf(stderr, "assert: %s:%d: %s: Assertion `%s' failed.\n", \ 467 __FILE__, __LINE__, __XINE_FUNCTION__, #exp); \ 475 fprintf(stderr, "abort: %s:%d: %s: Aborting.\n", \ 476 __FILE__, __LINE__, __XINE_FUNCTION__); \ 484 #define LOG_MODULE __FILE__ 487 #define LOG_MODULE_STRING printf("%s: ", LOG_MODULE ); 490 #define LONG_LOG_MODULE_STRING \ 491 printf("%s: (%s:%d) ", LOG_MODULE, __XINE_FUNCTION__, __LINE__ ); 493 #define LONG_LOG_MODULE_STRING LOG_MODULE_STRING 498 #define lprintf(fmt, args...) \ 500 LONG_LOG_MODULE_STRING \ 501 printf(fmt, ##args); \ 506 #define lprintf(fmtargs) \ 508 LONG_LOG_MODULE_STRING \ 509 printf("%s", fmtargs); \ 513 #define lprintf(...) \ 515 LONG_LOG_MODULE_STRING \ 516 printf(__VA_ARGS__); \ 524 #define lprintf(fmt, args...) \ 525 do { if (0) { printf(fmt, ##args); } } while(0) 527 #define lprintf(fmt, args...) do {} while(0) 531 void __inline
lprintf(
const char * fmt, ...) {}
533 #define lprintf(...) do {} while(0) 539 #define llprintf(cat, fmt, args...) \ 542 LONG_LOG_MODULE_STRING \ 543 printf( fmt, ##args ); \ 548 #define llprintf(cat, fmtargs) \ 551 LONG_LOG_MODULE_STRING \ 552 printf( "%s", fmtargs ); \ 556 #define llprintf(cat, ...) \ 559 LONG_LOG_MODULE_STRING \ 560 printf( __VA_ARGS__ ); \ 567 #define xprintf(xine, verbose, fmt, args...) \ 569 if((xine) && (xine)->verbosity >= verbose){ \ 570 xine_log(xine, XINE_LOG_TRACE, fmt, ##args); \ 575 void xine_xprintf(
xine_t *xine,
int verbose,
const char *fmt, ...);
576 #define xprintf xine_xprintf 578 #define xprintf(xine, verbose, ...) \ 580 if((xine) && (xine)->verbosity >= verbose){ \ 581 xine_log(xine, XINE_LOG_TRACE, __VA_ARGS__); \ 590 # define XINE_PROFILE(function) \ 592 struct timeval current_time; \ 594 gettimeofday(¤t_time, NULL); \ 595 dtime = -(current_time.tv_sec + (current_time.tv_usec / 1000000.0)); \ 597 gettimeofday(¤t_time, NULL); \ 598 dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ 599 printf("%s: (%s:%d) took %lf seconds\n", \ 600 LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ 602 # define XINE_PROFILE_ACCUMULATE(function) \ 604 struct timeval current_time; \ 605 static double dtime = 0; \ 606 gettimeofday(¤t_time, NULL); \ 607 dtime -= current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ 609 gettimeofday(¤t_time, NULL); \ 610 dtime += current_time.tv_sec + (current_time.tv_usec / 1000000.0); \ 611 printf("%s: (%s:%d) took %lf seconds\n", \ 612 LOG_MODULE, __XINE_FUNCTION__, __LINE__, dtime); \ 615 # define XINE_PROFILE(function) function 616 # define XINE_PROFILE_ACCUMULATE(function) function void yuy2_to_yuy2(const unsigned char *src, int src_pitch, unsigned char *dst, int dst_pitch, int width, int height)
Definition: copy.c:68
unsigned int height
Definition: gfontrle.c:5
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
int xine_socket_cloexec(int domain, int type, int protocol)
Definition: utils.c:837
void xine_profiler_stop_count(int id)
Definition: monitor.c:96
#define XINE_MALLOC
Definition: attributes.h:119
void xine_free_aligned(void *ptr)
Definition: utils.c:882
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:102
void xine_profiler_start_count(int id)
Definition: monitor.c:88
Definition: xineutils.h:98
char * _x_asprintf(const char *format,...) XINE_FORMAT_PRINTF(1
int y_r_table[256]
Definition: color.c:76
void * xine_xcalloc(size_t nmemb, size_t size)
Wrapper around calloc() function.
Definition: utils.c:296
int xine_profiler_allocate_slot(const char *label)
Definition: monitor.c:51
NULL
Definition: xine_plugin.c:91
int xine_create_cloexec(const char *name, int flags, mode_t mode)
Definition: utils.c:826
void * xine_mallocz_aligned(size_t size)
Definition: utils.c:856
void xine_profiler_init(void)
Definition: monitor.c:45
char * locked_by
Definition: xineutils.h:114
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:108
void rgb2yuy2_free(void *rgb2yuy2)
Definition: color.c:1905
unsigned char * y
Definition: xineutils.h:320
static void _x_freep(void *ptr)
Definition: xineutils.h:197
unsigned char * u
Definition: xineutils.h:321
char * xine_get_system_encoding(void)
Definition: utils.c:646
void rgb2yuy2_slice(void *rgb2yuy2, const uint8_t *in, int ipitch, uint8_t *out, int opitch, int width, int height)
Definition: color.c:2009
const char * xine_guess_spu_encoding(void)
Definition: utils.c:694
char int xine_open_cloexec(const char *name, int flags)
Definition: utils.c:815
void(* yuv444_to_yuy2)(const yuv_planes_t *yuv_planes, unsigned char *yuy2_map, int pitch)
Definition: color.c:90
size_t xine_base64_encode(uint8_t *from, char *to, size_t size)
Definition: utils.c:918
int v_g_table[256]
Definition: color.c:85
int u_r_table[256]
Definition: color.c:82
void _x_report_audio_format_tag(xine_t *, const char *module, uint32_t)
Definition: buffer_types.c:1350
dnode_t * tail
Definition: xineutils.h:103
#define lprintf(...)
Definition: xineutils.h:533
uint32_t xine_crc32_ieee(uint32_t crc, const uint8_t *data, size_t len)
Definition: utils.c:998
int u_g_table[256]
Definition: color.c:83
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:44
pthread_mutex_t mutex
Definition: xineutils.h:112
#define XINE_DEPRECATED
Definition: attributes.h:85
struct yuv_planes_s yuv_planes_t
int v_b_table[256]
Definition: color.c:84
void * xine_memdup(const void *src, size_t length)
Definition: utils.c:308
struct dnode_st * prev
Definition: xineutils.h:99
#define XINE_FORMAT_PRINTF(fmt, var)
Definition: attributes.h:107
#define XINE_CONST
Definition: attributes.h:131
int y_b_table[256]
Definition: color.c:78
void xine_hexdump(const void *buf, int length)
Definition: utils.c:576
unsigned int row_count
Definition: xineutils.h:324
void init_yuv_conversion(void)
Definition: color.c:1648
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:97
int v_r_table[256]
Definition: color.c:88
void * rgb2yuy2_alloc(int color_matrix, const char *format)
Definition: color.c:1730
unsigned char * v
Definition: xineutils.h:322
int u_b_table[256]
Definition: color.c:87
uint32_t xine_crc16_ansi(uint32_t crc, const uint8_t *data, size_t len)
Definition: utils.c:1071
Definition: xineutils.h:102
#define XINE_PROTECTED
Definition: attributes.h:73
unsigned int width
Definition: gfontrle.c:4
void * xine_realloc_aligned(void *ptr, size_t size)
Definition: utils.c:890
Definition: xine_internal.h:81
size_t xine_base64_decode(const char *from, uint8_t *to)
Definition: utils.c:943
struct dnode_st * next
Definition: xineutils.h:99
char * xine_chomp(char *str)
Definition: utils.c:525
const char * xine_get_homedir(void)
Definition: utils.c:380
int xine_monotonic_clock(struct timeval *tv, struct timezone *tz)
Definition: utils.c:727
int y_g_table[256]
Definition: color.c:77
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:31
int xine_mutex_destroy(xine_mutex_t *mutex)
Definition: xine_mutex.c:75
void * xine_malloc_aligned(size_t size)
Definition: utils.c:869
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
void free_yuv_planes(yuv_planes_t *yuv_planes)
Definition: color.c:138
Definition: xineutils.h:111
unsigned int row_width
Definition: xineutils.h:323
uint32_t xine_mm_accel(void) XINE_CONST
Definition: cpu_accel.c:380
void _x_report_video_fourcc(xine_t *, const char *module, uint32_t)
Definition: buffer_types.c:1338
char * xine_strcat_realloc(char **dest, char *append)
Definition: utils.c:775
Definition: xineutils.h:318
void rgb2yuy2_palette(void *rgb2yuy2, const uint8_t *pal, int num_colors, int bits_per_pixel)
Definition: color.c:1909
int xine_mutex_unlock(xine_mutex_t *mutex, const char *who)
Definition: xine_mutex.c:68
int uv_br_table[256]
Definition: color.c:80
void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height)
Definition: color.c:120
void xine_profiler_print_results(void)
Definition: monitor.c:105
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:92