diff options
author | František Dvořák <valtri@users.sourceforge.net> | 2005-08-29 15:28:16 +0000 |
---|---|---|
committer | František Dvořák <valtri@users.sourceforge.net> | 2005-08-29 15:28:16 +0000 |
commit | 0f8fd3b22893dd07db6506a1ba4d298e51a1c985 (patch) | |
tree | 291cf3594687cdaaa23f9527ba6d9f20f1a6283d | |
parent | 7cb89d83b0d845270e583c2848b0eaaa5e053217 (diff) | |
download | xine-lib-0f8fd3b22893dd07db6506a1ba4d298e51a1c985.tar.gz xine-lib-0f8fd3b22893dd07db6506a1ba4d298e51a1c985.tar.bz2 |
*BUGFIX*
Windows ports updates:
- finished M$VC port update
- moved xine plugins back to normal location for Windows ports,
added relative directories (used relative to ${prefix}),
make sure it's thread-safe (but it's still hacky)
- fixed ugly bug with loading plugins, when working drive was differrent from
plugins directory
directory
- directory and subdirectory separator called as platform specific
- fix crash with newer win32 pthread (missing mutex_init in vo plugin), yes!
- small doc update
CVS patchset: 7712
CVS date: 2005/08/29 15:28:16
-rw-r--r-- | configure.ac | 54 | ||||
-rw-r--r-- | doc/README.WIN32 | 33 | ||||
-rw-r--r-- | lib/dirent_msvc.c | 2 | ||||
-rw-r--r-- | lib/os_internal.h | 22 | ||||
-rw-r--r-- | src/audio_out/audio_directx2_out.c | 4 | ||||
-rw-r--r-- | src/input/input_cdda.c | 4 | ||||
-rw-r--r-- | src/video_out/Makefile.am | 2 | ||||
-rwxr-xr-x | src/video_out/video_out_directx.c | 6 | ||||
-rw-r--r-- | src/xine-engine/Makefile.am | 2 | ||||
-rw-r--r-- | src/xine-engine/load_plugins.c | 8 | ||||
-rw-r--r-- | src/xine-engine/xine.c | 6 | ||||
-rw-r--r-- | src/xine-utils/utils.c | 185 | ||||
-rw-r--r-- | src/xine-utils/xineutils.h | 15 | ||||
-rw-r--r-- | win32/xineplug_decode_mpeg2.dsp | 36 |
14 files changed, 221 insertions, 158 deletions
diff --git a/configure.ac b/configure.ac index 854a84492..c2e64ba22 100644 --- a/configure.ac +++ b/configure.ac @@ -1760,7 +1760,7 @@ AC_CHECK_LIB(posix4, sched_get_priority_min) AC_CHECK_FUNCS([vsscanf sigaction sigset getpwuid_r nanosleep lstat memset strchr]) AC_FUNC_FSEEKO AC_DEFINE(_GNU_SOURCE) -AC_CHECK_HEADERS(byteswap.h malloc.h execinfo.h ucontext.h sys/mman.h sys/mixer.h libgen.h netdb.h dirent.h sys/times.h sys/ioctl.h) +AC_CHECK_HEADERS(byteswap.h malloc.h execinfo.h ucontext.h sys/mman.h sys/mixer.h libgen.h netdb.h dirent.h sys/times.h sys/ioctl.h sys/param.h) AC_REPLACE_FUNCS(basename gettimeofday setenv strndup strpbrk strsep strtok_r) AC_CHECK_FUNCS(readlink) @@ -2276,26 +2276,41 @@ fi if test "x$exec_prefix" = xNONE; then exec_prefix='${prefix}' fi + +dnl +dnl installation directories and directories relative to prefix +dnl +dnl Note: +dnl use AC_DEFINE for runtime +dnl use AC_SUBST for installation +dnl +XINE_PLUGINDIR="$libdir/xine/plugins/$XINE_MAJOR.$XINE_MINOR.$XINE_SUB" +XINE_FONTDIR="${datadir}/xine/libxine$XINE_MAJOR/fonts" +XINE_LOCALEDIR="${datadir}/locale" +eval XINE_REL_PLUGINDIR="$XINE_PLUGINDIR" +XINE_REL_PLUGINDIR=`eval echo "$XINE_REL_PLUGINDIR" | sed -e "s,^${prefix}/,,"` +XINE_REL_FONTDIR=`eval echo "$XINE_FONTDIR" | sed -e "s,^${prefix}/,,"` +XINE_REL_LOCALEDIR=`eval echo "$XINE_LOCALEDIR" | sed -e "s,^${prefix}/,,"` +if test x"$SYS" = "xmingw32"; then + dnl polish paths (MinGW runtime accepts both \ and / anyway) + XINE_REL_PLUGINDIR=`echo "$XINE_REL_PLUGINDIR" | sed -e 's/\\//\\\\\\\\/g'` + XINE_REL_FONTDIR=`echo "$XINE_REL_PLUGINDIR" | sed -e 's/\\//\\\\\\\\/g'` + XINE_REL_LOCALEDIR=`echo "$XINE_REL_PLUGINDIR" | sed -e 's/\\//\\\\\\\\/g'` +fi if test x"$SYS" = "xmingw32" -o x"$SYS" = "xcygwin"; then - dnl installation directories - eval XINE_PLUGINDIR="${bindir}/plugins" - eval XINE_FONTDIR="${bindir}/fonts" - eval XINE_LOCALEDIR="${bindir}/locale" - dnl directories from xine-config - XINE_PLUGINPATH="\`dirname \$0\`/plugins" - XINE_FONTPATH="\`dirname \$0\`/fonts" - XINE_LOCALEPATH="\`dirname \$0\`/locale" - dnl runtime directories - AC_DEFINE(XINE_PLUGINDIR,[exec_path_append_subdir("plugins")],[Define this to plugins directory location]) - AC_DEFINE(XINE_FONTDIR,[exec_path_append_subdir("fonts")],[Define this to osd fonts dir location]) - AC_DEFINE(XINE_LOCALEDIR,[exec_path_append_subdir("locale")],[Path where catalog files will be.]) dnl prefix in xine-config XINE_CONFIG_PREFIX="\`dirname \$0\`/.." + dnl installation directories (in xine-config) + XINE_PLUGINPATH="$XINE_CONFIG_PREFIX/$XINE_REL_PLUGINDIR" + XINE_FONTPATH="$XINE_CONFIG_PREFIX/$XINE_REL_FONTDIR" + XINE_LOCALEPATH="$XINE_CONFIG_PREFIX/$XINE_REL_LOCALEDIR" + dnl runtime directories + AC_DEFINE(XINE_PLUGINDIR,[xine_get_plugindir()],[Define this to plugins directory location]) + AC_DEFINE(XINE_FONTDIR,[xine_get_fontdir()],[Define this to osd fonts dir location]) + AC_DEFINE(XINE_LOCALEDIR,[xine_get_localedir()],[Path where catalog files will be.]) else - dnl installation directories - XINE_PLUGINDIR="$libdir/xine/plugins/$XINE_MAJOR.$XINE_MINOR.$XINE_SUB" - XINE_FONTDIR="${datadir}/xine/libxine$XINE_MAJOR/fonts" - XINE_LOCALEDIR="${datadir}/locale" + dnl prefix in xine-config + XINE_CONFIG_PREFIX="${prefix}" dnl directories from xine-config and runtime directories eval XINE_PLUGINPATH=`eval echo "$XINE_PLUGINDIR"` eval XINE_FONTPATH="$XINE_FONTDIR" @@ -2304,9 +2319,10 @@ else AC_DEFINE_UNQUOTED(XINE_PLUGINDIR,"$XINE_PLUGINPATH",[Define this to plugins directory location]) AC_DEFINE_UNQUOTED(XINE_FONTDIR,"$XINE_FONTPATH",[Define this to osd fonts dir location]) AC_DEFINE_UNQUOTED(XINE_LOCALEDIR, "$XINE_LOCALEPATH",[Path where catalog files will be.]) - dnl prefix in xine-config - XINE_CONFIG_PREFIX="${prefix}" fi +AC_DEFINE_UNQUOTED(XINE_REL_PLUGINDIR,"$XINE_REL_PLUGINDIR",[Define this to plugin directory relative to execution prefix]) +AC_DEFINE_UNQUOTED(XINE_REL_FONTDIR,"$XINE_REL_FONTDIR",[Define this to font directory relative to prefix]) +AC_DEFINE_UNQUOTED(XINE_REL_LOCALEDIR,"$XINE_REL_LOCALEDIR",[Define this to font directory relative to prefix]) AC_SUBST(XINE_CONFIG_PREFIX) AC_SUBST(XINE_PLUGINPATH) AC_SUBST(XINE_FONTPATH) diff --git a/doc/README.WIN32 b/doc/README.WIN32 index 8abc80530..0dd7b1a8e 100644 --- a/doc/README.WIN32 +++ b/doc/README.WIN32 @@ -6,7 +6,7 @@ This document describes how to build xine library under Windows. Download -------- -Checkout source code from CVS (under Windows can be used CygWin or another tool). You will need 'xine-lib' (the library) and 'xine-win32' (testing Windows frontend). +Checkout source code from CVS (under Windows can be used CygWin or another tool). You will need 'xine-lib' (the library) and 'xine-win32' (testing Windows frontend). Instead xine-win32 you can use any other frontend working under Windows (toxine, ...) Build @@ -20,13 +20,13 @@ There are three different ports on Windows: 1. MinGW port ------------- -This is the best way. Final library is 100% native Windows with all optimizations. +This is the best way. Result is 100% native Windows library with all optimizations. Also you can use cross-build from comfortable unix-like system. See README.MINGWCROSS for more information. Requirements for compilation under Windows: - a) MinGW installed on Windows - b) LIB.EXE, LINK.EXE and MSPDB60.DLL from M$ Visual C + a) installed MinGW + b) LIB.EXE, LINK.EXE and MSPDB60.DLL from M$ Visual C (necessary only for usability created xine library by M$ compilers) How to build: @@ -51,7 +51,7 @@ Prepare xine library for using in M$ compilers too: # run terminal window (MinGW for example) ... # creating libxine-1.lib file - cd <path_where_libxine_is_installed_>/lib + cd <path_where_libxine_is_installed>/lib cp ../bin/libxine-1.dll . <path_to_M$VC>/VC98/BIN/LIB.EXE /machine:i386 /def:libxine-1.def rm libxine-1.dll @@ -59,7 +59,7 @@ Prepare xine library for using in M$ compilers too: 2. CygWin port -------------- -This is the second way. Created library won't be 100% windows native: it will contains some additional emulation code and I'm not sure, if can be used with M$ compilers. +This is the second way. Created library won't be 100% windows native: it will contains some additional emulation code and I'm not sure, if it can be used with M$ compilers. It's possible to use CygWin for cross-compiling with MinGW. @@ -91,15 +91,13 @@ Reasons, why not to use this port: - somebody must buy the OS and compiler Reasons, why to use this port: - - obtaining backtrace after crash, debugging + - obtaining cute backtrace after crash, debugging How to build xine in M$ Visual C: - Set up MSVC to look for DirectX headers. - Open up the xine.dsw workspace/project in MSVC. - - Unless you have a project file to build css you must select Cancel when prompted for the libdvdcss.dsp file. - - Click on the FileView tab. - Build the following projects in this order: @@ -107,19 +105,20 @@ How to build xine in M$ Visual C: libxine libdvdnav - - Next build any desired plugins (decoders/demuxers ...). The ao_out_directx and vo_out_directx are required for Win32. There is an option to use the vo_out_sdl but a sdl.dll must be present for that to take place. There have also been some issues observed with the directX video driver on some machines. + - Next build any desired plugins (decoders/demuxers ...). The ao_out_directx2 and vo_out_directx are required for Win32. ao_out_directx is obsoleted. There is a possibility to use the vo_out_sdl but sdl.dll must be present for that to take place. There have also been some issues observed with the directX video driver on some machines. - If you want ffmpeg decoder plugin, you must use precompiled version. If you want to compile it, you should have the files LIB.EXE, LINK.EXE and MSPDB60.DLL from the Visual C++. Under MinGW you can compile ffmpeg for xine by this way: # - # run the script/patch necessary for MSVC a for xine + # run the script/patch necessary for MSVC and for xine # cd ffmpeg sh ../xine-lib/win32/scripts/ffmpeg_win32.patch # - # for cross-compiling add "--cross-prefix=i386-mingw32-" and "--disable-mmx" + # (for cross-compiling add "--cross-prefix=i386-mingw32-" + # and "--disable-mmx") # ./configure \ --enable-gpl \ @@ -130,8 +129,8 @@ How to build xine in M$ Visual C: make # - # for cross-compiling finalize linking by running this command in - # libavcodec/ directory + # linking by running this command in libavcodec/ directory (use wine for + # cross-compiling) # # it's done automatically if you have 'LIB.EXE' linked to 'lib' in your # $PATH and set wine @@ -155,9 +154,9 @@ Limitations: - file > 1GB doesn't work (MinGW problem?) - missing full Win32 frontend - build system isn't fully tuned for cross-compiling + - seeking doesn't work with testing frontend, but it should be OK in library Bugs: - - use GetCurrentDirectory(SIZE, STR) because of changing volume drive! - - random crashes - - seeking doesn't work with testing frontend + - random crashes and random locks in stress tests - non-seekable input plugins crash + - ffmpeg bug visible for some video sizes diff --git a/lib/dirent_msvc.c b/lib/dirent_msvc.c index e36d7402c..b43fae1ae 100644 --- a/lib/dirent_msvc.c +++ b/lib/dirent_msvc.c @@ -19,7 +19,7 @@ */ #include "config.h" -#include <dirent.h> + #include <errno.h> #include <io.h> #include <stdlib.h> diff --git a/lib/os_internal.h b/lib/os_internal.h index 24d810ffd..0a5fbca72 100644 --- a/lib/os_internal.h +++ b/lib/os_internal.h @@ -4,6 +4,7 @@ #include <stddef.h> #include "os_types.h" + #if defined (__SVR4) && defined (__sun) # include <sys/int_types.h> @@ -16,6 +17,19 @@ #endif +#if defined(WIN32) +# define XINE_DIRECTORY_SEPARATOR_STRING ";" +# define XINE_DIRECTORY_SEPARATOR_CHAR ';' +# define XINE_SUBDIRECTORY_SEPARATOR_STRING "\\" +# define XINE_SUBDIRECTORY_SEPARATOR_CHAR '\\' +#else +# define XINE_DIRECTORY_SEPARATOR_STRING ":" +# define XINE_DIRECTORY_SEPARATOR_CHAR ':' +# define XINE_SUBDIRECTORY_SEPARATOR_STRING "/" +# define XINE_SUBDIRECTORY_SEPARATOR_CHAR '/' +#endif + + /* replacement of strndup */ #ifndef HAVE_STRNDUP #define strndup(S, N) _xine_private_strndup((S), (N)) @@ -80,8 +94,12 @@ char *_xine_private_strsep(char **stringp, const char *delim); #endif #ifdef WIN32 -#include <io.h> -# define mkdir(A, B) _mkdir((A)) +# include <io.h> +# ifdef _MSC_VER +# include <direct.h> +# else +# define mkdir(A, B) _mkdir((A)) +# endif # ifndef S_ISDIR # define S_ISDIR(m) ((m) & _S_IFDIR) diff --git a/src/audio_out/audio_directx2_out.c b/src/audio_out/audio_directx2_out.c index a86920e0f..97d3c8cd1 100644 --- a/src/audio_out/audio_directx2_out.c +++ b/src/audio_out/audio_directx2_out.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: audio_directx2_out.c,v 1.2 2005/02/06 19:16:18 valtri Exp $ + * $Id: audio_directx2_out.c,v 1.3 2005/08/29 15:28:16 valtri Exp $ * * * xine audio output plugin using DirectX @@ -176,7 +176,7 @@ static char *dsound_strerror(HRESULT err) { case DSERR_BUFFERLOST: return _("memory buffer has been lost and must be restored"); case DSERR_CONTROLUNAVAIL: return _("requested buffer control is not available"); case DSERR_GENERIC: return _("undetermined error inside DirectSound subsystem"); -#ifdef HWUNAVAIL +#ifdef DSERR_HWUNAVAIL case DSERR_HWUNAVAIL: return _("DirectSound hardware device is unavailable"); #endif case DSERR_INVALIDCALL: return _("function is not valid for the current state of the object"); diff --git a/src/input/input_cdda.c b/src/input/input_cdda.c index 2366225c9..41771b2fb 100644 --- a/src/input/input_cdda.c +++ b/src/input/input_cdda.c @@ -20,7 +20,7 @@ * Compact Disc Digital Audio (CDDA) Input Plugin * by Mike Melanson (melanson@pcisys.net) * - * $Id: input_cdda.c,v 1.74 2005/08/25 15:36:29 valtri Exp $ + * $Id: input_cdda.c,v 1.75 2005/08/29 15:28:16 valtri Exp $ */ #ifdef HAVE_CONFIG_H @@ -32,7 +32,9 @@ #include <unistd.h> #include <sys/types.h> +#ifndef SYS_PARAM_H #include <sys/param.h> +#endif #ifdef HAVE_DIRENT_H #include <dirent.h> #endif diff --git a/src/video_out/Makefile.am b/src/video_out/Makefile.am index 5b07ad1b3..4246068c0 100644 --- a/src/video_out/Makefile.am +++ b/src/video_out/Makefile.am @@ -162,7 +162,7 @@ xineplug_vo_out_stk_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ xineplug_vo_out_directx_la_SOURCES = alphablend.c yuv2rgb.c yuv2rgb_mmx.c video_out_directx.c xineplug_vo_out_directx_la_CPPFLAGS = $(DIRECTX_CPPFLAGS) -xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) +xineplug_vo_out_directx_la_LIBADD = $(DIRECTX_VIDEO_LIBS) $(XINE_LIB) $(THREAD_LIBS) xineplug_vo_out_directx_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ xineplug_vo_out_none_la_SOURCES = video_out_none.c diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c index 5827ad27c..946e3f3e4 100755 --- a/src/video_out/video_out_directx.c +++ b/src/video_out/video_out_directx.c @@ -20,7 +20,7 @@ * video_out_directx.c, direct draw video output plugin for xine * by Matthew Grooms <elon@altavista.com> * - * $Id: video_out_directx.c,v 1.22 2005/08/25 15:36:30 valtri Exp $ + * $Id: video_out_directx.c,v 1.23 2005/08/29 15:28:16 valtri Exp $ */ typedef unsigned char boolean; @@ -28,6 +28,8 @@ typedef unsigned char boolean; #include <windows.h> #include <ddraw.h> +#include <pthread.h> + #include "xine.h" #include "video_out.h" #include "alphablend.h" @@ -866,6 +868,8 @@ static vo_frame_t * win32_alloc_frame( vo_driver_t * vo_driver ) if (!win32_frame) return NULL; + pthread_mutex_init(&win32_frame->vo_frame.mutex, NULL); + win32_frame->vo_frame.proc_slice = NULL; win32_frame->vo_frame.proc_frame = NULL; win32_frame->vo_frame.field = win32_frame_field; diff --git a/src/xine-engine/Makefile.am b/src/xine-engine/Makefile.am index 735f41eae..b78d54af6 100644 --- a/src/xine-engine/Makefile.am +++ b/src/xine-engine/Makefile.am @@ -58,7 +58,7 @@ install-exec-local: cp -p $(DEF_FILE) $(DESTDIR)$(libdir) uninstall-local: - rm -f $(DEF_FILE) $(DESTDIR)$(libdir) + rm -f $(DEF_FILE) endif @INCLUDED_INTL_TRUE@@INTLLIBS@: diff --git a/src/xine-engine/load_plugins.c b/src/xine-engine/load_plugins.c index 6910f157b..dfec63876 100644 --- a/src/xine-engine/load_plugins.c +++ b/src/xine-engine/load_plugins.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: load_plugins.c,v 1.211 2005/08/25 15:36:30 valtri Exp $ + * $Id: load_plugins.c,v 1.212 2005/08/29 15:28:16 valtri Exp $ * * * Load input/demux/audio_out/video_out/codec plugins @@ -1088,21 +1088,21 @@ void _x_scan_plugins (xine_t *this) { if ((pluginpath = getenv("XINE_PLUGIN_PATH")) != NULL) { pluginpath = strdup(pluginpath); } else { - char *str1, *str2; + const char *str1, *str2; int len; str1 = "~/.xine/plugins"; str2 = XINE_PLUGINDIR; len = strlen(str1) + strlen(str2) + 2; pluginpath = xine_xmalloc(len); - snprintf(pluginpath, len, "%s:%s", str1, str2); + snprintf(pluginpath, len, "%s" XINE_DIRECTORY_SEPARATOR_STRING "%s", str1, str2); } plugindir = xine_xmalloc(strlen(pluginpath)+strlen(homedir)+2); j=0; lenpluginpath = strlen(pluginpath); for (i=0; i <= lenpluginpath; ++i){ switch (pluginpath[i]){ - case ':': + case XINE_DIRECTORY_SEPARATOR_CHAR: case '\0': plugindir[j] = '\0'; collect_plugins(this, plugindir); diff --git a/src/xine-engine/xine.c b/src/xine-engine/xine.c index c3f326bcd..c5ab40f8b 100644 --- a/src/xine-engine/xine.c +++ b/src/xine-engine/xine.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: xine.c,v 1.315 2005/08/25 15:36:30 valtri Exp $ + * $Id: xine.c,v 1.316 2005/08/29 15:28:17 valtri Exp $ */ /* @@ -1341,7 +1341,7 @@ void xine_exit (xine_t *this) { #if defined(WIN32) WSACleanup(); #endif - + free (this); } @@ -1352,7 +1352,7 @@ xine_t *xine_new (void) { #ifdef WIN32 WSADATA Data; int i_err; -#endif /* WIN32 */ +#endif this = xine_xmalloc (sizeof (xine_t)); if (!this) diff --git a/src/xine-utils/utils.c b/src/xine-utils/utils.c index 0e05d3715..d96e8bbee 100644 --- a/src/xine-utils/utils.c +++ b/src/xine-utils/utils.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2000-2004 the xine project + * Copyright (C) 2000-2005 the xine project * * This file is part of xine, a free video player. * @@ -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.39 2005/04/01 23:15:38 fsck-p Exp $ + * $Id: utils.c,v 1.40 2005/08/29 15:28:17 valtri Exp $ * */ #define _POSIX_PTHREAD_SEMANTICS 1 /* for 5-arg getpwuid_r on solaris */ @@ -32,9 +32,6 @@ #include "xineutils.h" #include "xineintl.h" -#ifdef _MSC_VER -#include "xine_internal.h" -#endif #include <errno.h> #include <pwd.h> @@ -55,6 +52,7 @@ #endif #if defined(__CYGWIN__) || defined(WIN32) +#include <ctype.h> #include <windows.h> #endif @@ -267,90 +265,52 @@ void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base) { return ptr; } -#if defined(__CYGWIN__) || defined(WIN32) - -/* Ridiculous hack to return valid xine support - * directories. These should be read from - * a registry entry set at install time. +#ifdef WIN32 +/* + * Parse command line with Windows XP syntax and copy the command (argv[0]). */ +static size_t xine_strcpy_command(const char *cmdline, char *cmd, size_t maxlen) { + size_t i, j; + + i = 0; + j = 0; + while (cmdline[i] && isspace(cmdline[i])) i++; + + while (cmdline[i] && !isspace(cmdline[i]) && j + 2 < maxlen) { + switch (cmdline[i]) { + case '\"': + i++; + while (cmdline[i] && cmdline[i] != '\"') { + if (cmdline[i] == '\\') { + i++; + if (cmdline[i] == '\"') cmd[j++] = '\"'; + else { + cmd[j++] = '\\'; + cmd[j++] = cmdline[i]; + } + } else cmd[j++] = cmdline[i]; + if (cmdline[i]) i++; + } + break; -char *exec_path_append_subdir(char *string) { - static char tmp_win32_path[1024] = "\0"; - char *back_slash; - char *fore_slash; - char *last_slash; - - /* first run - fill out dll path */ - if (!*tmp_win32_path) { - char *tmpchar; - char *cmdline; - - /* get program exec command line */ - cmdline = GetCommandLine(); - - /* check for " at beginning of string */ - if( *cmdline == '\"' ) { - /* copy command line, skip first quote */ - strncpy(tmp_win32_path, cmdline + 1, sizeof(tmp_win32_path)); - tmp_win32_path[sizeof(tmp_win32_path) - 1] = '\0'; - - /* terminate at second set of quotes */ - tmpchar = strchr(tmp_win32_path, '\"'); - if (tmpchar) *tmpchar = 0; - } else { - /* copy command line */ - strncpy(tmp_win32_path, cmdline, sizeof(tmp_win32_path)); - tmp_win32_path[sizeof(tmp_win32_path) - 1] = '\0'; + case '\\': + i++; + if (cmdline[i] == '\"') cmd[j++] = '\"'; + else { + cmd[j++] = '\\'; + i--; + } + break; - /* terminate at first space */ - tmpchar = strchr(tmp_win32_path, ' '); - if (tmpchar) *tmpchar = 0; + default: + cmd[j++] = cmdline[i]; } - } - /* find the last occurance of a back - * slash or fore slash - */ - back_slash = strrchr(tmp_win32_path, '\\'); - fore_slash = strrchr(tmp_win32_path, '/'); - - /* make sure the last back slash was not - * after a drive letter - */ - if(back_slash > tmp_win32_path) - if(*( back_slash - 1 ) == ':') - back_slash = 0; - - /* which slash was the latter slash */ - if(back_slash > fore_slash) - last_slash = back_slash; - else - last_slash = fore_slash; - - /* detect if we had a relative or - * distiguished path ( had a slash ) - */ - if(last_slash) { - /* we had a slash charachter in our - * command line - */ - *(last_slash + 1) = 0; - - /* if had a string to append to the path */ - if(string) - strncat(tmp_win32_path, string, sizeof(tmp_win32_path) - strlen(tmp_win32_path) - 1); - } else { - if(string) { - /* if had a string to append to the path */ - strncpy(tmp_win32_path, string, sizeof(tmp_win32_path)); - tmp_win32_path[sizeof(tmp_win32_path) - 1] = '\0'; - } else { - /* no slash, assume local directory */ - strcpy(tmp_win32_path, "."); - } + i++; } + cmd[j] = '\0'; - return tmp_win32_path; + return j; } #endif @@ -359,11 +319,21 @@ char *exec_path_append_subdir(char *string) { #endif const char *xine_get_homedir(void) { - #ifdef WIN32 - return exec_path_append_subdir(NULL); -#else + static char homedir[1024] = {0, }; + char *s; + int len; + + if (!homedir[0]) { + len = xine_strcpy_command(GetCommandLine(), homedir, sizeof(homedir)); + s = strdup(homedir); + GetFullPathName(s, sizeof(homedir), homedir, NULL); + free(s); + if ((s = strrchr(homedir, '\\'))) *s = '\0'; + } + return homedir; +#else struct passwd pwd, *pw = NULL; static char homedir[BUFSIZ] = {0,}; @@ -393,9 +363,52 @@ const char *xine_get_homedir(void) { } return homedir; -#endif /* _MSC_VER */ +#endif /* WIN32 */ +} + +#if defined(WIN32) || defined(__CYGWIN__) +static void xine_get_rootdir(char *rootdir, size_t maxlen) { + char *s; + + strncpy(rootdir, xine_get_homedir(), maxlen - 1); + rootdir[maxlen - 1] = '\0'; + if ((s = strrchr(rootdir, XINE_SUBDIRECTORY_SEPARATOR_CHAR))) *s = '\0'; } +const char *xine_get_plugindir(void) { + static char plugindir[1024] = {0, }; + + if (!plugindir[0]) { + xine_get_rootdir(plugindir, sizeof(plugindir) - strlen(XINE_REL_PLUGINDIR) - 1); + strcat(plugindir, XINE_SUBDIRECTORY_SEPARATOR_STRING XINE_REL_PLUGINDIR); + } + + return plugindir; +} + +const char *xine_get_fontdir(void) { + static char fontdir[1024] = {0, }; + + if (!fontdir[0]) { + xine_get_rootdir(fontdir, sizeof(fontdir) - strlen(XINE_REL_FONTDIR) - 1); + strcat(fontdir, XINE_SUBDIRECTORY_SEPARATOR_STRING XINE_REL_FONTDIR); + } + + return fontdir; +} + +const char *xine_get_localedir(void) { + static char localedir[1024] = {0, }; + + if (!localedir[0]) { + xine_get_rootdir(localedir, sizeof(localedir) - strlen(XINE_REL_LOCALEDIR) - 1); + strcat(localedir, XINE_SUBDIRECTORY_SEPARATOR_STRING XINE_REL_LOCALEDIR); + } + + return localedir; +} +#endif + char *xine_chomp(char *str) { char *pbuf; diff --git a/src/xine-utils/xineutils.h b/src/xine-utils/xineutils.h index 017273dd9..725c3e9e6 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.97 2005/08/25 15:37:02 valtri Exp $ + * $Id: xineutils.h,v 1.98 2005/08/29 15:28:17 valtri Exp $ * */ #ifndef XINEUTILS_H @@ -642,6 +642,15 @@ void *xine_xmalloc_aligned(size_t alignment, size_t size, void **base); */ const char *xine_get_homedir(void); +#if defined(WIN32) || defined(__CYGWIN__) +/* + * Get other xine directories. + */ +const char *xine_get_plugindir(void); +const char *xine_get_fontdir(void); +const char *xine_get_localedir(void); +#endif + /* * Clean a string (remove spaces and '=' at the begin, * and '\n', '\r' and spaces at the end. @@ -1035,10 +1044,6 @@ char *xine_get_system_encoding(void); */ const char *xine_guess_spu_encoding(void); -#if defined(__CYGWIN__) || defined(WIN32) -char *exec_path_append_subdir(char * string); -#endif - /* * use the best clock reference (API compatible with gettimeofday) * note: it will be a monotonic clock, if available. diff --git a/win32/xineplug_decode_mpeg2.dsp b/win32/xineplug_decode_mpeg2.dsp index 81e110917..4c9a0609e 100644 --- a/win32/xineplug_decode_mpeg2.dsp +++ b/win32/xineplug_decode_mpeg2.dsp @@ -92,71 +92,77 @@ LINK32=link.exe # Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\cpu_state.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\decode.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\header.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\idct.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\idct_altivec.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\idct_mlib.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\idct_mmx.c
# End Source File
+
# Begin Source File
+SOURCE=..\src\libmpeg2\libmpeg2_accel.c
+# End Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\motion_comp.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\motion_comp_altivec.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\motion_comp_mlib.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\motion_comp_mmx.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\slice.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\slice_xvmc.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\stats.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\slice_xvmc_vld.c
# End Source File
-# Begin Source File
+# Begin Source File
SOURCE=..\src\libmpeg2\xine_decoder.c
# End Source File
+
# End Group
+
# Begin Group "DLL Defs"
# PROP Default_Filter ""
|