diff options
author | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-11-17 14:26:36 +0000 |
---|---|---|
committer | Daniel Caujolle-Bert <f1rmb@users.sourceforge.net> | 2001-11-17 14:26:36 +0000 |
commit | bacac99192b65faed1a0047a8be5b95abf15873d (patch) | |
tree | c1ca0949f9cb222c8ef6305d8150ca4d9e85b4a7 /src/xine-utils | |
parent | 75a1024fb27dbff9c4bfc948392910af94797683 (diff) | |
download | xine-lib-bacac99192b65faed1a0047a8be5b95abf15873d.tar.gz xine-lib-bacac99192b65faed1a0047a8be5b95abf15873d.tar.bz2 |
Add 'xine_' prefix to all of xine-utils functions (what about cpu
acceleration?). Merge xine-utils header files to a new one "xineutils.h".
Update xine-lib C/headers to reflect those changes.
dxr3 headers are no more installed ine $includdir, but $includdir/xine.
CVS patchset: 1054
CVS date: 2001/11/17 14:26:36
Diffstat (limited to 'src/xine-utils')
-rw-r--r-- | src/xine-utils/Makefile.am | 5 | ||||
-rw-r--r-- | src/xine-utils/attributes.h | 1 | ||||
-rw-r--r-- | src/xine-utils/cpu_accel.c | 11 | ||||
-rw-r--r-- | src/xine-utils/memcpy.c | 14 | ||||
-rw-r--r-- | src/xine-utils/memcpy.h | 33 | ||||
-rw-r--r-- | src/xine-utils/monitor.c | 15 | ||||
-rw-r--r-- | src/xine-utils/monitor.h | 115 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 14 | ||||
-rw-r--r-- | src/xine-utils/utils.h | 52 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h (renamed from src/xine-utils/cpu_accel.h) | 159 |
10 files changed, 166 insertions, 253 deletions
diff --git a/src/xine-utils/Makefile.am b/src/xine-utils/Makefile.am index 29ef6eef0..a5a9f60c3 100644 --- a/src/xine-utils/Makefile.am +++ b/src/xine-utils/Makefile.am @@ -2,7 +2,7 @@ ## Process this file with automake to produce Makefile.in ## -CFLAGS = @GLOBAL_CFLAGS@ @THREAD_CFLAGS@ +CFLAGS = @GLOBAL_CFLAGS@ @THREAD_CFLAGS@ -DXINEUTILS_COMPILE EXTRA_DIST = cpu_accel.c @@ -19,7 +19,8 @@ libxineutils_la_LDFLAGS = \ -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) \ -release $(LT_RELEASE) -include_HEADERS = attributes.h cpu_accel.h memcpy.h utils.h monitor.h +noinst_HEADERS = attributes.h +include_HEADERS = xineutils.h ### # Hardcoded rule: diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h index 8ed7aef9e..7c190476b 100644 --- a/src/xine-utils/attributes.h +++ b/src/xine-utils/attributes.h @@ -20,6 +20,7 @@ */ //use gcc attribs to align critical data structures + #ifdef ATTRIBUTE_ALIGNED_MAX #define ATTR_ALIGN(align) __attribute__ ((__aligned__ ((ATTRIBUTE_ALIGNED_MAX < align) ? ATTRIBUTE_ALIGNED_MAX : align))) #else diff --git a/src/xine-utils/cpu_accel.c b/src/xine-utils/cpu_accel.c index 8c28d950a..b463b3140 100644 --- a/src/xine-utils/cpu_accel.c +++ b/src/xine-utils/cpu_accel.c @@ -18,13 +18,14 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#define XINEUTILS_COMPILE #include "config.h" #include <inttypes.h> #include "attributes.h" -#include "cpu_accel.h" +#include "xineutils.h" #ifdef ARCH_X86 static uint32_t x86_accel (void) @@ -97,7 +98,7 @@ static uint32_t x86_accel (void) } #endif -uint32_t mm_accel (void) +uint32_t xine_mm_accel (void) { #ifdef ARCH_X86 static int got_accel = 0; @@ -118,7 +119,9 @@ uint32_t mm_accel (void) #endif } -uint32_t mm_support (void) +/* +uint32_t xine_mm_support (void) { - return mm_accel(); + return xine_mm_accel(); } +*/ diff --git a/src/xine-utils/memcpy.c b/src/xine-utils/memcpy.c index 2d644d4a9..39cbad416 100644 --- a/src/xine-utils/memcpy.c +++ b/src/xine-utils/memcpy.c @@ -38,9 +38,9 @@ #include <signal.h> #include <setjmp.h> #include "xine_internal.h" -#include "cpu_accel.h" +#include "xineutils.h" -void *(* fast_memcpy)(void *to, const void *from, size_t len); +void *(* xine_fast_memcpy)(void *to, const void *from, size_t len); /* Original comments from mplayer (file: aclib.c) This part of code was taken by me from Linux-2.4.3 and slightly modified @@ -401,7 +401,7 @@ static void sigill_handler (int n) { #define BUFSIZE 1024*1024 -void probe_fast_memcpy(config_values_t *config) +void xine_probe_fast_memcpy(config_values_t *config) { unsigned long long t; char *buf1, *buf2; @@ -409,7 +409,7 @@ void probe_fast_memcpy(config_values_t *config) static int config_flags = -1; #ifdef ARCH_X86 - config_flags = mm_accel(); + config_flags = xine_mm_accel(); #else config_flags = 0; #endif @@ -420,13 +420,13 @@ void probe_fast_memcpy(config_values_t *config) (config_flags & memcpy_method[best].cpu_require) == memcpy_method[best].cpu_require ) { printf("xine: using %s\n", memcpy_method[best].name ); - fast_memcpy = memcpy_method[best].function; + xine_fast_memcpy = memcpy_method[best].function; return; } best = -1; - fast_memcpy = memcpy; + xine_fast_memcpy = memcpy; if( (buf1 = malloc(BUFSIZE)) == NULL ) return; @@ -468,7 +468,7 @@ void probe_fast_memcpy(config_values_t *config) best = i; } printf("xine: using %s\n", memcpy_method[best].name ); - fast_memcpy = memcpy_method[best].function; + xine_fast_memcpy = memcpy_method[best].function; config->set_int (config, "fast_memcpy", best ); free(buf1); diff --git a/src/xine-utils/memcpy.h b/src/xine-utils/memcpy.h deleted file mode 100644 index a693f37fe..000000000 --- a/src/xine-utils/memcpy.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2000-2001 the xine project - * - * This file is part of xine, a unix 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 - * - */ - -#ifndef HAVE_MEMCPY_H -#define HAVE_MEMCPY_H - -/* optimized/fast memcpy */ -extern void *(* fast_memcpy)(void *to, const void *from, size_t len); - -#ifdef HAVE_XINE_INTERNAL_H -/* benchmark available memcpy methods */ -void probe_fast_memcpy(config_values_t *config); -#endif - -#endif diff --git a/src/xine-utils/monitor.c b/src/xine-utils/monitor.c index 9250ee2c4..f780baa77 100644 --- a/src/xine-utils/monitor.c +++ b/src/xine-utils/monitor.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: monitor.c,v 1.1 2001/10/22 00:52:10 guenter Exp $ + * $Id: monitor.c,v 1.2 2001/11/17 14:26:39 f1rmb Exp $ * * debug print and profiling functions - implementation * @@ -29,8 +29,7 @@ #include <stdio.h> #include <sys/time.h> -#include "utils.h" -#include "monitor.h" +#include "xineutils.h" #define MAX_ID 10 @@ -41,7 +40,7 @@ long long int profiler_start[MAX_ID] ; long profiler_calls[MAX_ID] ; char * profiler_label[MAX_ID] ; -void profiler_init () { +void xine_profiler_init () { int i; for (i=0; i<MAX_ID; i++) { profiler_times[i] = 0; @@ -51,7 +50,7 @@ void profiler_init () { } } -int profiler_allocate_slot (char *label) { +int xine_profiler_allocate_slot (char *label) { int id; for (id = 0; id < MAX_ID && profiler_label[id] != NULL; id++) @@ -74,7 +73,7 @@ __inline__ unsigned long long int rdtsc() } #endif -void profiler_start_count (int id) { +void xine_profiler_start_count (int id) { if ((unsigned)id >= MAX_ID) return; @@ -83,7 +82,7 @@ void profiler_start_count (int id) { #endif } -void profiler_stop_count (int id) { +void xine_profiler_stop_count (int id) { if ((unsigned)id >= MAX_ID) return; @@ -93,7 +92,7 @@ void profiler_stop_count (int id) { profiler_calls[id]++; } -void profiler_print_results () { +void xine_profiler_print_results () { int i; #ifdef ARCH_X86 diff --git a/src/xine-utils/monitor.h b/src/xine-utils/monitor.h deleted file mode 100644 index fa1e3b359..000000000 --- a/src/xine-utils/monitor.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (C) 2000-2001 the xine project - * - * This file is part of xine, a unix 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: monitor.h,v 1.2 2001/10/23 21:33:43 jcdutton Exp $ - * - * debug print and profiling functions - * - */ - -#ifndef HAVE_MONITOR_H -#define HAVE_MONITOR_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include <inttypes.h> - -extern uint32_t xine_debug; - -#define VERBOSE (xine_debug & 0x8000>>1) // 16384 -#define METRONOM (xine_debug & 0x8000>>2) // 8192 -#define AUDIO (xine_debug & 0x8000>>3) // 4096 -#define DEMUX (xine_debug & 0x8000>>4) // 2048 -#define INPUT (xine_debug & 0x8000>>5) // 1024 -#define VIDEO (xine_debug & 0x8000>>6) // 512 -#define VPTS (xine_debug & 0x8000>>7) // 256 -#define MPEG (xine_debug & 0x8000>>8) // 128 -#define VAVI (xine_debug & 0x8000>>9) // 64 -#define AC3 (xine_debug & 0x8000>>10) // 32 -#define LOOP (xine_debug & 0x8000>>11) // 16 -#define GUI (xine_debug & 0x8000>>12) // 8 -#define SPU (xine_debug & 0x8000>>13) // 4 - -#ifdef __GNUC__ -#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} -#else /* C99 version: */ -#define perr(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);} -#endif - -#ifdef DEBUG - -/* - * Debug stuff - */ - -//#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} - -#ifdef __GNUC__ -#define xprintf(LVL, FMT, ARGS...) { \ - if(LVL) { \ - printf(FMT, ##ARGS); \ - } \ - } -#else /* C99 version: */ -#define xprintf(LVL, ...) { \ - if(LVL) { \ - printf(__VA_ARGS__); \ - } \ - } -#endif - -/* - * profiling - */ - -void profiler_init (); - -int profiler_allocate_slot (char *label); - -void profiler_start_count (int id); - -void profiler_stop_count (int id); - -void profiler_print_results (); - -#else /* no DEBUG, release version */ - -//#define perr(FMT,ARGS...) - -#ifdef __GNUC__ -#define xprintf(LVL, FMT, ARGS...) -#else /* C99 version: */ -#define xprintf(LVL, ...) -#endif - -#define profiler_init() -#define profiler_allocate_slot(label) (-1) -#define profiler_start_count(id) -#define profiler_stop_count(id) -#define profiler_print_results() - -#endif /* DEBUG*/ - -#ifdef __cplusplus -} -#endif - -#endif /* HAVE_MONITOR_H */ diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index d3435ea84..30670b109 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: utils.c,v 1.1 2001/10/22 00:52:10 guenter Exp $ + * $Id: utils.c,v 1.2 2001/11/17 14:26:39 f1rmb Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -43,7 +43,7 @@ /* * */ -void *xmalloc(size_t size) { +void *xine_xmalloc(size_t size) { void *ptr; if((ptr = malloc(size)) == NULL) { @@ -60,10 +60,10 @@ void *xmalloc(size_t size) { /* * */ -void *xmalloc_aligned (size_t alignment, size_t size) { +void *xine_xmalloc_aligned (size_t alignment, size_t size) { char *pMem; - pMem = xmalloc (size+alignment); + pMem = xine_xmalloc (size+alignment); while ((int) pMem % alignment) pMem++; @@ -74,7 +74,7 @@ void *xmalloc_aligned (size_t alignment, size_t size) { /* * */ -const char *get_homedir(void) { +const char *xine_get_homedir(void) { struct passwd *pw = NULL; char *homedir = NULL; #ifdef HAVE_GETPWUID_R @@ -83,7 +83,7 @@ const char *get_homedir(void) { char *buffer = NULL; int bufsize = 128; - buffer = (char *) xmalloc(bufsize); + buffer = (char *) xine_xmalloc(bufsize); if((ret = getpwuid_r(getuid(), &pwd, buffer, bufsize, &pw)) < 0) { #else @@ -111,7 +111,7 @@ const char *get_homedir(void) { /* * */ -char *chomp(char *str) { +char *xine_chomp(char *str) { char *pbuf; pbuf = str; diff --git a/src/xine-utils/utils.h b/src/xine-utils/utils.h deleted file mode 100644 index 2c35d52db..000000000 --- a/src/xine-utils/utils.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2000-2001 the xine project - * - * This file is part of xine, a unix 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: utils.h,v 1.1 2001/10/22 00:52:10 guenter Exp $ - * - */ -#ifndef HAVE_UTILS_H -#define HAVE_UTILS_H - -#ifdef __cplusplus -extern "C" { -#endif - -void *xmalloc(size_t size); - -void *xmalloc_aligned(size_t alignment, size_t size); - -const char *get_homedir(void); - -/* - * Clean a string (remove spaces and '=' at the begin, - * and '\n', '\r' and spaces at the end. - */ - -char *chomp (char *str); - -/* - * A thread-safe usecond sleep - */ -void xine_usec_sleep(unsigned usec); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/xine-utils/cpu_accel.h b/src/xine-utils/xineutils.h index 053c142f6..eadd17f34 100644 --- a/src/xine-utils/cpu_accel.h +++ b/src/xine-utils/xineutils.h @@ -1,42 +1,44 @@ -/* - * cpu_accel.h - based on mmx.h, sse.h - * Copyright (C) 1997-1999 H. Dietz and R. Fisher - * - * This file is part of mpeg2dec, a free MPEG-2 video stream decoder. - * - * mpeg2dec is free software; you can redistribute it and/or modify +/* + * Copyright (C) 2000-2001 the xine project + * + * This file is part of xine, a unix 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. - * - * mpeg2dec is distributed in the hope that it will be useful, + * + * 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 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * xine specific modifications 2001 by G. Bartsch + * $Id: xineutils.h,v 1.1 2001/11/17 14:26:39 f1rmb Exp $ * */ - -/* - * The type of an value that fits in an MMX register (note that long - * long constant values MUST be suffixed by LL and unsigned long long - * values by ULL, lest they be truncated by the compiler) - */ - -#ifndef _CPU_ACCEL_H -#define _CPU_ACCEL_H +#ifndef XINEUTILS_H +#define XINEUTILS_H #ifdef __cplusplus extern "C" { #endif +#include <unistd.h> +#include <inttypes.h> #include "attributes.h" + /* CPU Acceleration */ + +/* + * The type of an value that fits in an MMX register (note that long + * long constant values MUST be suffixed by LL and unsigned long long + * values by ULL, lest they be truncated by the compiler) + */ + /* generic accelerations */ #define MM_ACCEL_MLIB 0x00000001 @@ -53,8 +55,8 @@ extern "C" { #define MM_SSE MM_ACCEL_X86_SSE #define MM_SSE2 MM_ACCEL_X86_SSE2 -uint32_t mm_accel (void) ; -/* uint32_t mm_support (void) ; */ +uint32_t xine_mm_accel (void); +/* uint32_t xine_mm_support (void) ; */ #ifdef ARCH_X86 @@ -523,9 +525,116 @@ typedef union { : "X" (mem)) #endif /*ARCH_X86 */ + + + /* Optimized/fast memcpy */ + +extern void *(* xine_fast_memcpy)(void *to, const void *from, size_t len); + +#ifdef HAVE_XINE_INTERNAL_H +/* Benchmark available memcpy methods */ +void xine_probe_fast_memcpy(config_values_t *config); +#endif + + + + /* Debugging/Monitoring */ + +extern uint32_t xine_debug; + +#define VERBOSE (xine_debug & 0x8000>>1) // 16384 +#define METRONOM (xine_debug & 0x8000>>2) // 8192 +#define AUDIO (xine_debug & 0x8000>>3) // 4096 +#define DEMUX (xine_debug & 0x8000>>4) // 2048 +#define INPUT (xine_debug & 0x8000>>5) // 1024 +#define VIDEO (xine_debug & 0x8000>>6) // 512 +#define VPTS (xine_debug & 0x8000>>7) // 256 +#define MPEG (xine_debug & 0x8000>>8) // 128 +#define VAVI (xine_debug & 0x8000>>9) // 64 +#define AC3 (xine_debug & 0x8000>>10) // 32 +#define LOOP (xine_debug & 0x8000>>11) // 16 +#define GUI (xine_debug & 0x8000>>12) // 8 +#define SPU (xine_debug & 0x8000>>13) // 4 + +#ifdef __GNUC__ +#define perr(FMT,ARGS...) {fprintf(stderr, FMT, ##ARGS);fflush(stderr);} +#else /* C99 version: */ +#define perr(...) {fprintf(stderr, __VA_ARGS__);fflush(stderr);} +#endif + +#ifdef DEBUG +/* + * Debug stuff + */ +#ifdef __GNUC__ +#define xprintf(LVL, FMT, ARGS...) { \ + if(LVL) { \ + printf(FMT, ##ARGS); \ + } \ + } +#else /* C99 version: */ +#define xprintf(LVL, ...) { \ + if(LVL) { \ + printf(__VA_ARGS__); \ + } \ + } +#endif /* __GNUC__ */ + +/* + * profiling + */ +void xine_profiler_init (void); +int xine_profiler_allocate_slot (char *label); +void xine_profiler_start_count (int id); +void xine_profiler_stop_count (int id); +void xine_profiler_print_results (void); + +#else /* no DEBUG, release version */ + +#ifdef __GNUC__ +#define xprintf(LVL, FMT, ARGS...) +#else /* C99 version: */ +#define xprintf(LVL, ...) +#endif + +#define xine_profiler_init() +#define xine_profiler_allocate_slot(label) (-1) +#define xine_profiler_start_count(id) +#define xine_profiler_stop_count(id) +#define xine_profiler_print_results() + +#endif /* DEBUG*/ + +/* + * Allocate and clean memory size_t 'size', then return the pointer + * to the allocated memory. + */ +void *xine_xmalloc(size_t size); + +/* + * Same as above, but memory is aligned to 'alignement'. + */ +void *xine_xmalloc_aligned(size_t alignment, size_t size); + +/* + * Get user home directory. + */ +const char *xine_get_homedir(void); + +/* + * Clean a string (remove spaces and '=' at the begin, + * and '\n', '\r' and spaces at the end. + */ +char *xine_chomp (char *str); + +/* + * A thread-safe usecond sleep + */ +void xine_usec_sleep(unsigned usec); + + #ifdef __cplusplus } #endif -#endif - +#endif |