diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/libw32dll/Makefile.am | 2 | ||||
-rw-r--r-- | src/libw32dll/common.c | 39 | ||||
-rw-r--r-- | src/libw32dll/qt_decoder.c | 32 | ||||
-rw-r--r-- | src/libw32dll/w32codec.c | 28 | ||||
-rw-r--r-- | src/libw32dll/wine/module.c | 31 |
6 files changed, 67 insertions, 66 deletions
@@ -31,6 +31,7 @@ xine-lib (1.1.2) * Fix up health check to find libX11 and libXv shared objects even if devel packages aren't installed (where appropriate). (Ubuntu 47357) * Fix install problems in case configure was generated by autoconf >= 2.59c. + * Fixed some win32 codec freezes when configured w32-path doesn't exist xine-lib (1.1.1) * Improve sound quality when using alsa 1.0.9 or above. diff --git a/src/libw32dll/Makefile.am b/src/libw32dll/Makefile.am index aaaaea49b..e7c3bfc8f 100644 --- a/src/libw32dll/Makefile.am +++ b/src/libw32dll/Makefile.am @@ -13,6 +13,8 @@ libdir = $(XINE_PLUGINDIR) lib_LTLIBRARIES = $(w32dll_codec) $(qt_codec) +EXTRA_DIST = common.c + xineplug_decode_w32dll_la_SOURCES = w32codec.c xineplug_decode_w32dll_la_LDFLAGS = -avoid-version -module @XINE_PLUGIN_MIN_SYMS@ xineplug_decode_w32dll_la_LIBADD = \ diff --git a/src/libw32dll/common.c b/src/libw32dll/common.c new file mode 100644 index 000000000..1f42288c2 --- /dev/null +++ b/src/libw32dll/common.c @@ -0,0 +1,39 @@ +#ifdef HAVE_DIRENT_H +#include <dirent.h> +#endif + +static char *get_win32_codecs_path(config_values_t *cfg) { + DIR *dir; + char *path, *cfgpath; + char *listpath[] = { "", + "/usr/lib/codecs", + "/usr/local/lib/codecs", + "/usr/lib/win32", + "/usr/local/lib/win32", + NULL }; + int i = 0; + + cfgpath = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, + _("path to Win32 codecs"), + _("If you have the Windows or Apple Quicktime codec packs " + "installed, specify the path the codec directory here. " + "If xine can find the Windows or Apple Quicktime codecs, " + "it will use them to decode various Windows Media and " + "Quicktime streams for you. Consult the xine FAQ for " + "more information on how to install the codecs."), + 10, NULL, NULL); + + while (listpath[i]) { + if (i == 0) path = cfgpath; + else path = listpath[i]; + + if ((dir = opendir(path)) != NULL) { + closedir(dir); + return path; + } + + i++; + } + + return NULL; +} diff --git a/src/libw32dll/qt_decoder.c b/src/libw32dll/qt_decoder.c index 536ac22ff..13b7d752d 100644 --- a/src/libw32dll/qt_decoder.c +++ b/src/libw32dll/qt_decoder.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: qt_decoder.c,v 1.43 2006/06/02 22:18:58 dsalt Exp $ + * $Id: qt_decoder.c,v 1.44 2006/06/11 15:09:47 valtri Exp $ * * quicktime video/audio decoder plugin, using win32 dlls * most of this code comes directly from MPlayer @@ -49,6 +49,8 @@ #include "wine/windef.h" #include "wine/ldt_keeper.h" +#include "common.c" + /* * This version of the macro avoids compiler warnings about * multiple-character constants. It also does NOT assume @@ -587,6 +589,9 @@ static void *qta_init_class (xine_t *xine, void *data) { qta_class_t *this; config_values_t *cfg; + cfg = xine->config; + if ((win32_def_path = get_win32_codecs_path(cfg)) == NULL) return NULL; + pthread_once (&once_control, init_routine); this = (qta_class_t *) xine_xmalloc (sizeof (qta_class_t)); @@ -596,17 +601,6 @@ static void *qta_init_class (xine_t *xine, void *data) { this->decoder_class.get_description = qta_get_description; this->decoder_class.dispose = qta_dispose_class; - cfg = xine->config; - win32_def_path = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, - _("path to Win32 codecs"), - _("If you have the Windows or Apple Quicktime codec packs " - "installed, specify the path the codec directory here. " - "If xine can find the Windows or Apple Quicktime codecs, " - "it will use them to decode various Windows Media and " - "Quicktime streams for you. Consult the xine FAQ for " - "more information on how to install the codecs."), - 10, NULL, NULL); - return this; } @@ -1116,17 +1110,9 @@ static void codec_path_cb (void *data, xine_cfg_entry_t *cfg) { static void *qtv_init_class (xine_t *xine, void *data) { qtv_class_t *this; - config_values_t *cfg = xine->config; - - win32_def_path = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, - _("path to Win32 codecs"), - _("If you have the Windows or Apple Quicktime codec packs " - "installed, specify the path the codec directory here. " - "If xine can find the Windows or Apple Quicktime codecs, " - "it will use them to decode various Windows Media and " - "Quicktime streams for you. Consult the xine FAQ for " - "more information on how to install the codecs."), - 10, NULL, NULL); + config_values_t *cfg = xine->config; + + if ((win32_def_path = get_win32_codecs_path(cfg)) == NULL) return NULL; lprintf ("%s...\n", __XINE_FUNCTION__); diff --git a/src/libw32dll/w32codec.c b/src/libw32dll/w32codec.c index 070dcaa8e..2a0bf920b 100644 --- a/src/libw32dll/w32codec.c +++ b/src/libw32dll/w32codec.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: w32codec.c,v 1.153 2006/06/02 22:18:58 dsalt Exp $ + * $Id: w32codec.c,v 1.154 2006/06/11 15:09:47 valtri Exp $ * * routines for using w32 codecs * DirectShow support by Miguel Freitas (Nov/2001) @@ -59,6 +59,8 @@ #include "buffer.h" #include "xineutils.h" +#include "common.c" + static GUID CLSID_Voxware = { 0x73f7a062, 0x8829, 0x11d1, @@ -1592,15 +1594,7 @@ static void *init_video_decoder_class (xine_t *xine, void *data) { config_values_t *cfg; cfg = xine->config; - win32_def_path = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, - _("path to Win32 codecs"), - _("If you have the Windows or Apple Quicktime codec packs " - "installed, specify the path the codec directory here. " - "If xine can find the Windows or Apple Quicktime codecs, " - "it will use them to decode various Windows Media and " - "Quicktime streams for you. Consult the xine FAQ for " - "more information on how to install the codecs."), - 10, NULL, NULL); + if ((win32_def_path = get_win32_codecs_path(cfg)) == NULL) return NULL; this = (w32v_class_t *) xine_xmalloc (sizeof (w32v_class_t)); @@ -1661,6 +1655,9 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { w32a_class_t *this; config_values_t *cfg; + cfg = xine->config; + if ((win32_def_path = get_win32_codecs_path(cfg)) == NULL) return NULL; + this = (w32a_class_t *) xine_xmalloc (sizeof (w32a_class_t)); this->decoder_class.open_plugin = open_audio_decoder_plugin; @@ -1668,17 +1665,6 @@ static void *init_audio_decoder_class (xine_t *xine, void *data) { this->decoder_class.get_description = get_description; this->decoder_class.dispose = dispose_class; - cfg = xine->config; - win32_def_path = cfg->register_string (cfg, "decoder.external.win32_codecs_path", WIN32_PATH, - _("path to Win32 codecs"), - _("If you have the Windows or Apple Quicktime codec packs " - "installed, specify the path the codec directory here. " - "If xine can find the Windows or Apple Quicktime codecs, " - "it will use them to decode various Windows Media and " - "Quicktime streams for you. Consult the xine FAQ for " - "more information on how to install the codecs."), - 10, NULL, NULL); - pthread_once (&once_control, init_routine); return this; diff --git a/src/libw32dll/wine/module.c b/src/libw32dll/wine/module.c index bc943d0d6..6e9235584 100644 --- a/src/libw32dll/wine/module.c +++ b/src/libw32dll/wine/module.c @@ -363,7 +363,6 @@ static WIN_BOOL MODULE_FreeLibrary( WINE_MODREF *wm ) HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) { WINE_MODREF *wm = 0; - char* listpath[] = { "", "", "/usr/lib/codecs", "/usr/local/lib/codecs", "/usr/lib/win32", "/usr/local/lib/win32", 0 }; char path[512]; char checked[2000]; int i = -1; @@ -381,31 +380,19 @@ HMODULE WINAPI LoadLibraryExA(LPCSTR libname, HANDLE hfile, DWORD flags) // if(fs_installed==0) // install_fs(); - while (wm == 0 && listpath[++i]) + for (i = 0; !wm && (i < 2); i++) { memset (&path, 0, sizeof (path)); - if (i < 2) - { - if (i == 0) - /* check just original file name */ - strncpy(path, libname, 511); - else - /* check default user path */ - strncpy(path, win32_def_path, 300); - } - else if (strcmp(win32_def_path, listpath[i])) - /* path from the list */ - strncpy(path, listpath[i], 300); - else - continue; - - if (i > 0) - { - strcat(path, "/"); - strncat(path, libname, 100); + if (i == 0) { + /* check just original file name */ + strncpy(path, libname, sizeof(path) - 1); + } else { + /* check default user path */ + strncpy(path, win32_def_path, sizeof(path) - 2); + strcat(path, "/"); + strncat(path, libname, sizeof(path) - strlen(libname)); } - path[511] = 0; wm = MODULE_LoadLibraryExA( path, hfile, flags ); if (!wm) |