[Mplayer-cvslog] CVS: main/loader win32.c,1.68,1.69
Arpi of Ize
arpi at mplayerhq.hu
Sat Dec 7 15:11:21 CET 2002
Update of /cvsroot/mplayer/main/loader
In directory mail:/var/tmp.root/cvs-serv25877
Modified Files:
win32.c
Log Message:
support for *.qtx (scan for all .qtx files at quicktime init)
Index: win32.c
===================================================================
RCS file: /cvsroot/mplayer/main/loader/win32.c,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- win32.c 26 Nov 2002 21:03:46 -0000 1.68
+++ win32.c 7 Dec 2002 14:11:04 -0000 1.69
@@ -55,6 +55,7 @@
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
+#include <dirent.h>
#include <sys/time.h>
#include <sys/timeb.h>
#ifdef HAVE_KSTAT
@@ -3250,17 +3251,46 @@
} WIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
*/
+static DIR* qtx_dir=NULL;
+
+static WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA lpfd)
+{
+#ifdef QTX
+ dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, lpfd);
+ if(h==FILE_HANDLE_quicktimeqtx){
+ struct dirent* d;
+ if(!qtx_dir) return 0;
+ while((d=readdir(qtx_dir))){
+ char* x=strrchr(d->d_name,'.');
+ if(!x) continue;
+ if(strcmp(x,".qtx")) continue;
+ strcpy(lpfd->cFileName,d->d_name);
+// sprintf(lpfd->cAlternateFileName,"%-8s.qtx",d->d_name);
+ strcpy(lpfd->cAlternateFileName,"foobar.qtx");
+ printf("### FindNext: %s\n",lpfd->cFileName);
+ return 1;
+ }
+ closedir(qtx_dir); qtx_dir=NULL;
+ return 0;
+ }
+#endif
+ return 0;
+}
+
static HANDLE WINAPI expFindFirstFileA(LPCSTR s, LPWIN32_FIND_DATAA lpfd)
{
#ifdef QTX
if(strstr(s, "*.QTX")){
dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTX\n", s, s, lpfd);
- strcpy(lpfd->cFileName, "QuickTimeEssentials.qtx");
- strcpy(lpfd->cAlternateFileName, "QuickEss.qts");
- return FILE_HANDLE_quicktimeqtx;
+ qtx_dir=opendir(def_path);
+ if(!qtx_dir) return (HANDLE)-1;
+ memset(lpfd,0,sizeof(*lpfd));
+ if(expFindNextFileA(FILE_HANDLE_quicktimeqtx,lpfd))
+ return FILE_HANDLE_quicktimeqtx;
+ printf("loader: Couldn't find the QuickTime plugins (.qtx files) at %s\n",def_path);
+ return (HANDLE)-1;
}
- if (strstr(s, "QuickTime.qts") || strstr(s,"c:\\windows\\system") )
- {
+ if(strstr(s, "QuickTime.qts")){
dbgprintf("FindFirstFileA(0x%x='%s', 0x%x) => QTS\n", s, s, lpfd);
// if(!strcmp(s,"C:\\windows\\QuickTime.qts\\QuickTime.qts\\*.QTX"))
// return (HANDLE)-1;
@@ -3274,21 +3304,16 @@
strcpy(lpfd->cAlternateFileName, "msms001.vwp");
return (HANDLE)-1;
}
-static WIN_BOOL WINAPI expFindNextFileA(HANDLE h,LPWIN32_FIND_DATAA lpfd)
-{
- dbgprintf("FindNextFileA(0x%x, 0x%x) => 0\n", h, lpfd);
-#if 0
- if(h==FILE_HANDLE_quicktimeqts && strcmp(lpfd->cFileName,"QuickTimeEssentials.qtx")){
- strcpy(lpfd->cFileName, "QuickTimeEssentials.qtx");
- strcpy(lpfd->cAlternateFileName, "QuickT~1.qtx");
- return FILE_HANDLE_quicktimeess;
- }
-#endif
- return 0;
-}
+
static WIN_BOOL WINAPI expFindClose(HANDLE h)
{
dbgprintf("FindClose(0x%x) => 0\n", h);
+#ifdef QTX
+// if(h==FILE_HANDLE_quicktimeqtx && qtx_dir){
+// closedir(qtx_dir);
+// qtx_dir=NULL;
+// }
+#endif
return 0;
}
static UINT WINAPI expSetErrorMode(UINT i)
@@ -3401,13 +3426,13 @@
free(tmp);
return result;
}
- if(strstr(cs1, "QuickTimeEssentials.qtx"))
+ if(strstr(cs1, ".qtx"))
{
int result;
- char* tmp=(char*)malloc(strlen(def_path)+50);
- strcpy(tmp, def_path);
- strcat(tmp, "/");
- strcat(tmp, "QuickTimeEssentials.qtx");
+ char* tmp=(char*)malloc(strlen(def_path)+250);
+ char* x=strrchr(cs1,'\\');
+ sprintf(tmp,"%s/%s",def_path,x?(x+1):cs1);
+// printf("### Open: %s -> %s\n",cs1,tmp);
result=open(tmp, O_RDONLY);
free(tmp);
return result;
More information about the MPlayer-cvslog
mailing list