]> git.sesse.net Git - vlc/commitdiff
* Sync MOSX dev/CVS tree : code support for MacOS X audio, video and
authorChristophe Massiot <massiot@videolan.org>
Fri, 6 Apr 2001 18:18:10 +0000 (18:18 +0000)
committerChristophe Massiot <massiot@videolan.org>
Fri, 6 Apr 2001 18:18:10 +0000 (18:18 +0000)
interface (courtesy of Eugenio Jarosiewicz & Colin Delacroix) ;
* Bumped up version number to 0.2.70.

12 files changed:
Makefile.in
configure
configure.in
extras/MacOSX_app/Contents/Info.plist [new file with mode: 0644]
extras/MacOSX_app/Contents/PkgInfo [new file with mode: 0644]
plugins/darwin/darwin.c
plugins/macosx/aout_macosx.c [moved from plugins/darwin/aout_darwin.c with 97% similarity]
plugins/macosx/intf_macosx.c
plugins/macosx/macosx.c
plugins/macosx/vout_macosx.c
src/misc/modules.c
src/video_output/video_text.c

index e744cd5c5bffa8ee91b6eef70727f4c7ea6d7174..693b97bb412a60b85facb8a0705a88efe4364582 100644 (file)
@@ -48,9 +48,12 @@ endif
 # PROGRAM_BUILD is a complete identification of the build
 # (we can't use fancy options with date since OSes like Solaris
 # or FreeBSD have strange date implementations)
-PROGRAM_BUILD = `date` $(USER)
+ifeq ($(SYS),beos)
 # XXX: beos does not support hostname (how lame...)
-#PROGRAM_BUILD = `date` $(USER)@`hostname`
+PROGRAM_BUILD = `date` $(USER)
+else
+PROGRAM_BUILD = `date` $(USER)@`hostname`
+endif
 
 # DEFINE will contain some of the constants definitions decided in Makefile, 
 # including SYS_xx. It will be passed to C compiler.
@@ -306,8 +309,7 @@ PLUGIN_BEOS =       plugins/beos/beos.o \
                plugins/beos/DrawingTidbits.o \
                plugins/beos/TransportButton.o
 
-PLUGIN_DARWIN =        plugins/darwin/darwin.o \
-               plugins/darwin/aout_darwin.o
+PLUGIN_DARWIN =        plugins/darwin/darwin.o
 
 PLUGIN_DSP =   plugins/dsp/dsp.o \
                plugins/dsp/aout_dsp.o
@@ -429,7 +431,6 @@ STD_PLUGIN_OBJ = \
                $(PLUGIN_IDCTMMX) \
                $(PLUGIN_IDCTMMXEXT) \
                $(PLUGIN_IDCTCOMMON) \
-               $(PLUGIN_MACOSX) \
                $(PLUGIN_MGA) \
                $(PLUGIN_MOTION) \
                $(PLUGIN_MOTIONMMX) \
@@ -449,6 +450,7 @@ NONSTD_PLUGIN_OBJ = \
                $(PLUGIN_GLIDE) \
                $(PLUGIN_GTK) \
                $(PLUGIN_GNOME) \
+               $(PLUGIN_MACOSX) \
                $(PLUGIN_IDCTALTIVEC)
 
 NONSTD_CPP_PLUGIN_OBJ = \
@@ -500,6 +502,19 @@ install:
        $(INSTALL) -m 644 share/*.png $(DESTDIR)$(datadir)/videolan
        $(INSTALL) -m 644 share/*.xpm $(DESTDIR)$(datadir)/videolan
 
+ifneq (,$(findstring darwin,$(SYS)))
+# XXX this should only be for MacOS X
+#should the following be "$(DESTDIR)$(bindir)vlc.app/" or "$(DESTDIR)vlc.app/" ?
+    mkdir -p $(DESTDIR)$(bindir)vlc.app/Contents/MacOS
+    mkdir -p $(DESTDIR)$(bindir)vlc.app/Contents/MacOS/lib
+    mkdir -p $(DESTDIR)$(bindir)vlc.app/Contents/MacOS/share
+    $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist $(DESTDIR)$(bindir)vlc.app/Contents/
+    $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo $(DESTDIR)$(bindir)vlc.app/Contents/
+    $(INSTALL) vlc $(DESTDIR)$(bindir)vlc.app/Contents/MacOS/
+    $(INSTALL) $(PLUGINS:%=lib/%.so) $(DESTDIR)$(bindir)vlc.app/Contents/MacOS/lib
+    $(INSTALL) -m 644 share/*.psf $(DESTDIR)$(bindir)vlc.app/Contents/MacOS/share
+endif
+
 show:
        @echo CC: $(CC)
        @echo CFLAGS: $(CFLAGS)
@@ -573,7 +588,12 @@ $(cppdependancies): %.dpp: FORCE
 $(C_OBJ): %.o: Makefile.dep
 $(C_OBJ): %.o: .dep/%.d
 $(C_OBJ): %.o: %.c
+ifneq (,$(findstring darwin,$(SYS)))
+#this is uglier of all
+       @if test "src/ac3_decoder/ac3_imdct.c" = "$<"; then $(CC) `echo $(CFLAGS) | sed -e 's/-O3/-O/'` -c -o $@ $<; echo "(CC) `echo $(CFLAGS) | sed -e 's/-O3/-O/'` -c -o $@ $<"; else $(CC) $(CFLAGS) -c -o $@ $<; echo "$(CC) $(CFLAGS) -c -o $@ $<"; fi
+else
        $(CC) $(CFLAGS) -c -o $@ $<
+endif
 
 $(CPP_OBJ): %.o: Makefile.dep
 $(CPP_OBJ): %.o: .dep/%.dpp
@@ -634,7 +654,12 @@ $(PLUGIN_BEOS): %.o: %.cpp
 $(PLUGIN_IDCTALTIVEC): %.o: Makefile.dep
 $(PLUGIN_IDCTALTIVEC): %.o: .dep/%.d
 $(PLUGIN_IDCTALTIVEC): %.o: %.c
-       $(CC) $(CFLAGS) $(PCFLAGS) -c -o $@ $< -faltivec
+       $(CC) $(CFLAGS) $(PCFLAGS) -faltivec -c -o $@ $<
+
+$(PLUGIN_MACOSX): %.o: Makefile.dep
+$(PLUGIN_MACOSX): %.o: .dep/%.d
+$(PLUGIN_MACOSX): %.o: %.c
+       $(CC) $(CFLAGS) $(PCFLAGS) -fpascal-strings -c -o $@ $<
 
 #
 # Main application target
@@ -647,6 +672,18 @@ ifeq ($(SYS),beos)
        ln -s ../vlc ./plugins/_APP_
 endif
 
+vlc.app: all
+ifneq (,$(findstring darwin,$(SYS)))
+    mkdir -p vlc.app/Contents/MacOS
+    mkdir -p vlc.app/Contents/MacOS/lib
+    mkdir -p vlc.app/Contents/MacOS/share
+    $(INSTALL) -m 644 extras/MacOSX_app/Contents/Info.plist vlc.app/Contents/
+    $(INSTALL) -m 644 extras/MacOSX_app/Contents/PkgInfo vlc.app/Contents/
+    $(INSTALL) vlc vlc.app/Contents/MacOS/
+    $(INSTALL) $(PLUGINS:%=lib/%.so) vlc.app/Contents/MacOS/lib
+    $(INSTALL) -m 644 share/*.psf vlc.app/Contents/MacOS/share
+endif
+
 #
 # Plugin targets
 #
@@ -710,7 +747,7 @@ lib/kde.so: $(PLUGIN_KDE)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -lkdeui -lkdecore -lqt -ldl
 
 lib/macosx.so: $(PLUGIN_MACOSX)
-       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -framework CoreAudio -framework Carbon -framework AGL
 
 lib/mga.so: $(PLUGIN_MGA)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -L/usr/X11R6/lib -lX11 -lXext
@@ -737,10 +774,14 @@ lib/qt.so: $(PLUGIN_QT)
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -lqt -L${QTDIR}/lib
 
 lib/sdl.so: $(PLUGIN_SDL)
+ifneq (,$(findstring darwin,$(SYS)))
+       $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) @LIB_SDL@ -framework Carbon -framework AGL
+else
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) @LIB_SDL@
+endif
 
 lib/ts.so: $(PLUGIN_TS)
-ifeq ($(SYS),darwin)
+ifneq (,$(findstring darwin,$(SYS)))
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) -framework AGL -framework Carbon
 else
        $(CC) $(PCFLAGS) -o $@ $^ $(PLCFLAGS) 
index 2c2eab23cc05c8196a6bfbc633c8075607e7772f..3b5bbe5a7e5340e495a2fc67eec24f93b85cdcee 100755 (executable)
--- a/configure
+++ b/configure
@@ -20,7 +20,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   --disable-mmx           Disable MMX optimizations (default enabled for x86)"
 ac_help="$ac_help
-  --enable-altivec        Enable altivec optimizations (default enabled for PPC)"
+  --enable-altivec        Enable altivec optimizations (default disabled since it is broken)"
 ac_help="$ac_help
   --disable-css           Disable DVD CSS decryption (default enabled)"
 ac_help="$ac_help
@@ -36,7 +36,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   --enable-darwin         Darwin sound support (default disabled)"
 ac_help="$ac_help
-  --enable-macosx         Mac OS X interface support (default disabled)"
+  --enable-macosx         Mac OS X interface support (default enabled in Mac OS X)"
 ac_help="$ac_help
   --enable-fb             Linux framebuffer support (default disabled)"
 ac_help="$ac_help
@@ -620,7 +620,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 echo "$ac_t""$host" 1>&6
 
 
-VLC_VERSION=0.2.63
+VLC_VERSION=0.2.70
 
 VLC_CODENAME=Urumov
 
@@ -1036,7 +1036,7 @@ else
 int main() {
 
 /* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
 /* SunOS 4.1.1 cc rejects this.  */
 char const *const *ccp;
 char **p;
@@ -2032,12 +2032,15 @@ else
 #include <sys/types.h>
 #include <fcntl.h>
 #include <sys/mman.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif
 
 /* This mess was copied from the GNU getpagesize.h.  */
 #ifndef HAVE_GETPAGESIZE
-# ifdef HAVE_UNISTD_H
-#  include <unistd.h>
-# endif
 
 /* Assume that all systems that can run configure have sys/param.h.  */
 # ifndef HAVE_SYS_PARAM_H
@@ -2092,7 +2095,7 @@ main()
        /*
         * First, make a file with some known garbage in it.
         */
-       data = malloc(pagesize);
+       data = (char*)malloc(pagesize);
        if (!data)
                exit(1);
        for (i = 0; i < pagesize; ++i)
@@ -2113,7 +2116,7 @@ main()
        fd = open("conftestmmap", O_RDWR);
        if (fd < 0)
                exit(1);
-       data2 = malloc(2 * pagesize);
+       data2 = (char*)malloc(2 * pagesize);
        if (!data2)
                exit(1);
        data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1);
@@ -2131,7 +2134,7 @@ main()
         */
        for (i = 0; i < pagesize; ++i)
                *(data2 + i) = *(data2 + i) + 1;
-       data3 = malloc(pagesize);
+       data3 = (char*)malloc(pagesize);
        if (!data3)
                exit(1);
        if (read(fd, data3, pagesize) != pagesize)
