[MPlayer-cygwin] TOOLS/netstream mingw patch

Song Du freewizard at gmail.com
Wed Jun 23 16:46:16 CEST 2004


Suggest you apply the patch i posted a few days ago in order to make
them really working correctly.

On Wed, 23 Jun 2004 07:41:34 +0000 (UTC), Erik Augustson
<erik_27can at yahoo.com> wrote:
> 
> Heya all,
> 
> I was messing around with TOOLS/netstream to get it to compile under mingw32,
> and was able to get it to at least compile with the following fixes. Before
> anyone starts a flamewar on me, I really have no idea how to C program. I
> basically look through code, use pattern recognition, Google any errors i get,
> and trial-and-error fix however i can :) This at least gets netstream to
> compile, however i don't know how to make the unix > win32 socket changes, which
> i hear is pretty simple. So i thought i should leave that, and whatever code
> cleanups, to people who know what they're doing. Here are the changes i made,
> and i'm posting via html, so the line wrap will probably mess this up.
> 
> diff -Naur old/MPlayer-20040622/TOOLS/netstream/Makefile
> new/MPlayer-20040622/TOOLS/netstream/Makefile
> --- old/MPlayer-20040622/TOOLS/netstream/Makefile       Tue Feb 17 06:22:32 2004
> +++ new/MPlayer-20040622/TOOLS/netstream/Makefile       Wed Jun 23 03:11:09 2004
> @@ -17,7 +17,7 @@
> 
>  netstream: $(MPROOT)/libmpdemux/libmpdemux.a netstream.o
> -       $(CC) $(CFLAGS) netstream.o -o netstream $(MPROOT)/libmpdemux/libmpdemux.a
> $(MPROOT)/libmpdvdkit2/libmpdvdkit.a
> $(MPROOT)/libmpcodecs/native/minilzo.o $(MPROOT)/libvo/aclib.o
> $(MPROOT)/libmpcodecs/img_format.o $(MPROOT)/libao2/afmt.o
> $(MPROOT)/m_option.o $(MPROOT)/m_struct.o $(MPROOT)/subreader.o
> $(MPROOT)/mp_msg.o $(MPROOT)/osdep/shmem.o $(MPROOT)/osdep/timer-*.o
> $(VORBIS_LIB) $(CDPARANOIA_LIB) -lpthread -lsmbclient -lungif
> +       $(CC) $(CFLAGS) netstream.o -o netstream $(MPROOT)/libmpdemux/libmpdemux.a
> $(MPROOT)/libmpdvdkit2/libmpdvdkit.a
> $(MPROOT)/libmpcodecs/native/minilzo.o $(MPROOT)/libvo/aclib.o
> $(MPROOT)/libmpcodecs/img_format.o $(MPROOT)/libao2/afmt.o
> $(MPROOT)/m_option.o $(MPROOT)/m_struct.o $(MPROOT)/subreader.o
> $(MPROOT)/mp_msg.o $(MPROOT)/osdep/shmem.o $(MPROOT)/osdep/timer-*.o
> $(VORBIS_LIB) $(CDPARANOIA_LIB) $(MPROOT)/osdep/libosdep.a
> $(MPROOT)/liba52/liba52.a -lwsock32 -lwinmm -lungif -lz
> 
>  clean:
>         rm -f *.o *.a *~
> diff -Naur old/MPlayer-20040622/TOOLS/netstream/netstream.c
> new/MPlayer-20040622/TOOLS/netstream/netstream.c
> --- old/MPlayer-20040622/TOOLS/netstream/netstream.c    Sat Apr 17 12:46:41 2004
> +++ new/MPlayer-20040622/TOOLS/netstream/netstream.c    Wed Jun 23 03:09:37 2004
> @@ -48,6 +48,14 @@
>  /// Netstream packets def and some helpers
>  #include <libmpdemux/netstream.h>
> 
> +#if defined(__MINGW32__)
> +#include <windows.h>
> +#include "../../osdep/glob.h"
> +typedef unsigned int socklen_t;
> +#define SIGKILL 4
> +#define SIGHUP 6
> +#define SIGQUIT 7
> +#endif
> 
>  //Set some standard variables
>  char* dvdsub_lang=NULL;
> @@ -254,7 +262,7 @@
>    count++;
>    if(count==3) exit(1);
>    if(count > 3)
> -    kill(getpid(),SIGKILL);
> +    //kill(getpid(),SIGKILL);
>    run_server = 0;
>  }
> 
> @@ -365,7 +373,7 @@
>  }
> 
>  int mp_input_check_interrupt(int time){
> -    if(time) usleep(time);
> +    if(time) sleep(time);
>      return 0;
>  }
> 
> The sigkill, sighup, and sigquit are supposed to be handled by signals.h, but
> the mingw headers don't include them, so i added them right into netstream.c.
> I'm not sure what handles socklen_t, but i found that fix somewhere on Google,
> and it's probably a dirty hack. Win32 uses sleep() instead of usleep(), and i'm
> sure someone has a better fix for kill() than to comment it out. Any help would
> be appreciated.
> 
> Regards,
> Erik
> 
> Btw this was configured with --disable-live and --disable-theora. Netstream
> doesn't need those dependencies kicking around which libmpdemux.a picks up.
> 
> _______________________________________________
> MPlayer-cygwin mailing list
> MPlayer-cygwin at mplayerhq.hu
> http://mplayerhq.hu/mailman/listinfo/mplayer-cygwin
> 


-- 
freewizard (at) gmail.com 
http://blog.tsing.org/freewizard/




More information about the MPlayer-cygwin mailing list