[MPlayer-dev-eng] [PATCH] win32 codec path

Sascha Sommer saschasommer at freenet.de
Sun Aug 17 13:51:36 CEST 2003


> On Sun, Aug 10, 2003 at 08:40:29PM +0200, Sascha Sommer wrote:
> > > On Sat, Aug 09, 2003 at 08:11:21PM +0200, Sascha Sommer wrote:
> > > > What about the attached patch?
> > > > Like on linux real dlls only get loaded from WIN32_PATH.
> > >
> > > I don't understand... real dlls get loaded from REALCODEC_PATH on
> > > linux by hardcoding the path into the dll.  What does WIN32_PATH have
to
> >
> > No, it was changed to only load the linux libs from REALCODEC_PATH
>
> Oh, I see.  You mean that the path gets hardcoded to LoadLibrary only
> under linux?  That makes sense.
>
> > I think the best thing would be to combine the two paths. Afair you can
do
> > this with ";"
> Yes, that's correct.
>
> > Then I would set this path once at the beginning of mplayer execution.
Imho
> > a RegisterCodecPath() is to much overhead.
>
> That's fine.  Doing this should solve all of our problems, then.
> What do you think of this patch?  It moves the expansion of relative
> to full path on mingw into a function, to make the PATH building
> code nicer.  (untested, I'm away from home...)  Comments?
>
> --Joey
>

--- mplayer.c 9 Aug 2003 14:22:49 -0000 1.710
+++ mplayer.c 9 Aug 2003 18:18:40 -0000
@@ -790,6 +790,29 @@
 #endif
 #endif

+#ifdef WIN32
+#ifndef __CYGWIN__
+// convert from relative path to full path under mingw
+// we assume newpath is MAX_PATH long, and neither arg is NULL
+void cygwin_conv_to_full_win32_path(char *path, char *newpath) {
+  int WINAPI GetModuleFileNameA(void*,char*,int);
+  if(!strstr(path, ":")) {
+    GetModuleFileNameA(NULL, newpath, MAX_PATH);
+    strncpy(rindex(newpath, '\\') +1, path, MAX_PATH -
strlen(WIN32_PATH) -1);
+  }

A strcpy(newpath,path); is missing here for the case where the path is not
relative.
I attached my current solution but I don't know, which is better.

Sascha
-------------- next part --------------
A non-text attachment was scrubbed...
Name: path.diff
Type: application/octet-stream
Size: 1593 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20030817/648c8eed/attachment.obj>


More information about the MPlayer-dev-eng mailing list