@@ -2145,7 +2148,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2149: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_mmap_fixed_mapped=yes
 else
@@ -2168,12 +2171,12 @@ EOF
 fi
 
 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:2172: checking return type of signal handlers" >&5
+echo "configure:2175: checking return type of signal handlers" >&5
 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2177 "configure"
+#line 2180 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
@@ -2190,7 +2193,7 @@ int main() {
 int i;
 ; return 0; }
 EOF
-if { (eval echo configure:2194: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2197: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_type_signal=void
 else
@@ -2209,7 +2212,7 @@ EOF
 
 
 echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
-echo "configure:2213: checking for dlopen in -ldl" >&5
+echo "configure:2216: checking for dlopen in -ldl" >&5
 ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2217,7 +2220,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-ldl  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2221 "configure"
+#line 2224 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2228,7 +2231,7 @@ int main() {
 dlopen()
 ; return 0; }
 EOF
-if { (eval echo configure:2232: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2235: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2249,7 +2252,7 @@ else
 fi
 
 echo $ac_n "checking for powl in -lm""... $ac_c" 1>&6
-echo "configure:2253: checking for powl in -lm" >&5
+echo "configure:2256: checking for powl in -lm" >&5
 ac_lib_var=`echo m'_'powl | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2257,7 +2260,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lm  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2261 "configure"
+#line 2264 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2268,7 +2271,7 @@ int main() {
 powl()
 ; return 0; }
 EOF
-if { (eval echo configure:2272: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2275: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2289,7 +2292,7 @@ else
 fi
 
 echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6
-echo "configure:2293: checking for pthread_create in -lpthread" >&5
+echo "configure:2296: checking for pthread_create in -lpthread" >&5
 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2297,7 +2300,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lpthread  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2301 "configure"
+#line 2304 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2308,7 +2311,7 @@ int main() {
 pthread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:2312: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2315: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2329,7 +2332,7 @@ else
 fi
 
 echo $ac_n "checking for thread_create in -lthreads""... $ac_c" 1>&6
-echo "configure:2333: checking for thread_create in -lthreads" >&5
+echo "configure:2336: checking for thread_create in -lthreads" >&5
 ac_lib_var=`echo threads'_'thread_create | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -2337,7 +2340,7 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lthreads  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 2341 "configure"
+#line 2344 "configure"
 #include "confdefs.h"
 /* Override any gcc2 internal prototype to avoid an error.  */
 /* We use char because int might match the return type of a gcc2
@@ -2348,7 +2351,7 @@ int main() {
 thread_create()
 ; return 0; }
 EOF
-if { (eval echo configure:2352: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2355: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
@@ -2374,17 +2377,17 @@ for ac_hdr in stddef.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2378: checking for $ac_hdr" >&5
+echo "configure:2381: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2383 "configure"
+#line 2386 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2388: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2391: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2414,17 +2417,17 @@ for ac_hdr in getopt.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2418: checking for $ac_hdr" >&5
+echo "configure:2421: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2423 "configure"
+#line 2426 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2428: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2431: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2454,17 +2457,17 @@ for ac_hdr in sys/sockio.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2458: checking for $ac_hdr" >&5
+echo "configure:2461: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2463 "configure"
+#line 2466 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2468: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2471: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2494,17 +2497,17 @@ for ac_hdr in fcntl.h sys/time.h unistd.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2498: checking for $ac_hdr" >&5
+echo "configure:2501: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2503 "configure"
+#line 2506 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2508: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2511: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2534,17 +2537,17 @@ for ac_hdr in sys/soundcard.h machine/soundcard.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2538: checking for $ac_hdr" >&5
+echo "configure:2541: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2543 "configure"
+#line 2546 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2551: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2574,17 +2577,17 @@ for ac_hdr in dlfcn.h image.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2578: checking for $ac_hdr" >&5
+echo "configure:2581: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2583 "configure"
+#line 2586 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2588: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2591: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2614,17 +2617,17 @@ for ac_hdr in arpa/inet.h net/if.h netinet/in.h sys/socket.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2618: checking for $ac_hdr" >&5
+echo "configure:2621: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2623 "configure"
+#line 2626 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2628: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2654,17 +2657,17 @@ for ac_hdr in machine/param.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2658: checking for $ac_hdr" >&5
+echo "configure:2661: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2663 "configure"
+#line 2666 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2668: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2671: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2695,17 +2698,17 @@ for ac_hdr in cthreads.h pthread.h kernel/scheduler.h kernel/OS.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:2699: checking for $ac_hdr" >&5
+echo "configure:2702: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2704 "configure"
+#line 2707 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2709: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2712: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2736,9 +2739,9 @@ save_CFLAGS=$CFLAGS
 
 CFLAGS="${CFLAGS} -Wall -Werror"
 echo $ac_n "checking for ntohl in sys/param.h""... $ac_c" 1>&6
-echo "configure:2740: checking for ntohl in sys/param.h" >&5
+echo "configure:2743: checking for ntohl in sys/param.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2742 "configure"
+#line 2745 "configure"
 #include "confdefs.h"
 #include <sys/param.h>
 void foo() { int meuh; ntohl(meuh); }
@@ -2746,7 +2749,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2750: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2753: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define NTOHL_IN_SYS_PARAM_H 1
@@ -2763,16 +2766,16 @@ rm -f conftest*
 
 CFLAGS="${CFLAGS} -rdynamic -Wall -Werror"
 echo $ac_n "checking if \$CC accepts -rdynamic""... $ac_c" 1>&6
-echo "configure:2767: checking if \$CC accepts -rdynamic" >&5
+echo "configure:2770: checking if \$CC accepts -rdynamic" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2769 "configure"
+#line 2772 "configure"
 #include "confdefs.h"
 
 int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2779: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   LCFLAGS=${LCFLAGS}" -rdynamic"
  echo "$ac_t""yes" 1>&6
@@ -2787,9 +2790,9 @@ rm -f conftest*
 CFLAGS=$save_CFLAGS
 
 echo $ac_n "checking for boolean_t in sys/types.h""... $ac_c" 1>&6
-echo "configure:2791: checking for boolean_t in sys/types.h" >&5
+echo "configure:2794: checking for boolean_t in sys/types.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2793 "configure"
+#line 2796 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 void quux() { boolean_t foo; }
@@ -2797,7 +2800,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2804: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define BOOLEAN_T_IN_SYS_TYPES_H 1
@@ -2812,9 +2815,9 @@ else
 fi
 rm -f conftest*
 echo $ac_n "checking for boolean_t in pthread.h""... $ac_c" 1>&6
-echo "configure:2816: checking for boolean_t in pthread.h" >&5
+echo "configure:2819: checking for boolean_t in pthread.h" >&5
 cat > conftest.$ac_ext <<EOF
-#line 2818 "configure"
+#line 2821 "configure"
 #include "confdefs.h"
 #include <pthread.h>
 void quux() { boolean_t foo; }
@@ -2822,7 +2825,7 @@ int main() {
 
 ; return 0; }
 EOF
-if { (eval echo configure:2826: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2829: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   cat >> confdefs.h <<\EOF
 #define BOOLEAN_T_IN_PTHREAD_H 1
@@ -2838,18 +2841,18 @@ fi
 rm -f conftest*
 
 echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:2842: checking for working const" >&5
+echo "configure:2845: checking for working const" >&5
 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2847 "configure"
+#line 2850 "configure"
 #include "confdefs.h"
 
 int main() {
 
 /* Ultrix mips cc rejects this.  */
-typedef int charset[2]; const charset x;
+typedef int charset[2]; const charset x = {0,0};
 /* SunOS 4.1.1 cc rejects this.  */
 char const *const *ccp;
 char **p;
@@ -2892,7 +2895,7 @@ ccp = (char const *const *) p;
 
 ; return 0; }
 EOF
-if { (eval echo configure:2896: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:2899: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_c_const=yes
 else
@@ -2913,12 +2916,12 @@ EOF
 fi
 
 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:2917: checking for ANSI C header files" >&5
+echo "configure:2920: checking for ANSI C header files" >&5
 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2922 "configure"
+#line 2925 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
@@ -2926,7 +2929,7 @@ else
 #include <float.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:2930: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:2933: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -2943,7 +2946,7 @@ rm -f conftest*
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2947 "configure"
+#line 2950 "configure"
 #include "confdefs.h"
 #include <string.h>
 EOF
@@ -2961,7 +2964,7 @@ fi
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
 cat > conftest.$ac_ext <<EOF
-#line 2965 "configure"
+#line 2968 "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 EOF
@@ -2982,7 +2985,7 @@ if test "$cross_compiling" = yes; then
   :
 else
   cat > conftest.$ac_ext <<EOF
-#line 2986 "configure"
+#line 2989 "configure"
 #include "confdefs.h"
 #include <ctype.h>
 #define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -2993,7 +2996,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
 exit (0); }
 
 EOF
-if { (eval echo configure:2997: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:3000: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   :
 else
@@ -3017,12 +3020,12 @@ EOF
 fi
 
 echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:3021: checking for size_t" >&5
+echo "configure:3024: checking for size_t" >&5
 if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3026 "configure"
+#line 3029 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #if STDC_HEADERS
@@ -3050,12 +3053,12 @@ EOF
 fi
 
 echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6
-echo "configure:3054: checking whether time.h and sys/time.h may both be included" >&5
+echo "configure:3057: checking whether time.h and sys/time.h may both be included" >&5
 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3059 "configure"
+#line 3062 "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <sys/time.h>
@@ -3064,7 +3067,7 @@ int main() {
 struct tm *tp;
 ; return 0; }
 EOF
-if { (eval echo configure:3068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:3071: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
   rm -rf conftest*
   ac_cv_header_time=yes
 else
@@ -3096,17 +3099,17 @@ for ac_hdr in sys/ioctl.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3100: checking for $ac_hdr" >&5
+echo "configure:3103: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3105 "configure"
+#line 3108 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3110: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3113: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3131,17 +3134,17 @@ EOF
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3135: checking for $ac_hdr" >&5
+echo "configure:3138: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3140 "configure"
+#line 3143 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3145: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3148: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3168,7 +3171,7 @@ fi
 done
 
    cat > conftest.$ac_ext <<EOF
-#line 3172 "configure"
+#line 3175 "configure"
 #include "confdefs.h"
 #include <linux/cdrom.h>
 EOF
@@ -3223,10 +3226,9 @@ fi
 if test "${enable_altivec+set}" = set; then
   enableval="$enable_altivec"
    if test x$enableval = xyes; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi 
-else
-   if test -d /System/Library/Frameworks/vecLib.framework; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi 
 fi
 
+#[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi ])
 # Check whether --enable-css or --disable-css was given.
 if test "${enable_css+set}" = set; then
   enableval="$enable_css"
@@ -3291,22 +3293,28 @@ fi
 if test "${enable_darwin+set}" = set; then
   enableval="$enable_darwin"
   if test x$enable_darwin = xyes; then PLUGINS=${PLUGINS}"darwin "; fi
+fi
+
+# Check whether --enable-macosx or --disable-macosx was given.
+if test "${enable_macosx+set}" = set; then
+  enableval="$enable_macosx"
+  if test x$enable_macosx = xyes; then PLUGINS=${PLUGINS}"macosx "; fi
 else
-  for ac_hdr in CoreAudio/AudioHardware.h
+  for ac_hdr in Carbon/Carbon.h
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3300: checking for $ac_hdr" >&5
+echo "configure:3308: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3305 "configure"
+#line 3313 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3310: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3318: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3326,7 +3334,7 @@ if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   cat >> confdefs.h <<EOF
 #define $ac_tr_hdr 1
 EOF
- PLUGINS=${PLUGINS}"darwin "
+ PLUGINS=${PLUGINS}"macosx "
 else
   echo "$ac_t""no" 1>&6
 fi
@@ -3334,12 +3342,6 @@ done
 
 fi
 
-# Check whether --enable-macosx or --disable-macosx was given.
-if test "${enable_macosx+set}" = set; then
-  enableval="$enable_macosx"
-  if test x$enable_macosx = xyes; then PLUGINS=${PLUGINS}"macosx "; fi
-fi
-
 # Check whether --enable-fb or --disable-fb was given.
 if test "${enable_fb+set}" = set; then
   enableval="$enable_fb"
@@ -3376,17 +3378,17 @@ if test "${with_sdl+set}" = set; then
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3380: checking for $ac_hdr" >&5
+echo "configure:3382: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3385 "configure"
+#line 3387 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3390: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3392: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3424,17 +3426,17 @@ fi
 do
 ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:3428: checking for $ac_hdr" >&5
+echo "configure:3430: checking for $ac_hdr" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3433 "configure"
+#line 3435 "configure"
 #include "confdefs.h"
 #include <$ac_hdr>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3438: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3440: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3532,17 +3534,17 @@ if test "${enable_alsa+set}" = set; then
   enableval="$enable_alsa"
   if test x$enable_alsa = xyes; then ac_safe=`echo "sys/asoundlib.h" | sed 'y%./+-%__p_%'`
 echo $ac_n "checking for sys/asoundlib.h""... $ac_c" 1>&6
-echo "configure:3536: checking for sys/asoundlib.h" >&5
+echo "configure:3538: checking for sys/asoundlib.h" >&5
 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 3541 "configure"
+#line 3543 "configure"
 #include "confdefs.h"
 #include <sys/asoundlib.h>
 EOF
 ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:3546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:3548: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
 ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
 if test -z "$ac_err"; then
   rm -rf conftest*
@@ -3559,7 +3561,7 @@ fi
 if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
   echo "$ac_t""yes" 1>&6
   echo $ac_n "checking for main in -lasound""... $ac_c" 1>&6
-echo "configure:3563: checking for main in -lasound" >&5
+echo "configure:3565: checking for main in -lasound" >&5
 ac_lib_var=`echo asound'_'main | sed 'y%./+-%__p_%'`
 if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
@@ -3567,14 +3569,14 @@ else
   ac_save_LIBS="$LIBS"
 LIBS="-lasound  $LIBS"
 cat > conftest.$ac_ext <<EOF
-#line 3571 "configure"
+#line 3573 "configure"
 #include "confdefs.h"
 
 int main() {
 main()
 ; return 0; }
 EOF
-if { (eval echo configure:3578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:3580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_lib_$ac_lib_var=yes"
 else
index ffa961bb3d40f3c6093286b5bb0ac2fe13bce239..a71a4b5f866e0f9e88a0b8b98a49e9052c1a6852 100644 (file)
@@ -4,7 +4,7 @@ AC_CONFIG_HEADER(include/defs.h)
 
 AC_CANONICAL_HOST
 
-VLC_VERSION=0.2.63
+VLC_VERSION=0.2.70
 AC_SUBST(VLC_VERSION)
 VLC_CODENAME=Urumov
 AC_SUBST(VLC_CODENAME)
@@ -130,9 +130,9 @@ AC_ARG_ENABLE(mmx,
 [ if test x$enableval = xyes; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}${ACCEL_PLUGINS}; fi ],
 [ if test x${host_cpu} = xi686 -o x${host_cpu} = xi586 -o x${host_cpu} = xx86; then ARCH=${ARCH}" mmx"; PLUGINS=${PLUGINS}${ACCEL_PLUGINS}; fi ])
 AC_ARG_ENABLE(altivec,
-[  --enable-altivec        Enable altivec optimizations (default enabled for PPC)],
-[ if test x$enableval = xyes; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi ],
-[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi ])
+[  --enable-altivec        Enable altivec optimizations (default disabled since it is broken)],
+[ if test x$enableval = xyes; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi ])
+#[ if test -d /System/Library/Frameworks/vecLib.framework; then ARCH=${ARCH}" altivec"; PLUGINS=${PLUGINS}"idctaltivec "; fi ])
 AC_ARG_ENABLE(css,
 [  --disable-css           Disable DVD CSS decryption (default enabled)],
 [ if test x$enableval = xyes; then CSS=1; else CSS=0; fi ], [ CSS=1; ])
@@ -172,11 +172,11 @@ AC_ARG_ENABLE(esd,
   [if test x$enable_esd = xyes; then PLUGINS=${PLUGINS}"esd "; fi])
 AC_ARG_ENABLE(darwin,
   [  --enable-darwin         Darwin sound support (default disabled)],
-  [if test x$enable_darwin = xyes; then PLUGINS=${PLUGINS}"darwin "; fi],
-  [AC_CHECK_HEADERS(CoreAudio/AudioHardware.h, [PLUGINS=${PLUGINS}"darwin "])])
+  [if test x$enable_darwin = xyes; then PLUGINS=${PLUGINS}"darwin "; fi])
 AC_ARG_ENABLE(macosx,
-  [  --enable-macosx         Mac OS X interface support (default disabled)],
-  [if test x$enable_macosx = xyes; then PLUGINS=${PLUGINS}"macosx "; fi])
+  [  --enable-macosx         Mac OS X interface support (default enabled in Mac OS X)],
+  [if test x$enable_macosx = xyes; then PLUGINS=${PLUGINS}"macosx "; fi],
+  [AC_CHECK_HEADERS(Carbon/Carbon.h, PLUGINS=${PLUGINS}"macosx ")])
 AC_ARG_ENABLE(fb,
   [  --enable-fb             Linux framebuffer support (default disabled)],
   [if test x$enable_fb = xyes; then PLUGINS=${PLUGINS}"fb "; fi])
diff --git a/extras/MacOSX_app/Contents/Info.plist b/extras/MacOSX_app/Contents/Info.plist
new file mode 100644 (file)
index 0000000..5da3111
--- /dev/null
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
+<plist version="0.9">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleExecutable</key>
+       <string>vlc</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>0.1</string>
+       <key>CSResourcesFileMapped</key>
+       <true/>
+</dict>
+</plist>
diff --git a/extras/MacOSX_app/Contents/PkgInfo b/extras/MacOSX_app/Contents/PkgInfo
new file mode 100644 (file)
index 0000000..bd04210
--- /dev/null
@@ -0,0 +1 @@
+APPL????
\ No newline at end of file
index 86fbf0ecd380bffc603c041a0e03aaf2fb863c04..f26d3bddeadb38a582dce985d56c068ad7d483bd 100644 (file)
@@ -2,7 +2,7 @@
  * darwin.c : Darwin plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: darwin.c,v 1.3 2001/03/21 13:42:33 sam Exp $
+ * $Id: darwin.c,v 1.4 2001/04/06 18:18:10 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *          Christophe Massiot <massiot@via.ecp.fr>
 #define MODULE_NAME darwin
 #include "modules_inner.h"
 
+/* CD (2001/04/06):
+ * This module was written to handle audio output when we thought that 
+ * CoreAudio was in Darwin. It currently does nothing.
+ * All the audio output code has been moved to the macosx plugin.
+ */
+
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
@@ -50,7 +56,7 @@ MODULE_CONFIG_END
 /*****************************************************************************
  * Capabilities defined in the other files.
  *****************************************************************************/
-void _M( aout_getfunctions )( function_list_t * p_function_list );
+// void _M( aout_getfunctions )( function_list_t * p_function_list );
 
 /*****************************************************************************
  * InitModule: get the module structure and configuration.
@@ -63,11 +69,10 @@ void _M( aout_getfunctions )( function_list_t * p_function_list );
 MODULE_INIT
 {
     p_module->psz_name = MODULE_STRING;
-    p_module->psz_longname = "Darwin HAL sound support module";
+    p_module->psz_longname = "Darwin support module";
     p_module->psz_version = VERSION;
 
-    p_module->i_capabilities = MODULE_CAPABILITY_NULL
-                                | MODULE_CAPABILITY_AOUT;
+    p_module->i_capabilities = MODULE_CAPABILITY_NULL;
 
     return( 0 );
 }
@@ -88,7 +93,7 @@ MODULE_ACTIVATE
         return( -1 );
     }
 
-    _M( aout_getfunctions )( &p_module->p_functions->aout );
+    // _M( aout_getfunctions )( &p_module->p_functions->aout );
 
     p_module->p_config = p_config;
 
similarity index 97%
rename from plugins/darwin/aout_darwin.c
rename to plugins/macosx/aout_macosx.c
index d5d6520630633374267f0e4543fbaa250f6a9ca5..3340beab7d93f7e62e8762730ba70ed5dc1623b1 100644 (file)
@@ -2,7 +2,7 @@
  * aout_darwin.c : Darwin audio output plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: aout_darwin.c,v 1.4 2001/04/05 03:50:38 sam Exp $
+ * $Id: aout_macosx.c,v 1.1 2001/04/06 18:18:10 massiot Exp $
  *
  * Authors: Colin Delacroix <colin@zoy.org>
  *
@@ -34,7 +34,7 @@
  * Find 8 bits files and adapt output
  */
  
-#define MODULE_NAME darwin
+#define MODULE_NAME macosx
 #include "modules_inner.h"
 
 /*****************************************************************************
@@ -128,12 +128,12 @@ void _M( aout_getfunctions )( function_list_t * p_function_list )
  *****************************************************************************/
 static int aout_Probe( probedata_t *p_data )
 {
-    if( TestMethod( AOUT_METHOD_VAR, "darwin" ) )
+    if( TestMethod( AOUT_METHOD_VAR, "macosx" ) )
     {
         return( 999 );
     }
 
-    /* The Darwin plugin always works under Darwin or MacOS X */
+    /* This plugin always works under OS X */
     return( 100 );
 }
 
@@ -219,7 +219,7 @@ static int aout_Open( aout_thread_t *p_aout )
     if( p_aout->p_sys->p_Data == nil ) return paramErr;
 
 #if WRITE_AUDIO_OUTPUT_TO_FILE
-    p_aout->p_sys->fd = open( "/Users/bofh/audio-darwin.pcm", O_RDWR|O_CREAT );
+    p_aout->p_sys->fd = open( "audio-darwin.pcm", O_RDWR|O_CREAT );
     intf_WarnMsg( 1, "open(...) -> %d", p_aout->p_sys->fd );
 #endif
 
@@ -247,7 +247,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
     if( err != noErr )
     {
         /* We have to tell the decoder to use audio device's buffer size  */
-        intf_ErrMsg( "AudioDeviceSetProperty failed ( buffersize = %d ) -> %d",
+        intf_ErrMsg( "aout : AudioDeviceSetProperty failed ( buffersize = %d ) -> %d",
                      ui_bufferSize, err );
         return( -1 );
     }
@@ -328,7 +328,7 @@ static int aout_SetFormat( aout_thread_t *p_aout )
                                           ui_paramSize, &format);
             if( err != noErr )
             {
-                intf_ErrMsg( "AudioDeviceSetProperty( mFormatFlags = %x, " 
+                intf_ErrMsg( "aout : AudioDeviceSetProperty( mFormatFlags = %x, " 
                              "mSampleRate = %f, mChannelsPerFrame = %d ) -> %d", 
                              format.mFormatFlags, format.mSampleRate, 
                              format.mChannelsPerFrame, err );
index 345a60f1be3299b63aa0aaa5f6c2e702290136cb..5c8b90cdef4576bcfd012e199ab9fcc18069b61c 100644 (file)
@@ -2,9 +2,9 @@
  * intf_macosx.c: MacOS X interface plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: intf_macosx.c,v 1.2 2001/03/21 13:42:34 sam Exp $
  *
- * Authors: 
+ * Authors: Colin Delacroix <colin@zoy.org>
+ *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include "intf_msg.h"
 #include "interface.h"
 
+/* FIXME: get rid of this and do menus & command keys*/
+#include "keystrokes.h"
+
 #include "modules.h"
 
+#include "stream_control.h"
+#include "input_ext-intf.h"
+
+#include "intf_playlist.h"
+#include "audio_output.h"
+
 #include "main.h"
 
+#include <Carbon/Carbon.h>
+
+//how often to have callback to main loop.  Target of 30fps then 30hz + maybe some more...
+//it doesn't really scale if we move to 2x the hz...  something else is slowing us down...
+
+#define kMainLoopFrequency  (kEventDurationSecond / 45)                //45 for good measure
+
+#define PLAYING                0
+#define PAUSED         1
+
+// Menu defs
+enum
+{
+/*    kMenuApple  = 128,
+    kMenuFile   = 129,
+    kMenuControls   = 130,
+
+    kAppleAbout = 1, 
+    kAppleQuit = 7, //is this always the same?
+
+    kFileNew   = 1, 
+    kFileOpen   = 2, 
+    kFileCloseDivisor   = 3,
+    kFileClose   = 4,
+
+    kControlsPlayORPause   = 1, 
+    kControlsStop   = 2, 
+    kControlsForward   = 3, 
+    kControlsRewind   = 4, 
+    kControlsChapterDiv   = 5, 
+    kControlsChapterNext   = 6, 
+    kControlsChapterPrevious   = 7, 
+    kControlsDVDdiv   = 8, 
+    kControlsDVDMenu   = 9, 
+    kControlsVolumeDiv   = 10, 
+    kControlsVolumeUp   = 11, 
+    kControlsVolumeDown   = 12, 
+    kControlsVolumeMute   = 13, 
+    kControlsEjectDiv   = 14, 
+    kControlsEject   = 15 
+*/
+
+    kMenuApple  = 128,
+    kMenuFile   = 129,
+    kMenuControls   = 130,
+
+    kAppleAbout = 1, 
+    kAppleQuit = 7, //is this always the same?
+
+    kFileNew   = 1, 
+    kFileOpen,
+    kFileCloseDivisor,
+    kFileClose,
+
+    kControlsPlayORPause   = 1, 
+    kControlsStop,
+    kControlsForward,
+    kControlsRewind,
+    kControlsChapterDiv,
+    kControlsChapterNext,
+    kControlsChapterPrevious,
+    kControlsDVDdiv,
+    kControlsDVDMenu,
+    kControlsVolumeDiv,
+    kControlsVolumeUp,
+    kControlsVolumeDown,
+    kControlsVolumeMute,
+    kControlsEjectDiv,
+    kControlsEject 
+
+
+
+#if 0
+//virtual key codes ; raw subtract 0x40 from these values
+//http://devworld.apple.com/techpubs/mac/Text/Text-577.html#HEADING577-0
+    kLeftArrow = 0x7B,
+    kRightArrow = 0x7C,
+    kDownArrow = 0x7D,
+    kUpArrow = 0x7E,
+
+//http://devworld.apple.com/techpubs/mac/Text/Text-571.html#MARKER-9-18    
+    kPeriod = 47, //(decimal)
+    kSpace = 49, //(decimal)
+    kEscape = 53 //(decimal)
+#endif
+
+};
+
 /*****************************************************************************
  * intf_sys_t: description and status of the interface
  *****************************************************************************/
 typedef struct intf_sys_s
 {
-
+    EventLoopTimerRef manageTimer;
+    
 } intf_sys_t;
 
 /*****************************************************************************
@@ -60,6 +158,23 @@ static int  intf_Open      ( intf_thread_t *p_intf );
 static void intf_Close     ( intf_thread_t *p_intf );
 static void intf_Run       ( intf_thread_t *p_intf );
 
+/* OS Specific */
+
+void CarbonManageCallback ( EventLoopTimerRef inTimer, void *inUserData );
+
+#ifndef CarbonEvents
+void EventLoop( intf_thread_t *p_intf );
+void DoEvent( intf_thread_t *p_intf , EventRecord *event);
+void DoMenuCommand( intf_thread_t *p_intf , long menuResult);
+void DrawWindow(WindowRef window);
+#else
+/*
+pascal OSErr   QuitEventHandler(const AppleEvent *theEvent, AppleEvent *theReply, SInt32 refCon);
+static pascal OSStatus MyKeyHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* userData );
+static pascal OSStatus MyWindowEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData);
+*/
+#endif
+
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
@@ -94,6 +209,9 @@ static int intf_Probe( probedata_t *p_data )
  *****************************************************************************/
 static int intf_Open( intf_thread_t *p_intf )
 {
+    MenuHandle menu;
+//    MenuRef windMenu;
+
     /* Allocate instance and initialize some members */
     p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
     if( p_intf->p_sys == NULL )
@@ -101,6 +219,112 @@ static int intf_Open( intf_thread_t *p_intf )
         return( 1 );
     };
 
+    /* Init Mac stuff */
+    InitCursor();
+    SetQDGlobalsRandomSeed( TickCount() );
+
+#if 0
+    p_intf->p_intf_get_key = intf_GetKey;
+
+    intf_AssignKey( p_intf , 'Q', INTF_KEY_QUIT, 0);
+    intf_AssignKey( p_intf , 'q', INTF_KEY_QUIT, 0);
+    intf_AssignKey( p_intf ,  27, INTF_KEY_QUIT, 0);
+    intf_AssignKey( p_intf ,   3, INTF_KEY_QUIT, 0);
+    intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
+    intf_AssignKey( p_intf , '1', INTF_KEY_SET_CHANNEL, 1);
+    intf_AssignKey( p_intf , '2', INTF_KEY_SET_CHANNEL, 2);
+    intf_AssignKey( p_intf , '3', INTF_KEY_SET_CHANNEL, 3);
+    intf_AssignKey( p_intf , '4', INTF_KEY_SET_CHANNEL, 4);
+    intf_AssignKey( p_intf , '5', INTF_KEY_SET_CHANNEL, 5);
+    intf_AssignKey( p_intf , '6', INTF_KEY_SET_CHANNEL, 6);
+    intf_AssignKey( p_intf , '7', INTF_KEY_SET_CHANNEL, 7);
+    intf_AssignKey( p_intf , '8', INTF_KEY_SET_CHANNEL, 8);
+    intf_AssignKey( p_intf , '9', INTF_KEY_SET_CHANNEL, 9);
+    intf_AssignKey( p_intf , '0', INTF_KEY_SET_CHANNEL, 0);
+    intf_AssignKey( p_intf , '+', INTF_KEY_INC_VOLUME, 0);
+    intf_AssignKey( p_intf , '-', INTF_KEY_DEC_VOLUME, 0);
+    intf_AssignKey( p_intf , 'm', INTF_KEY_TOGGLE_VOLUME, 0);
+    intf_AssignKey( p_intf , 'M', INTF_KEY_TOGGLE_VOLUME, 0);
+    intf_AssignKey( p_intf , 'g', INTF_KEY_DEC_GAMMA, 0);
+    intf_AssignKey( p_intf , 'G', INTF_KEY_INC_GAMMA, 0);
+    intf_AssignKey( p_intf , 'c', INTF_KEY_TOGGLE_GRAYSCALE, 0);
+    intf_AssignKey( p_intf , ' ', INTF_KEY_TOGGLE_INTERFACE, 0);
+    intf_AssignKey( p_intf , 'i', INTF_KEY_TOGGLE_INFO, 0);
+    intf_AssignKey( p_intf , 's', INTF_KEY_TOGGLE_SCALING, 0);
+    intf_AssignKey( p_intf , 'd', INTF_KEY_DUMP_STREAM, 0);
+
+
+//EJ - neat menu but don't know if we want it.
+// Install the Windows menu. Free of charge!
+//    CreateStandardWindowMenu( 0, &windMenu );
+//    InsertMenu( windMenu, 0 );
+//    DrawMenuBar();
+
+#else
+
+    menu = NewMenu( kMenuApple, "\p\024" );
+    AppendMenu( menu, "\pAbout VLCÉ/A" );
+    InsertMenu( menu, 0 );
+
+    menu = NewMenu( kMenuFile, "\pFile" );
+    AppendMenu( menu, "\pNew Viewer Window/N" );
+    AppendMenu( menu, "\pOpenÉ/O" );
+    AppendMenu( menu, "\p(-" );
+    AppendMenu( menu, "\pClose/W" );
+    InsertMenu( menu, 0 );
+
+//BIG HONKING MENU - in order Mac OS 9 dvd player
+//can't get key codes right for menus... argh that's why they use resources!
+
+    menu = NewMenu( kMenuControls, "\pControls" );
+
+    AppendMenu( menu, "\pPlay/," );
+//    SetMenuItemCommandKey(menu, 0, false, kSpace);
+//    SetMenuItemModifiers( menu, 0, kMenuNoCommandModifier);
+
+    AppendMenu( menu, "\pStop/." );
+
+    AppendMenu( menu, "\pFast Forward/f" );
+//    SetMenuItemCommandKey(menu, 2, false, kRightArrow);
+
+    AppendMenu( menu, "\pRewind/r" );
+//    SetMenuItemCommandKey(menu, 3, false, kLeftArrow);
+
+    AppendMenu( menu, "\p(-" ); //4
+
+    AppendMenu( menu, "\pNext Chapter/c" );
+//    SetMenuItemCommandKey(menu, 5, false, kRightArrow);
+//    SetMenuItemModifiers( menu, 5, kMenuNoCommandModifier);
+
+    AppendMenu( menu, "\pPrevious Chapter/p" );
+//    SetMenuItemCommandKey(menu, 6, false, kLeftArrow);
+//    SetMenuItemModifiers( menu, 6, kMenuNoCommandModifier);
+
+    AppendMenu( menu, "\p(-" ); //7
+
+    AppendMenu( menu, "\pDVD Menu/v" );
+//    SetMenuItemCommandKey(menu, 8, false, kEscape);
+//    SetMenuItemModifiers( menu, 8, kMenuNoCommandModifier);
+
+    AppendMenu( menu, "\p(-" ); //9
+
+    AppendMenu( menu, "\pVolume Up/u" );
+//    SetMenuItemCommandKey(menu, 10, false, kUpArrow);
+
+    AppendMenu( menu, "\pVolume Down/d" );
+//    SetMenuItemCommandKey(menu, 11, false, kDownArrow);
+
+    AppendMenu( menu, "\pMute/M" ); //12
+
+    AppendMenu( menu, "\p(-" ); //13
+
+    AppendMenu( menu, "\pEject/E" ); //14
+
+    InsertMenu( menu, 0 );
+#endif
+
+    DrawMenuBar();
+
     return( 0 );
 }
 
@@ -113,19 +337,466 @@ static void intf_Close( intf_thread_t *p_intf )
     free( p_intf->p_sys );
 }
 
-
 /*****************************************************************************
  * intf_Run: main loop
  *****************************************************************************/
 static void intf_Run( intf_thread_t *p_intf )
 {
-    while( !p_intf->b_die )
+    OSStatus err;
+
+    EventLoopTimerUPP manageUPP;
+
+//    EventTypeSpec windowEventType = { kEventClassWindow, kEventWindowClose };
+//    EventHandlerUPP windowHandlerUPP;
+
+    //kinda going out of bounds here... need to bring window creation to this file.
+//    main_t *p_main;
+
+/*
+    EventTypeSpec keyboardEventType = { kEventClassKeyboard, kEventRawKeyDown };
+    EventHandlerUPP keyboardHandlerUPP;
+*/
+
+    manageUPP = NewEventLoopTimerUPP ( CarbonManageCallback );
+    err = InstallEventLoopTimer ( GetCurrentEventLoop(), 0, kMainLoopFrequency, manageUPP, (void *) p_intf, &p_intf->p_sys->manageTimer );
+    assert(err == noErr);
+    DisposeEventLoopTimerUPP(manageUPP);
+
+/*    windowHandlerUPP = NewEventHandlerUPP ( MyWindowEventHandler );
+    err = InstallWindowEventHandler ( p_main->p_vout->p_sys->p_window , windowHandlerUPP, GetEventTypeCount(windowEventType), &windowEventType, (void *) p_intf, NULL );
+    assert(err == noErr);
+    DisposeEventHandlerUPP(windowHandlerUPP);
+*/
+
+
+#ifndef CocoaEvents
+    //UGLY Event Loop!
+    EventLoop( p_intf );
+#else
+    //Our big event loop !-)
+    RunApplicationEventLoop();
+#endif
+    err = RemoveEventLoopTimer(p_intf->p_sys->manageTimer);
+    assert(err == noErr);
+}
+
+
+
+void CarbonManageCallback ( EventLoopTimerRef inTimer, void *inUserData )
+{
+    intf_thread_t * p_intf = (intf_thread_t *) inUserData;
+
+    /* Manage core vlc functions through the callback */
+    p_intf->pf_manage( p_intf );
+    
+    if ( p_intf->b_die )
+    {
+       QuitApplicationEventLoop();
+    }
+}
+
+#ifndef CocoaEvents
+
+void EventLoop( intf_thread_t *p_intf )
+{
+    Boolean    gotEvent;
+    EventRecord        event;
+    
+    do
+    {
+        gotEvent = WaitNextEvent(everyEvent,&event,32767,nil);
+        if (gotEvent)
+            DoEvent( p_intf, &event);
+    } while (! p_intf->b_die );
+    
+    ExitToShell();                                     
+}
+
+void DoEvent( intf_thread_t *p_intf , EventRecord *event)
+{
+    short      part;
+    Boolean    hit;
+    char       key;
+    Rect       tempRect;
+    WindowRef  whichWindow;
+        
+    switch (event->what) 
+    {
+        case mouseDown:
+            part = FindWindow(event->where, &whichWindow);
+            switch (part)
+            {
+                case inMenuBar:  /* process a moused menu command */
+                    DoMenuCommand( p_intf, MenuSelect(event->where));
+                    break;
+                    
+                case inSysWindow:
+                    break;
+                
+                case inContent:
+                    if (whichWindow != FrontWindow()) 
+                        SelectWindow(whichWindow);
+                    break;
+                
+                case inDrag:   /* pass screenBits.bounds */
+                    GetRegionBounds(GetGrayRgn(), &tempRect);
+                    DragWindow(whichWindow, event->where, &tempRect);
+                    break;
+                    
+                case inGrow:
+                    break;
+                    
+                case inGoAway:
+                    p_intf->b_die = true;
+                    return;
+                    //DisposeWindow(whichWindow);
+                    //ExitToShell();
+                    break;
+                    
+                case inZoomIn:
+                case inZoomOut:
+                    hit = TrackBox(whichWindow, event->where, part);
+                    if (hit) 
+                    {
+                        SetPort(GetWindowPort(whichWindow));   // window must be current port
+                        EraseRect(GetWindowPortBounds(whichWindow, &tempRect));   // inval/erase because of ZoomWindow bug
+                        ZoomWindow(whichWindow, part, true);
+                        InvalWindowRect(whichWindow, GetWindowPortBounds(whichWindow, &tempRect));     
+                    }
+                    break;
+                }
+                break;
+               
+                case keyDown:
+               case autoKey:
+                    key = event->message & charCodeMask;
+                    if (event->modifiers & cmdKey)
+                        if (event->what == keyDown)
+                            DoMenuCommand( p_intf, MenuKey(key));
+                            
+               case activateEvt:              /* if you needed to do something special */
+                    break;
+                    
+                case updateEvt:
+                       DrawWindow((WindowRef) event->message);
+                       break;
+                        
+                case kHighLevelEvent:
+                       AEProcessAppleEvent( event );
+                       break;
+               
+                case diskEvt:
+                       break;
+       }
+}
+
+void DoMenuCommand( intf_thread_t *p_intf , long menuResult)
+{
+    short      menuID;         /* the resource ID of the selected menu */
+    short      menuItem;       /* the item number of the selected menu */
+       
+    static int vol_val;        // remember the current volume
+    static int playback_status;                // remember playback state
+
+    menuID = HiWord(menuResult);    /* use macros to get item & menu number */
+    menuItem = LoWord(menuResult);
+
+    switch (menuID) 
     {
-        /* Manage core vlc functions through the callback */
-        p_intf->pf_manage( p_intf );
+        case kMenuApple:
+            switch (menuItem) 
+            {
+                case kAppleAbout:
+                    //Fixme
+                    SysBeep(30);
+                    //DoAboutBox();
+                    break;
+                    
+                case kAppleQuit:
+                    p_intf->b_die = true;
+                    return;
+                    break;
+                               
+                default:
+                    break;
+            }
+            break;
+        
+        case kMenuFile:
+            switch (menuItem) 
+            {
+                case kFileNew:
+                    //Fixme
+                    SysBeep(30);
+                    //DoAboutBox();
+                    break;
 
-        /* Wait a bit */
-        msleep( INTF_IDLE_SLEEP );
+                case kFileOpen:
+                    //Fixme
+/*
+           const char **device;
+           char device_method_and_name[B_FILE_NAME_LENGTH + 4];
+           if(p_message->FindString("device", device) != B_ERROR)
+               {
+               sprintf(device_method_and_name, "dvd:%s", *device); 
+               intf_PlaylistAdd( p_main->p_playlist, PLAYLIST_END, device_method_and_name );
+               }
+
+*/
+                    SysBeep(30);
+                    //DoAboutBox();
+                    break;
+
+                case kFileClose:
+                    HideWindow( FrontWindow() );
+                    //Fixme
+                    SysBeep(30);
+                    //DoAboutBox();
+                    break;
+                    
+                default:
+                    break;
+            }
+            break;
+               
+        case kMenuControls:
+            switch (menuItem) 
+            {
+                case kControlsPlayORPause:
+                // pause the playback
+                    if (p_intf->p_input != NULL )
+                    {
+                            // mute the volume if currently playing
+                            if (playback_status == PLAYING)
+                            {
+                                    if (p_main->p_aout != NULL)
+                                    {
+                                            p_main->p_aout->vol = 0;
+                                    }
+                                    playback_status = PAUSED;
+                            }
+                            else
+                            // restore the volume
+                            {
+                                    if (p_main->p_aout != NULL)
+                                    {
+                                            p_main->p_aout->vol = vol_val;
+                                    }
+                                    playback_status = PLAYING;
+                            }
+                            //snooze(400000);
+                            input_SetStatus(p_intf->p_input, INPUT_STATUS_PAUSE);
+                    }
+                    break;
+
+                case kControlsStop:
+                // this currently stops playback not nicely
+                    if (p_intf->p_input != NULL )
+                    {
+                            // silence the sound, otherwise very horrible
+                            if (p_main->p_aout != NULL)
+                            {
+                                    p_main->p_aout->vol = 0;
+                            }
+                            //snooze(400000);
+                            input_SetStatus(p_intf->p_input, INPUT_STATUS_END);
+                    }
+                    break;
+
+                case kControlsForward:
+               // cycle the fast playback modes
+                    if (p_intf->p_input != NULL )
+                    {
+                            if (p_main->p_aout != NULL)
+                            {
+                                    p_main->p_aout->vol = 0;
+                            }
+                            //snooze(400000);
+                            input_SetStatus(p_intf->p_input, INPUT_STATUS_FASTER);
+                    }
+                    break;
+
+                case kControlsRewind:
+               // cycle the slow playback modes
+                    if (p_intf->p_input != NULL )
+                    {
+                            if (p_main->p_aout != NULL)
+                            {
+                                    p_main->p_aout->vol = 0;
+                            }
+                            //snooze(400000);
+                            input_SetStatus(p_intf->p_input, INPUT_STATUS_SLOWER);
+                    }
+                    break;
+                
+                case kControlsChapterNext:
+                    //Fixme
+                    SysBeep(30);
+                    break;
+
+                case kControlsChapterPrevious:
+                    //Fixme
+                    SysBeep(30);
+                    break;
+
+                case kControlsDVDMenu:
+                    //Fixme
+                    SysBeep(30);
+                    break;
+
+                case kControlsVolumeUp:
+               // adjust the volume
+                    if (p_main->p_aout != NULL) 
+                    {
+                        p_main->p_aout->vol++;
+                    }
+                    break;
+
+                case kControlsVolumeDown:
+               // adjust the volume
+                    if (p_main->p_aout != NULL) 
+                    {
+                        p_main->p_aout->vol--;
+                    }
+                    break;
+
+                case kControlsVolumeMute:
+                // mute
+                    if (p_main->p_aout != NULL) 
+                        {
+                                    if (p_main->p_aout->vol == 0)
+                                    {
+                                            //p_vol->SetEnabled(true);
+                                            p_main->p_aout->vol = vol_val;
+                                    }  
+                                    else
+                                    {
+                                            //p_vol->SetEnabled(false);
+                                            vol_val = p_main->p_aout->vol;
+                                            p_main->p_aout->vol = 0;
+                                    }
+                            }
+                            break;
+
+                case kControlsEject:
+                    //Fixme
+                    SysBeep(30);
+                    break;
+                    
+                default:
+                    break;
+            }
+            break;
+
+        default:
+            break;
     }
+    HiliteMenu(0);     /* unhighlight what MenuSelect (or MenuKey) hilited */
+}
+
+void DrawWindow(WindowRef window)
+{
+    Rect               tempRect;
+    GrafPtr            curPort;
+       
+    GetPort(&curPort);
+    SetPort(GetWindowPort(window));
+    BeginUpdate(window);
+    EraseRect(GetWindowPortBounds(window, &tempRect));
+    DrawControls(window);
+    DrawGrowIcon(window);
+    EndUpdate(window);
+    SetPort(curPort);
 }
 
+
+#else
+
+static pascal OSStatus MyEventHandler(EventHandlerCallRef myHandler, EventRef event, void* userData)
+{
+    WindowRef                     window;
+    Rect                          bounds;
+    UInt32                        whatHappened;
+    HICommand                     commandStruct;
+    MenuRef                       theMenuRef;
+    UInt16                        theMenuItem;
+    OSStatus                      result = eventNotHandledErr; // report failure by default
+    
+    GetEventParameter(event, kEventParamDirectObject, typeWindowRef, NULL, sizeof(window), NULL, &window);
+    
+    whatHappened = GetEventKind(event);
+    
+    switch (whatHappened)
+    {
+        case kEventWindowActivated:
+            break;
+        
+        case kEventWindowDeactivated:
+            break;
+        
+        case kEventWindowDrawContent:
+            //DoUpdate(window);
+            result = noErr;
+            break;
+
+        case kEventWindowBoundsChanged:
+            InvalWindowRect(window, GetWindowPortBounds(window, &bounds));
+            //DoUpdate(window);
+            result = noErr;
+            break;
+
+        case kEventWindowClickContentRgn:
+            /*DoContentClick(window);
+            DoUpdate(window);
+            AdjustMenus();*/
+            result = noErr;
+            break;
+
+        case kEventCommandProcess:
+            GetEventParameter (event, kEventParamDirectObject, 
+                                        typeHICommand, NULL, sizeof(HICommand), 
+                                        NULL, &commandStruct);
+            theMenuRef = commandStruct.menu.menuRef;
+
+            if (theMenuRef == GetMenuHandle(kMenuApple)) 
+                {
+                    // Because the event didn't occur *in* the window, the 
+                    // window reference isn't valid until we set it here 
+                    window = FrontWindow(); 
+
+                    theMenuItem = commandStruct.menu.menuItemIndex;
+                    switch ( theMenuItem ) 
+                            {
+                                case iStop:
+                                        SetLight(window, true);
+                                        break;
+                                case iGo:
+                                        SetLight(window, false);
+                                        break;
+                            }
+                    DoUpdate(window);
+                    AdjustMenus();
+                    result = noErr;
+                }
+            */
+            break; 
+
+        case kEventMouseMoved:
+            /*
+            CursorRgn = NewRgn();
+            GetEventParameter (event, kEventParamMouseLocation, typeQDPoint,
+                                        NULL, sizeof(Point), NULL, &wheresMyMouse);
+            AdjustCursor(wheresMyMouse, CursorRgn);
+            DisposeRgn(CursorRgn);
+            */
+            result = noErr;
+            break;
+
+        default: 
+            // If nobody handled the event, it gets propagated to the
+            // application-level handler.
+            break;
+    }
+    return result;
+}
+#endif
index 4145934fd51e1746051747e1e0df7a5e8e250b8a..b1c815b3f086ee063ef2008cc20f9eb4346bdb9b 100644 (file)
@@ -2,9 +2,10 @@
  * macosx.c : MacOS X plugin for vlc
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: macosx.c,v 1.3 2001/03/21 13:42:34 sam Exp $
+ * $Id: macosx.c,v 1.4 2001/04/06 18:18:10 massiot Exp $
  *
- * Authors: 
+ * Authors: Colin Delacroix <colin@zoy.org>
+ *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -49,6 +50,7 @@ MODULE_CONFIG_END
 /*****************************************************************************
  * Capabilities defined in the other files.
  *****************************************************************************/
+void _M( aout_getfunctions )( function_list_t * p_function_list );
 void _M( vout_getfunctions )( function_list_t * p_function_list );
 void _M( intf_getfunctions )( function_list_t * p_function_list );
 
@@ -63,11 +65,12 @@ void _M( intf_getfunctions )( function_list_t * p_function_list );
 MODULE_INIT
 {
     p_module->psz_name = MODULE_STRING;
-    p_module->psz_longname = "MacOS X interface and video module";
+    p_module->psz_longname = "MacOS X interface, sound and video module";
     p_module->psz_version = VERSION;
 
     p_module->i_capabilities = MODULE_CAPABILITY_NULL
                                 | MODULE_CAPABILITY_VOUT
+                                | MODULE_CAPABILITY_AOUT
                                 | MODULE_CAPABILITY_INTF;
 
     return( 0 );
@@ -90,6 +93,7 @@ MODULE_ACTIVATE
     }
 
     _M( vout_getfunctions )( &p_module->p_functions->vout );
+    _M( aout_getfunctions )( &p_module->p_functions->aout );
     _M( intf_getfunctions )( &p_module->p_functions->intf );
 
     p_module->p_config = p_config;
index 805ca6977a5e3597dc1e26ffb2baa8cbc3faa90a..96239ec339ad9973367247ae5bc341b2a5b241fe 100644 (file)
@@ -2,9 +2,9 @@
  * vout_macosx.c: MacOS X video output plugin
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: vout_macosx.c,v 1.2 2001/03/21 13:42:34 sam Exp $
  *
- * Authors: 
+ * Authors: Colin Delacroix <colin@zoy.org>
+ *          Eugenio Jarosiewicz <ej0@cise.ufl.edu>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 #include "intf_msg.h"
 
+#include "main.h"
+
 #include "modules.h"
 
-#define DUMMY_WIDTH 16
-#define DUMMY_HEIGHT 16
-#define DUMMY_BITS_PER_PLANE 16
-#define DUMMY_BYTES_PER_PIXEL 2
+#ifndef __CARBONPREFIX__
+    #define __CARBONPREFIX__
+
+    // Needed for carbonization
+    #define TARGET_API_MAC_CARBON 1
+
+    // For the pascal to C or C to pascal string conversions in carbon
+    #define OLDP2C 1
+#endif
+
+#include <Carbon/Carbon.h>
+
+// Initial Window Constants
+enum
+{
+    kWindowOffset = 100
+};
+
+// where is the off screen
+enum
+{
+    kNoWhere = 0,
+    kInVRAM,
+    kInAGP,
+    kInSystem
+};
 
 /*****************************************************************************
  * vout_sys_t: MacOS X video output method descriptor
@@ -62,7 +86,20 @@ typedef struct vout_sys_s
     /* MacOS X video memory */
     byte_t *                    p_video;                      /* base adress */
     size_t                      i_page_size;                    /* page size */
-
+    
+    Rect       wrect;
+    WindowRef  p_window;
+    short gwLocOffscreen;
+    GWorldPtr p_gw[ 2 ];
+    Boolean gNewNewGWorld;      /* can we allocate in VRAm or AGP memory ? */
+    
+    // Boolean gDone;
+    // SInt32 gSleepTime;
+    
+    GDHandle  theGDList;
+    Ptr                                theBase;
+    int                                theRow;
+    int                                theDepth;
 } vout_sys_t;
 
 /*****************************************************************************
@@ -76,6 +113,18 @@ static void vout_Destroy   ( struct vout_thread_s * );
 static int  vout_Manage    ( struct vout_thread_s * );
 static void vout_Display   ( struct vout_thread_s * );
 
+/* OS specific */
+
+static int CreateDisplay       ( struct vout_thread_s * );
+static int MakeWindow          ( struct vout_thread_s * );
+static int AllocBuffer         ( struct vout_thread_s * , short index );
+
+void BlitToWindow              ( struct vout_thread_s * , short index );
+GDHandle GetWindowDevice       ( struct vout_thread_s * );
+void FillOffscreen             ( struct vout_thread_s * , short index);
+
+void FindBestMemoryLocation( struct vout_thread_s * );
+
 /*****************************************************************************
  * Functions exported as capabilities. They are declared as static so that
  * we don't pollute the namespace too much.
@@ -112,23 +161,39 @@ static int vout_Probe( probedata_t *p_data )
  *****************************************************************************/
 static int vout_Create( vout_thread_t *p_vout )
 {
+    //intf_ErrMsg( "vout_Create()" );
+
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
     {
-        intf_ErrMsg("error: %s", strerror(ENOMEM) );
+        intf_ErrMsg( "error: %s", strerror( ENOMEM ) );
         return( 1 );
     }
 
-    p_vout->i_width            = DUMMY_WIDTH;
-    p_vout->i_height           = DUMMY_HEIGHT;
-    p_vout->i_screen_depth     = DUMMY_BITS_PER_PLANE;
-    p_vout->i_bytes_per_pixel  = DUMMY_BYTES_PER_PIXEL;
-    p_vout->i_bytes_per_line   = DUMMY_WIDTH * DUMMY_BYTES_PER_PIXEL;
+    p_vout->p_sys->gwLocOffscreen = kNoWhere;
+    p_vout->p_sys->p_window       = NULL;
+    p_vout->p_sys->p_gw[ 0 ]      = NULL;
+    p_vout->p_sys->p_gw[ 1 ]      = NULL;
+    p_vout->p_sys->i_page_size    = p_vout->i_width * p_vout->i_height
+                                  * p_vout->i_bytes_per_pixel;
+    
+    if ( CreateDisplay( p_vout ) )
+    {
+        intf_ErrMsg( "vout error: can't open display" );
+        free( p_vout->p_sys );
+        return( 1 );
+    }
 
-    p_vout->p_sys->i_page_size = DUMMY_WIDTH * DUMMY_HEIGHT
-                                  * DUMMY_BYTES_PER_PIXEL;
+#if 0
+    intf_ErrMsg( "vout p_vout->i_width %d" , p_vout->i_width);
+    intf_ErrMsg( "vout p_vout->i_height %d" , p_vout->i_height);
+    intf_ErrMsg( "vout p_vout->i_bytes_per_pixel %d" , p_vout->i_bytes_per_pixel);
+    intf_ErrMsg( "vout p_vout->i_screen_depth %d" , p_vout->i_screen_depth);
+    intf_ErrMsg( "vout p_vout->p_sys->i_page_size %d" , p_vout->p_sys->i_page_size);
+#endif
 
+#if 0
     /* Map two framebuffers a the very beginning of the fb */
     p_vout->p_sys->p_video = malloc( 2 * p_vout->p_sys->i_page_size );
     if( p_vout->p_sys->p_video == NULL )
@@ -138,19 +203,251 @@ static int vout_Create( vout_thread_t *p_vout )
         free( p_vout->p_sys );
         return( 1 );
     }
-
     /* Set and initialize buffers */
     vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
-                     p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
+                    p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
+#endif
+
+    return( 0 );
+}
+
+/*****************************************************************************
+ * Find the best memory (AGP, VRAM, system) location
+ *****************************************************************************/
+void FindBestMemoryLocation( vout_thread_t *p_vout )
+{
+    long versionSystem;
+
+    Gestalt( gestaltSystemVersion, &versionSystem );
+    if ( 0x00000900 <= ( versionSystem & 0x00000FF00  ) )
+    {
+        intf_ErrMsg( "FindBestMemoryLocation : gNewNewGWorld = true" );
+        p_vout->p_sys->gNewNewGWorld = true;
+    }
+    else
+    {
+        // now it is tricky
+        // we will try to allocate in VRAM and find out where the allocation really ended up.
+        GWorldPtr pgwTest = NULL;
+        Rect rectTest = {0, 0, 10, 10};
+        short wPixDepth = 
+            (**(GetPortPixMap( GetWindowPort( p_vout->p_sys->p_window ) ))).pixelSize;
+        GDHandle hgdWindow = GetWindowDevice( p_vout );
+
+        intf_ErrMsg( "FindBestMemoryLocation : gNewNewGWorld = false !" );
+#if 0
+//EJ added
+        p_vout->i_screen_depth = wPixDepth;
+        p_vout->i_bytes_per_pixel = wPixDepth;
+        p_vout->i_bytes_per_line   = p_vout->i_width * p_vout->i_bytes_per_pixel;
+        p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel;
+//p_vout->i_bytes_per_line = (**(**hgdWindow).gdPMap).rowBytes & 0x3FFF ;
+#endif
+        if(    ( noErr == NewGWorld( &pgwTest, wPixDepth, &rectTest, NULL, hgdWindow,
+                                     noNewDevice | useDistantHdwrMem ) ) 
+            && ( pgwTest ) )
+        {
+            p_vout->p_sys->gNewNewGWorld = true;       
+        }
+        
+        if( pgwTest )
+        {
+            DisposeGWorld( pgwTest );
+        }
+    }
+}
+
+/*****************************************************************************
+ * CreateDisplay: setup display params...
+ *****************************************************************************/
+static int CreateDisplay( vout_thread_t *p_vout )
+{
+    PixMapHandle hPixmap0, hPixmap1;
+    void * hPixmapBaseAddr0, * hPixmapBaseAddr1;
+
+    //intf_ErrMsg( "CreateDisplay()" );
+
+    if( MakeWindow( p_vout ) )
+    {
+        intf_ErrMsg( "vout error: can't open window display" );
+        return( 1 );
+    }
+
+    // FindBestMemoryLocation( p_vout );
+
+    //try to allocate @ best location, will eventaully trickle down to worst
+    p_vout->p_sys->gwLocOffscreen = kInVRAM;
+    if( AllocBuffer( p_vout, 0 ) || AllocBuffer( p_vout, 1 ) )
+    {
+        intf_ErrMsg( "vout error: can't alloc offscreen buffers" );
+        return( 1 );
+    }
+
+    hPixmap0 = GetGWorldPixMap( p_vout->p_sys->p_gw[0] );
+//FIXME BIGTIME - in SDL they just lock this down until the end...KLUDGE
+//but alas sounds good to me to try it.
+//well fuck a duck it works.
+    LockPixels(hPixmap0);
+    hPixmap1 = GetGWorldPixMap( p_vout->p_sys->p_gw[1] );
+    LockPixels(hPixmap1);
+    
+    //FIXME hopefully this is the same for all Gworlds & window since they are the same size
+    p_vout->i_bytes_per_line = (**hPixmap0).rowBytes & 0x3FFF;
+
+    if ( (hPixmap0 == NULL) || (hPixmap1 == NULL) )
+    {
+        intf_ErrMsg( "vout error: pixmap problem");
+        UnlockPixels(hPixmap0);
+        UnlockPixels(hPixmap1);
+        return( 1 );
+    }
+
+    hPixmapBaseAddr0 = GetPixBaseAddr( hPixmap0 );
+    hPixmapBaseAddr1 = GetPixBaseAddr( hPixmap1 );
+    if ( (hPixmapBaseAddr0 == NULL) || (hPixmapBaseAddr1 == NULL) )
+    {
+        intf_ErrMsg( "vout error: pixmap base addr problem");
+        return( 1 );
+    }
+
+//FIXME TODO - if I ever dispose of the Gworlds and recreate them, i'll have a new address
+//and I'll need to tell vout about them...  dunno what problems vout might have if we just updateGworld  
+    vout_SetBuffers( p_vout, hPixmapBaseAddr0, hPixmapBaseAddr1 );
+
+    return 0;
+}
+
+/*****************************************************************************
+ * MakeWindow: open and set-up a Mac OS main window
+ *****************************************************************************/
+static int MakeWindow( vout_thread_t *p_vout )
+{
+    int left = 0;
+    int top = 0;
+    int bottom = p_vout->i_height;
+    int right = p_vout->i_width;
+
+    WindowAttributes windowAttr = kWindowStandardDocumentAttributes | 
+                                    kWindowStandardHandlerAttribute |
+                                    kWindowInWindowMenuAttribute;
+    
+    SetRect( &p_vout->p_sys->wrect, left, top, right, bottom );
+    OffsetRect( &p_vout->p_sys->wrect, kWindowOffset, kWindowOffset );
+
+    CreateNewWindow( kDocumentWindowClass, windowAttr, &p_vout->p_sys->wrect, &p_vout->p_sys->p_window );
+    if ( p_vout->p_sys->p_window == nil )
+    {
+        return( 1 );
+    }
+
+    InstallStandardEventHandler(GetWindowEventTarget(p_vout->p_sys->p_window));
+    SetPort( GetWindowPort( p_vout->p_sys->p_window ) );
+    SetWindowTitleWithCFString( p_vout->p_sys->p_window, CFSTR("VLC") );
+//    ShowWindow( p_vout->p_sys->p_window );
+    TransitionWindow( p_vout->p_sys->p_window, kWindowZoomTransitionEffect, kWindowShowTransitionAction, NULL);
+    BringToFront(  p_vout->p_sys->p_window );
+
+{
+    short wPixDepth = (**(GetPortPixMap( GetWindowPort( p_vout->p_sys->p_window ) ))).pixelSize;
+    p_vout->i_screen_depth = wPixDepth;
+    p_vout->i_bytes_per_pixel = p_vout->i_screen_depth / 8;
+    p_vout->i_bytes_per_line   = p_vout->i_width * p_vout->i_bytes_per_pixel;
+    p_vout->p_sys->i_page_size = p_vout->i_width * p_vout->i_height * p_vout->i_bytes_per_pixel;
+
+//EJ added
+#if 1
+p_vout->i_bytes_per_line = (**(**GetWindowDevice( p_vout )).gdPMap).rowBytes & 0x3FFF ;
+
+    switch ( p_vout->i_screen_depth )
+    {
+        case 32:
+        case 24:
+            p_vout->i_red_mask =   0xff0000;
+            p_vout->i_green_mask = 0xff00;
+            p_vout->i_blue_mask =  0xff;
+            break;
+        case 16:
+        case 15:
+            p_vout->i_red_mask =   0x00007c00;
+            p_vout->i_green_mask = 0x000003e0;
+            p_vout->i_blue_mask =  0x0000001f;
+            break;
+        default:
+            break;
+    }
+#endif
+
+//EJ - not sure about these...
+#if 0
+    p_vout->i_red_lshift = 0x10;
+    p_vout->i_red_rshift = 0x0;
+    p_vout->i_green_lshift = 0x8;
+    p_vout->i_green_rshift = 0x0;
+    p_vout->i_blue_lshift = 0x0;
+    p_vout->i_blue_rshift = 0x0;
+
+    p_vout->i_white_pixel = 0xffffff;
+    p_vout->i_black_pixel = 0x0;
+    p_vout->i_gray_pixel = 0x808080;
+    p_vout->i_blue_pixel = 0x32;
+#endif
+}
 
     return( 0 );
 }
 
+/*****************************************************************************
+ * AllocBuffer: forces offscreen allocation (if different than current) in memory type specified
+ *****************************************************************************/
+static int AllocBuffer ( vout_thread_t *p_vout, short index )
+{
+    Rect bounds;
+    GDHandle hgdWindow = GetWindowDevice( p_vout );
+
+    switch ( p_vout->p_sys->gwLocOffscreen )
+    {
+        case kInVRAM:
+            if ( noErr == NewGWorld( &p_vout->p_sys->p_gw[index], p_vout->i_screen_depth, 
+                GetPortBounds( GetWindowPort( p_vout->p_sys->p_window ), &bounds ), NULL, 
+                hgdWindow, noNewDevice | useDistantHdwrMem ) )         
+            {
+                intf_ErrMsg( "Allocate off screen image in VRAM" );
+                break;
+            }
+            intf_ErrMsg( "Unable to allocate off screen image in VRAM, trying next best AGP" );
+            p_vout->p_sys->gwLocOffscreen = kInAGP;
+        case kInAGP:
+            if (noErr == NewGWorld( &p_vout->p_sys->p_gw[index], p_vout->i_screen_depth, 
+                GetPortBounds( GetWindowPort( p_vout->p_sys->p_window ), &bounds ), NULL, 
+                hgdWindow, noNewDevice | useLocalHdwrMem ) )
+            {
+                intf_ErrMsg( "Allocate off screen image in AGP" );
+                break;
+            }
+            intf_ErrMsg( "Unable to allocate off screen image in AGP, trying next best System" );
+            p_vout->p_sys->gwLocOffscreen = kInSystem;
+        case kInSystem:
+        default:
+            if ( noErr == NewGWorld( &p_vout->p_sys->p_gw[index], p_vout->i_screen_depth, 
+                GetPortBounds( GetWindowPort( p_vout->p_sys->p_window ), &bounds ), NULL, 
+                hgdWindow, noNewDevice | keepLocal) )
+            {
+                intf_ErrMsg( "Allocate off screen image in System" );
+                break;
+            }
+            intf_ErrMsg( "Unable to allocate off screen image in System, no options left - failing" );
+            p_vout->p_sys->gwLocOffscreen = kNoWhere;
+            return( 1 ); // nothing was allocated
+    } 
+    return( 0 );
+}
+
 /*****************************************************************************
  * vout_Init: initialize video thread output method
  *****************************************************************************/
 static int vout_Init( vout_thread_t *p_vout )
 {
+    //intf_ErrMsg( "vout_Init()" );
     return( 0 );
 }
 
@@ -159,6 +456,7 @@ static int vout_Init( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_End( vout_thread_t *p_vout )
 {
+    //intf_ErrMsg( "vout_End()" );
     ;
 }
 
@@ -167,6 +465,33 @@ static void vout_End( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_Destroy( vout_thread_t *p_vout )
 {
+    //intf_ErrMsg( "vout_Destroy()" );
+
+//FIXME KLUDGE to lock pixels
+#if 1
+{
+    PixMapHandle hPixmap0, hPixmap1;
+    hPixmap0 = GetGWorldPixMap( p_vout->p_sys->p_gw[0] );
+    hPixmap1 = GetGWorldPixMap( p_vout->p_sys->p_gw[1] );
+    UnlockPixels(hPixmap0);
+    UnlockPixels(hPixmap1);
+}
+#endif
+
+#if 1
+    if ( p_vout->p_sys->p_gw[0] )
+    {
+        DisposeGWorld( p_vout->p_sys->p_gw[0] );
+    }
+    if ( p_vout->p_sys->p_gw[1] )
+    {
+        DisposeGWorld( p_vout->p_sys->p_gw[1] );
+    }
+    if ( p_vout->p_sys->p_window )
+    {
+        DisposeWindow( p_vout->p_sys->p_window );
+    }
+#endif
     free( p_vout->p_sys->p_video );
     free( p_vout->p_sys );
 }
@@ -179,6 +504,7 @@ static void vout_Destroy( vout_thread_t *p_vout )
  *****************************************************************************/
 static int vout_Manage( vout_thread_t *p_vout )
 {
+//    intf_ErrMsg( "vout_Manage()" );
     return( 0 );
 }
 
@@ -190,6 +516,163 @@ static int vout_Manage( vout_thread_t *p_vout )
  *****************************************************************************/
 static void vout_Display( vout_thread_t *p_vout )
 {
-    ;
+//    intf_ErrMsg( "vout_Display()" );
+
+    BlitToWindow ( p_vout, p_vout->i_buffer_index );
+}
+
+
+/*****************************************************************************
+ * flushQD: flushes buffered window area
+  *****************************************************************************/
+void flushQD( vout_thread_t *p_vout )
+{
+    CGrafPtr thePort;
+
+    //intf_ErrMsg( "flushQD()" );
+    
+    thePort = GetWindowPort( p_vout->p_sys->p_window );
+    
+    /* flush the entire port */
+    if (QDIsPortBuffered(thePort))
+        QDFlushPortBuffer(thePort, NULL);
+
+#if 0
+    /* flush part of the port */
+    if (QDIsPortBuffered(thePort)) {
+        RgnHandle theRgn;
+        theRgn = NewRgn();
+            /* local port coordinates */
+        SetRectRgn(theRgn, 10, 10, 100, 30); 
+        QDFlushPortBuffer(thePort, theRgn);
+        DisposeRgn(theRgn);
+    }
+#endif
+
 }
 
+/*****************************************************************************
+ * BlitToWindow: checks offscreen and blits it to the front
+  *****************************************************************************/
+
+void BlitToWindow( vout_thread_t *p_vout, short index )
+{
+    Rect rectDest, rectSource;
+    GrafPtr pCGrafSave, windowPort = GetWindowPort( p_vout->p_sys->p_window );
+
+    //intf_ErrMsg( "BlitToWindow() for %d", index );
+
+    GetPortBounds( p_vout->p_sys->p_gw[index], &rectSource );
+    GetPortBounds( windowPort, &rectDest );
+    
+    GetPort ( &pCGrafSave );
+    SetPortWindowPort( p_vout->p_sys->p_window );
+//FIXME have global lock - kinda bad but oh well 
+//    if ( LockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) ) )
+//    {
+        CopyBits( GetPortBitMapForCopyBits( p_vout->p_sys->p_gw[index] ), 
+                    GetPortBitMapForCopyBits( GetWindowPort( p_vout->p_sys->p_window ) ), 
+                    &rectSource, &rectDest, srcCopy, NULL);
+//        UnlockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
+//EJ
+        //flushQD( p_vout );
+/*
+    }
+    else
+    {
+        intf_ErrMsg( "error: Could not LockPixels" );
+    }
+*/
+    SetPort ( pCGrafSave );
+}
+
+
+/*****************************************************************************
+ * GetWindowDevice: returns GDHandle that window resides on (most of it anyway)
+ *****************************************************************************/
+GDHandle GetWindowDevice( vout_thread_t *p_vout )
+{
+    GrafPtr pgpSave;
+    Rect rectWind, rectSect;
+    long greatestArea, sectArea;
+    GDHandle hgdNthDevice, hgdZoomOnThisDevice = NULL;
+    
+    //intf_ErrMsg( "GetWindowDevice()" );
+
+    GetPort( &pgpSave );
+    SetPortWindowPort( p_vout->p_sys->p_window );
+    GetPortBounds( GetWindowPort( p_vout->p_sys->p_window ), &rectWind );
+    LocalToGlobal( ( Point* ) &rectWind.top );
+    LocalToGlobal( ( Point* ) &rectWind.bottom );
+    hgdNthDevice = GetDeviceList();
+    greatestArea = 0;
+    // check window against all gdRects in gDevice list and remember 
+    //  which gdRect contains largest area of window}
+    while ( hgdNthDevice )
+    {
+        if ( TestDeviceAttribute( hgdNthDevice, screenDevice ) )
+        {
+            if ( TestDeviceAttribute( hgdNthDevice, screenActive ) )
+            {
+                // The SectRect routine calculates the intersection 
+                //  of the window rectangle and this gDevice 
+                //  rectangle and returns TRUE if the rectangles intersect, 
+                //  FALSE if they don't.
+                SectRect( &rectWind, &( **hgdNthDevice ).gdRect, &rectSect );
+                // determine which screen holds greatest window area
+                //  first, calculate area of rectangle on current device
+                sectArea = ( long )( rectSect.right - rectSect.left ) * ( rectSect.bottom - rectSect.top );
+                if ( sectArea > greatestArea )
+                {
+                    greatestArea = sectArea;   // set greatest area so far
+                    hgdZoomOnThisDevice = hgdNthDevice;        // set zoom device
+                }
+                hgdNthDevice = GetNextDevice( hgdNthDevice );
+            }
+        }
+    }  // of WHILE
+    SetPort( pgpSave );
+    return hgdZoomOnThisDevice;
+}
+
+/*****************************************************************************
+ * FillOffScreen: fills offscreen buffer with random bright color
+ *****************************************************************************/
+
+void FillOffscreen( vout_thread_t *p_vout, short index )
+{
+    static RGBColor rgbColorOld;
+    GDHandle hGDSave;
+    CGrafPtr pCGrafSave;
+    Rect rectSource;
+    RGBColor rgbColor;
+    
+    //intf_ErrMsg( "FillOffscreen" );
+
+    GetPortBounds( p_vout->p_sys->p_gw[index], &rectSource );
+    
+    do 
+        rgbColor.red = ( Random () + 32767) / 2 + 32767;
+    while ( abs ( rgbColor.red - rgbColorOld.red ) <  3000 );  
+    do 
+        rgbColor.green = (Random () + 32767) / 2 + 32767;
+    while ( abs ( rgbColor.green - rgbColorOld.green ) <  3000);
+    do 
+        rgbColor.blue = (Random () + 32767) / 2 + 32767;
+    while ( abs ( rgbColor.blue - rgbColorOld.blue ) <  3000);
+    
+    rgbColorOld = rgbColor;
+
+    GetGWorld( &pCGrafSave, &hGDSave );
+    SetGWorld( p_vout->p_sys->p_gw[index], NULL );
+//FIXME have global lock - kinda bad but oh well 
+//    if ( LockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) ) )
+//    {
+        // draw some background
+        EraseRect( &rectSource );
+        RGBForeColor( &rgbColor );
+        PaintRect( &rectSource );
+//        UnlockPixels( GetGWorldPixMap( p_vout->p_sys->p_gw[index] ) );
+//    }
+    SetGWorld( pCGrafSave, hGDSave );
+}
index 965663200ec281f7c7fad72ed90f124763a48201..4c467d8f55683e98e7a16c077c06cc329bcad19f 100644 (file)
@@ -2,7 +2,7 @@
  * modules.c : Built-in and dynamic modules management functions
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.19 2001/03/21 13:42:34 sam Exp $
+ * $Id: modules.c,v 1.20 2001/04/06 18:18:10 massiot Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
 #include "common.h"
 #include "threads.h"
 
+#ifdef SYS_DARWIN1_3
+#include <sys/param.h>                                    /* for MAXPATHLEN */
+#include "main.h"
+extern main_t *p_main;
+#endif
+
 #include "intf_msg.h"
 #include "modules.h"
 #include "modules_core.h"
@@ -88,7 +94,7 @@ module_bank_t * module_CreateBank( void )
  *****************************************************************************/
 void module_InitBank( module_bank_t * p_bank )
 {
-    static char * path[] = { ".", "lib", PLUGIN_PATH, NULL };
+    static char * path[] = { ".", "lib", PLUGIN_PATH, NULL, NULL };
 
     char **         ppsz_path = path;
     char *          psz_fullpath;
@@ -97,6 +103,11 @@ void module_InitBank( module_bank_t * p_bank )
     char *          psz_vlcpath = beos_GetProgramPath();
     int             i_vlclen = strlen( psz_vlcpath );
     boolean_t       b_notinroot;
+#elif defined SYS_DARWIN1_3
+    static char     once = 0;
+    static char     app_path[ MAXPATHLEN ];
+    // HACK TO CUT OUT trailing 'vlc'
+    int             i_pathlen = strlen( p_main->ppsz_argv[0] ) - 3;
 #endif
     DIR *           dir;
     struct dirent * file;
@@ -106,6 +117,18 @@ void module_InitBank( module_bank_t * p_bank )
 
     intf_WarnMsg( 1, "module: module bank initialized" );
 
+#ifdef SYS_DARWIN1_3
+    if ( !once )
+    {
+        once = 1;
+        strncpy( app_path, p_main->ppsz_argv[ 0 ], i_pathlen );
+        intf_ErrMsg( "%s", p_main->ppsz_argv[ 0 ] );
+        strcat( app_path, "lib" );
+        path[ 3 ] = app_path ;
+        intf_ErrMsg( "%s", path[ 3 ] );
+    }
+#endif
+
     for( ; *ppsz_path != NULL ; ppsz_path++ )
     {
         /* Store strlen(*ppsz_path) for later use. */
index 8dc5ed13fe378810b0a667c32814f41ce8449c05..bbc552552314cb15d01e5df7403fcab6ba3b6099 100644 (file)
@@ -2,7 +2,7 @@
  * video_text.c : text manipulation functions
  *****************************************************************************
  * Copyright (C) 1999, 2000 VideoLAN
- * $Id: video_text.c,v 1.20 2001/03/21 13:42:35 sam Exp $
+ * $Id: video_text.c,v 1.21 2001/04/06 18:18:10 massiot Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #include "common.h"
 #include "video_text.h"
 
+#ifdef SYS_DARWIN1_3
+// #include <CFBundle.h>
+#include <sys/param.h>                                    /* for MAXPATHLEN */
+#include "main.h"
+extern main_t *p_main;
+#endif
+
 #include "intf_msg.h"
 
 /*****************************************************************************
@@ -210,19 +217,40 @@ static void PutByte32( u32 *p_pic, int i_byte, byte_t i_char, byte_t i_border,
  *****************************************************************************/
 vout_font_t *vout_LoadFont( const char *psz_name )
 {
-    static char * path[] = { "share", DATA_PATH, NULL };
+    static char * path[] = { "share", DATA_PATH, NULL, NULL };
 
     char **             ppsz_path = path;
     char *              psz_file;
 #ifdef SYS_BEOS
     char *              psz_vlcpath = beos_GetProgramPath();
     int                 i_vlclen = strlen( psz_vlcpath );
+#elif defined SYS_DARWIN1_3
+    static char         once = 0;
+    static char         app_path[ MAXPATHLEN ];
+    /* HACK TO CUT OUT trailing 'vlc' */
+    int                 i_pathlen = strlen( p_main->ppsz_argv[ 0 ] ) - 3;
+    // CFBundleRef         mainBundle;
 #endif
     int                 i_char, i_line;        /* character and line indexes */
     int                 i_file = -1;                          /* source file */
     byte_t              pi_buffer[2];                         /* file buffer */
     vout_font_t *       p_font;                           /* the font itself */
 
+#ifdef SYS_DARWIN1_3
+    // Get the main bundle for the app
+    // mainBundle = CFBundleGetMainBundle();
+
+    if( !once )
+    {
+       once = 1;
+        strncpy( app_path, p_main->ppsz_argv[ 0 ], i_pathlen );
+        intf_ErrMsg( "%s", p_main->ppsz_argv[ 0 ] );
+        strcat( app_path, "share" );
+        path[ 2 ] = app_path ;
+        intf_ErrMsg( "%s", path[ 2 ] );
+    }
+#endif
+
     for( ; *ppsz_path != NULL ; ppsz_path++ )
     {
 #ifdef SYS_BEOS