summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/demuxers/demux_flac.c4
-rw-r--r--src/input/http_helper.c34
-rw-r--r--src/input/input_http.c4
-rw-r--r--src/input/input_v4l.c2
-rw-r--r--src/input/libdvdnav/Makefile.am2
-rw-r--r--src/input/libdvdnav/dvd_reader.c9
-rw-r--r--src/input/libdvdnav/dvdnav_internal.h7
-rw-r--r--src/input/vcd/libcdio/Makefile.am2
-rw-r--r--src/input/vcd/libvcd/Makefile.am2
-rw-r--r--src/xine-engine/Makefile.am10
-rw-r--r--src/xine-engine/input_rip.c7
-rw-r--r--src/xine-utils/utils.c76
-rw-r--r--src/xine-utils/xineutils.h109
13 files changed, 52 insertions, 216 deletions
diff --git a/src/demuxers/demux_flac.c b/src/demuxers/demux_flac.c
index 3ebf7781f..d1f7057df 100644
--- a/src/demuxers/demux_flac.c
+++ b/src/demuxers/demux_flac.c
@@ -23,7 +23,7 @@
* For more information on the FLAC file format, visit:
* http://flac.sourceforge.net/
*
- * $Id: demux_flac.c,v 1.5 2004/07/09 13:16:59 f1rmb Exp $
+ * $Id: demux_flac.c,v 1.6 2004/09/20 19:30:04 valtri Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -142,7 +142,7 @@ static int open_flac_file(demux_flac_t *flac) {
flac->channels = ((flac->sample_rate >> 9) & 0x07) + 1;
flac->bits_per_sample = ((flac->sample_rate >> 4) & 0x1F) + 1;
flac->sample_rate >>= 12;
- flac->total_samples = BE_64(&streaminfo[10]) & 0x0FFFFFFFFFLL; /* 36 bits */
+ flac->total_samples = BE_64(&streaminfo[10]) & UINT64_C(0x0FFFFFFFFF); /* 36 bits */
lprintf ("%d Hz, %d bits, %d channels, %lld total samples\n",
flac->sample_rate, flac->bits_per_sample,
flac->channels, flac->total_samples);
diff --git a/src/input/http_helper.c b/src/input/http_helper.c
index f58b6c8f4..f962766e4 100644
--- a/src/input/http_helper.c
+++ b/src/input/http_helper.c
@@ -19,20 +19,18 @@
*
* URL helper functions
*
- * $Id: http_helper.c,v 1.2 2004/03/03 20:09:12 mroi Exp $
+ * $Id: http_helper.c,v 1.3 2004/09/20 19:30:04 valtri Exp $
*/
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+
#include "xine_internal.h"
#include "http_helper.h"
-static char *_strndup(const char *s, size_t n) {
- char *ret;
-
- ret = malloc (n + 1);
- strncpy(ret, s, n);
- ret[n] = '\0';
- return ret;
-}
-
int _x_parse_url (char *url, char **proto, char** host, int *port,
char **user, char **password, char **uri) {
char *start = NULL;
@@ -64,7 +62,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
if (!start || (start == url))
goto error;
- *proto = _strndup(url, start - url);
+ *proto = strndup(url, start - url);
/* user:password */
start += 3;
@@ -77,12 +75,12 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
if (at) {
authcolon = strchr(start, ':');
if(authcolon && authcolon < at) {
- *user = _strndup(start, authcolon - start);
- *password = _strndup(authcolon + 1, at - authcolon - 1);
+ *user = strndup(start, authcolon - start);
+ *password = strndup(authcolon + 1, at - authcolon - 1);
if ((authcolon == start) || (at == (authcolon + 1))) goto error;
} else {
/* no password */
- *user = _strndup(start, at - start);
+ *user = strndup(start, at - start);
if (at == start) goto error;
}
start = at + 1;
@@ -96,18 +94,18 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
portcolon = strchr(start, ':');
if (slash) {
if (portcolon && portcolon < slash) {
- *host = _strndup(start, portcolon - start);
+ *host = strndup(start, portcolon - start);
if (portcolon == start) goto error;
*port = strtol(portcolon + 1, &strtol_err, 10);
if ((strtol_err != slash) || (strtol_err == portcolon + 1))
goto error;
} else {
- *host = _strndup(start, slash - start);
+ *host = strndup(start, slash - start);
if (slash == start) goto error;
}
} else {
if (portcolon) {
- *host = _strndup(start, portcolon - start);
+ *host = strndup(start, portcolon - start);
if (portcolon < end) {
*port = strtol(portcolon + 1, &strtol_err, 10);
if (*strtol_err != '\0') goto error;
@@ -126,7 +124,7 @@ int _x_parse_url (char *url, char **proto, char** host, int *port,
hostendbracket = strchr(start, ']');
if (hostendbracket != NULL) {
if (hostendbracket == start + 1) goto error;
- *host = _strndup(start + 1, hostendbracket - start - 1);
+ *host = strndup(start + 1, hostendbracket - start - 1);
if (hostendbracket < end) {
/* Might have a trailing port */
diff --git a/src/input/input_http.c b/src/input/input_http.c
index da78175c0..303ef4510 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -19,7 +19,7 @@
*
* input plugin for http network streams
*
- * $Id: input_http.c,v 1.97 2004/09/18 20:50:09 zonque Exp $
+ * $Id: input_http.c,v 1.98 2004/09/20 19:30:04 valtri Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -172,7 +172,7 @@ static int _x_use_proxy(http_input_class_t *this, const char *host) {
if ((info = gethostbyname(host)) == NULL) {
xine_log(this->xine, XINE_LOG_MSG,
_("input_http: gethostbyname(%s) failed: %s\n"), host,
- xine_hstrerror(h_errno));
+ hstrerror(h_errno));
return 1;
}
if (!info->h_name) return 1;
diff --git a/src/input/input_v4l.c b/src/input/input_v4l.c
index dcc797fde..b1d42bd82 100644
--- a/src/input/input_v4l.c
+++ b/src/input/input_v4l.c
@@ -25,8 +25,6 @@
#include "config.h"
#endif
-#define _GNU_SOURCE
-
#include <unistd.h>
#include <stdio.h>
#include <string.h>
diff --git a/src/input/libdvdnav/Makefile.am b/src/input/libdvdnav/Makefile.am
index f48c7a3f9..07b29091f 100644
--- a/src/input/libdvdnav/Makefile.am
+++ b/src/input/libdvdnav/Makefile.am
@@ -1,6 +1,6 @@
include $(top_srcdir)/misc/Makefile.common
-AM_CPPFLAGS = -D_LARGEFILE64_SOURCE -DDVDNAV_COMPILE
+AM_CPPFLAGS = -D_LARGEFILE64_SOURCE -DDVDNAV_COMPILE -DHAVE_DLFCN_H
noinst_LTLIBRARIES = libdvdnav.la
diff --git a/src/input/libdvdnav/dvd_reader.c b/src/input/libdvdnav/dvd_reader.c
index 185143604..964d97f76 100644
--- a/src/input/libdvdnav/dvd_reader.c
+++ b/src/input/libdvdnav/dvd_reader.c
@@ -1,7 +1,7 @@
/*
- * Copyright (C) 2001, 2002, 2003 Billy Biggs <vektor@dumbterm.net>,
- * Håkan Hjort <d95hjort@dtek.chalmers.se>,
- * Björn Englund <d4bjorn@dtek.chalmers.se>
+ * Copyright (C) 2001-2004 Billy Biggs <vektor@dumbterm.net>,
+ * Håkan Hjort <d95hjort@dtek.chalmers.se>,
+ * Björn Englund <d4bjorn@dtek.chalmers.se>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -36,7 +36,7 @@
#ifdef WIN32
/* replacement gettimeofday implementation */
#include <sys/timeb.h>
-static inline int gettimeofday( struct timeval *tv, void *tz )
+static inline int _private_gettimeofday( struct timeval *tv, void *tz )
{
struct timeb t;
ftime( &t );
@@ -44,6 +44,7 @@ static inline int gettimeofday( struct timeval *tv, void *tz )
tv->tv_usec = t.millitm * 1000;
return 0;
}
+#define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ))
#include <io.h> /* read() */
#define lseek64 _lseeki64
#endif
diff --git a/src/input/libdvdnav/dvdnav_internal.h b/src/input/libdvdnav/dvdnav_internal.h
index 29733ed54..35d9f3470 100644
--- a/src/input/libdvdnav/dvdnav_internal.h
+++ b/src/input/libdvdnav/dvdnav_internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
+ * Copyright (C) 2001-2004 Rich Wareham <richwareham@users.sourceforge.net>
*
* This file is part of libdvdnav, a DVD navigation library.
*
@@ -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: dvdnav_internal.h,v 1.14 2004/03/16 11:43:38 mroi Exp $
+ * $Id: dvdnav_internal.h,v 1.15 2004/09/20 19:30:04 valtri Exp $
*
*/
@@ -47,7 +47,7 @@ typedef CRITICAL_SECTION pthread_mutex_t;
/* replacement gettimeofday implementation */
#include <sys/timeb.h>
-static inline int gettimeofday( struct timeval *tv, void *tz )
+static inline int _private_gettimeofday( struct timeval *tv, void *tz )
{
struct timeb t;
ftime( &t );
@@ -55,6 +55,7 @@ static inline int gettimeofday( struct timeval *tv, void *tz )
tv->tv_usec = t.millitm * 1000;
return 0;
}
+#define gettimeofday(TV, TZ) _private_gettimeofday((TV), (TZ))
#include <io.h> /* read() */
#define lseek64 _lseeki64
diff --git a/src/input/vcd/libcdio/Makefile.am b/src/input/vcd/libcdio/Makefile.am
index 799d4585f..134397e30 100644
--- a/src/input/vcd/libcdio/Makefile.am
+++ b/src/input/vcd/libcdio/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/misc/Makefile.common
SUBDIRS = cdio MSWindows image
-INCLUDES = $(LIBCDIO_CFLAGS)
+INCLUDES = $(LIBCDIO_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/lib
libcdio_SRCS = \
image/bincue.c \
diff --git a/src/input/vcd/libvcd/Makefile.am b/src/input/vcd/libvcd/Makefile.am
index edd3d0e28..01b100aa4 100644
--- a/src/input/vcd/libvcd/Makefile.am
+++ b/src/input/vcd/libvcd/Makefile.am
@@ -2,7 +2,7 @@ include $(top_srcdir)/misc/Makefile.common
SUBDIRS = libvcd
-INCLUDES = $(LIBCDIO_CFLAGS)
+INCLUDES = $(LIBCDIO_CFLAGS) -I$(top_srcdir)/include -I$(top_srcdir)/lib
libvcd_SRCS = \
vcd.c \
diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am
index 76317fd10..61f4163c4 100644
--- a/src/xine-engine/Makefile.am
+++ b/src/xine-engine/Makefile.am
@@ -1,4 +1,5 @@
include $(top_srcdir)/misc/Makefile.common
+include $(top_srcdir)/lib/Makefile.common
AM_CFLAGS = $(THREAD_CFLAGS) $(X_CFLAGS) $(FT2_CFLAGS)
@@ -9,7 +10,6 @@ XINEUTILS_LIB = $(top_builddir)/src/xine-utils/libxineutils.la
INTERNAL_ZLIB_LIB = $(top_builddir)/win32/contrib/zlib/libzlib.la
DIRENT_LIB = $(top_builddir)/win32/contrib/libdirent.la
INTERNAL_PTHREAD_LIB = $(top_builddir)/win32/contrib/pthreads/libpthread.la
-TIMER_LIB = $(top_builddir)/win32/contrib/libtimer.la
DEF_FILE = libxine-$(XINE_MAJOR).def
if !HAVE_ZLIB
zlib_dep = $(INTERNAL_ZLIB_LIB)
@@ -17,7 +17,6 @@ endif
if WIN32
dirent_lib = $(DIRENT_LIB)
pthread_dep = $(INTERNAL_PTHREAD_LIB)
-timer_lib = $(TIMER_LIB)
def_ldflags="-Wl,--output-def,$(DEF_FILE)"
endif
@@ -32,10 +31,10 @@ libxine_la_SOURCES = xine.c metronom.c configfile.c buffer.c \
EXTRA_DIST = lrb.c lrb.h
libxine_la_DEPENDENCIES = @INTLLIBS@ $(XINEUTILS_LIB) $(zlib_dep) \
- $(dirent_lib) $(pthread_dep) $(timer_lib)
+ $(dirent_lib) $(pthread_dep) $(LIBXINEPOSIX)
libxine_la_LIBADD = $(THREAD_LIBS) $(DYNAMIC_LD_LIBS) @INTLLIBS@ $(ZLIB_LIBS) \
-lm $(XINEUTILS_LIB) $(LIBICONV) $(FT2_LIBS) \
- $(dirent_lib) $(timer_lib)
+ $(dirent_lib) $(LIBXINEPOSIX)
libxine_la_LDFLAGS = \
-version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) $(def_ldflags)
@@ -71,6 +70,3 @@ $(INTERNAL_ZLIB_LIB):
$(DIRENT_LIB):
$(MAKE) -C $(top_builddir)/win32/contrib libdirent.la
-
-$(TIMER_LIB):
- $(MAKE) -C $(top_builddir)/win32/contrib libtimer.la
diff --git a/src/xine-engine/input_rip.c b/src/xine-engine/input_rip.c
index 495658d11..d09b64c3d 100644
--- a/src/xine-engine/input_rip.c
+++ b/src/xine-engine/input_rip.c
@@ -29,7 +29,7 @@
* - it's possible speeder saving streams in the xine without playing:
* xine stream_mrl#save:file.raw\;noaudio\;novideo
*
- * $Id: input_rip.c,v 1.23 2004/09/17 19:21:46 valtri Exp $
+ * $Id: input_rip.c,v 1.24 2004/09/20 19:30:05 valtri Exp $
*/
/* TODO:
@@ -44,6 +44,9 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
#include <stdio.h>
#include <string.h>
@@ -569,7 +572,7 @@ input_plugin_t *_x_rip_plugin_get_instance (xine_stream_t *stream, const char *f
this->savepos = 0;
fnc = strdup(filename);
- target_basename = xine_basename(fnc);
+ target_basename = basename(fnc);
dir_file_concat(target, MAX_TARGET_LEN, stream->xine->save_path,
target_basename);
strcpy(target_no, target);
diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c
index 51ed0beb3..fff4f028d 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.33 2004/09/12 19:23:36 mroi Exp $
+ * $Id: utils.c,v 1.34 2004/09/20 19:30:05 valtri Exp $
*
*/
#define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */
@@ -31,7 +31,7 @@
#include <errno.h>
#include <pwd.h>
-#include <netdb.h>
+#include <time.h>
#include <unistd.h>
#if HAVE_EXECINFO_H
@@ -46,11 +46,7 @@
#include <langinfo.h>
#endif
-#if HAVE_LIBGEN_H
-#include <libgen.h>
-#endif
-
-#ifdef __CYGWIN__
+#if defined(__CYGWIN__) || defined(WIN32)
#include <windows.h>
#endif
@@ -418,7 +414,11 @@ void xine_usec_sleep(unsigned usec) {
ts.tv_nsec = (usec % 1000000) * 1000;
nanosleep(&ts, NULL);
#else
+# if WIN32
+ Sleep(usec / 1000);
+# else
usleep(usec);
+# endif
#endif
}
@@ -554,65 +554,3 @@ const char *xine_guess_spu_encoding(void) {
return "iso-8859-1";
}
-
-
-#ifndef HAVE_BASENAME
-#define FILESYSTEM_PREFIX_LEN(filename) 0
-#define ISSLASH(C) ((C) == '/')
-#endif
-
-/*
- * get base name
- *
- * (adopted from sh-utils)
- */
-char *xine_basename (char *name) {
-#ifndef HAVE_BASENAME
- char const *base = name + FILESYSTEM_PREFIX_LEN (name);
- char const *p;
-
- for (p = base; *p; p++)
- {
- if (ISSLASH (*p))
- {
- /* Treat multiple adjacent slashes like a single slash. */
- do p++;
- while (ISSLASH (*p));
-
- /* If the file name ends in slash, use the trailing slash as
- the basename if no non-slashes have been found. */
- if (! *p)
- {
- if (ISSLASH (*base))
- base = p - 1;
- break;
- }
-
- /* *P is a non-slash preceded by a slash. */
- base = p;
- }
- }
-
- return (char *) base;
-#else
- return basename(name);
-#endif
-}
-
-/**
- * get error descriptions in DNS lookups
- */
-const char *xine_hstrerror(int err) {
-#ifndef HAVE_HSTRERROR
- switch (err) {
- case 0: return _("No error");
- case HOST_NOT_FOUND: return _("Unknown host");
- case NO_DATA: return _("No address associated with name");
- case NO_RECOVERY: return _("Unknown server error");
- case TRY_AGAIN: return _("Host name lookup failure");
- default: return _("Unknown error");
- }
-#else
- return hstrerror(err);
-#endif
-}
diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h
index 6f5fecdf8..6a4be56bf 100644
--- a/src/xine-utils/xineutils.h
+++ b/src/xine-utils/xineutils.h
@@ -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: xineutils.h,v 1.92 2004/09/06 18:34:39 valtri Exp $
+ * $Id: xineutils.h,v 1.93 2004/09/20 19:30:05 valtri Exp $
*
*/
#ifndef XINEUTILS_H
@@ -577,27 +577,6 @@ typedef union {
#endif /*ARCH_X86 */
-#ifndef HAVE_LSTAT
-# define lstat(FILENAME, BUF) stat((FILENAME), (BUF))
-#endif
-
-
-#ifdef _MSC_VER
-# define snprintf _snprintf
-# define vsnprintf _vsnprintf
-#endif
-
-
-#ifdef WIN32
-# ifndef strcasecmp
-# define strcasecmp _stricmp
-# endif
-# ifndef strncasecmp
-# define strncasecmp _strnicmp
-# endif
-#endif
-
-
/* Optimized/fast memcpy */
/*
@@ -679,78 +658,10 @@ void xine_strdupa(char *dest, char *src);
} \
} while(0)
-/* Shamefully copied from glibc 2.2.3 */
-#ifdef HAVE_STRPBRK
-#define xine_strpbrk strpbrk
-#else
-static inline char *_private_strpbrk(const char *s, const char *accept) {
-
- while(*s != '\0') {
- const char *a = accept;
- while(*a != '\0')
- if(*a++ == *s)
- return(char *) s;
- ++s;
- }
-
- return NULL;
-}
-#define xine_strpbrk _private_strpbrk
-#endif
-
-#if defined HAVE_STRSEP && !defined(_MSC_VER)
-#define xine_strsep strsep
-#else
-static inline char *_private_strsep(char **stringp, const char *delim) {
- char *begin, *end;
-
- begin = *stringp;
- if(begin == NULL)
- return NULL;
-
- if(delim[0] == '\0' || delim[1] == '\0') {
- char ch = delim[0];
-
- if(ch == '\0')
- end = NULL;
- else {
- if(*begin == ch)
- end = begin;
- else if(*begin == '\0')
- end = NULL;
- else
- end = strchr(begin + 1, ch);
- }
- }
- else
- end = xine_strpbrk(begin, delim);
-
- if(end) {
- *end++ = '\0';
- *stringp = end;
- }
- else
- *stringp = NULL;
-
- return begin;
-}
-#define xine_strsep _private_strsep
-#endif
-
-
-#ifdef HAVE_SETENV
-#define xine_setenv setenv
-#else
-static inline void _private_setenv(const char *name, const char *val, int _xx) {
- int len = strlen(name) + strlen(val) + 2;
- char *env = (char *)malloc(len);
-
- sprintf(env, "%s%c%s", name, '=', val);
- putenv(env);
- /*free(env); The string passed to putenv must not be freed*/
-}
-#define xine_setenv _private_setenv
-#endif
+/* compatibility macros */
+#define xine_strpbrk(S, ACCEPT) strpbrk((S), (ACCEPT))
+#define xine_strsep(STRINGP, DELIM) strsep((STRINGP), (DELIM))
+#define xine_setenv(NAME, VAL, XX) setenv((NAME), (VAL), (XX))
/*
* Color Conversion Utility Functions
@@ -1118,16 +1029,6 @@ char *xine_get_system_encoding(void);
*/
const char *xine_guess_spu_encoding(void);
-/**
- * get base name
- */
-char *xine_basename (char *name);
-
-/**
- * get error descriptions in DNS lookups
- */
-const char *xine_hstrerror(int err);
-
#if defined(__CYGWIN__) || defined(WIN32)
char *exec_path_append_subdir(char * string);
#endif