# HG changeset patch # User atmos4 # Date 1030806258 0 # Node ID 22beff6edf75ae6d32b63dd3e58bc1fea693e48f # Parent 9a123ba671fd0f60b72ae9d8157516bd28502775 Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp. Patch by Donnie Smith , updated by me. diff -r 9a123ba671fd -r 22beff6edf75 Makefile --- a/Makefile Sat Aug 31 14:54:00 2002 +0000 +++ b/Makefile Sat Aug 31 15:04:18 2002 +0000 @@ -50,7 +50,7 @@ ifeq ($(VIDIX),yes) MISC_LIBS += -Llibdha -ldha vidix/libvidix.a endif -CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader $(VO_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(FREETYPE_INC) # -Wall +CFLAGS = $(OPTFLAGS) -Ilibmpdemux -Iloader $(VO_INC) $(EXTRA_INC) $(CDPARANOIA_INC) $(FREETYPE_INC) $(SDL_INC) # -Wall PARTS = libfame libmpdemux libmpcodecs mp3lib liba52 libmp1e libmpeg2 libavcodec libao2 drivers linux postproc input libmpdvdkit libvo ifeq ($(VIDIX),yes) diff -r 9a123ba671fd -r 22beff6edf75 cfgparser.c --- a/cfgparser.c Sat Aug 31 14:54:00 2002 +0000 +++ b/cfgparser.c Sat Aug 31 15:04:18 2002 +0000 @@ -1033,7 +1033,7 @@ return ret; } -int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char **envp) +int m_config_parse_command_line(m_config_t *config, int argc, char **argv) { int i; int tmp; @@ -1044,7 +1044,6 @@ assert(config != NULL); assert(config->pt != NULL); assert(argv != NULL); - assert(envp != NULL); assert(argc >= 1); #endif diff -r 9a123ba671fd -r 22beff6edf75 cfgparser.h --- a/cfgparser.h Sat Aug 31 14:54:00 2002 +0000 +++ b/cfgparser.h Sat Aug 31 15:04:18 2002 +0000 @@ -95,7 +95,7 @@ * -1 on error (invalid option...) * 1 otherwise */ -int m_config_parse_command_line(m_config_t* config, int argc, char **argv, char **envp); +int m_config_parse_command_line(m_config_t* config, int argc, char **argv); m_config_t* m_config_new(play_tree_t* pt); diff -r 9a123ba671fd -r 22beff6edf75 libvo/vo_sdl.c --- a/libvo/vo_sdl.c Sat Aug 31 14:54:00 2002 +0000 +++ b/libvo/vo_sdl.c Sat Aug 31 15:04:18 2002 +0000 @@ -731,6 +731,29 @@ /* try to change to given fullscreenmode */ newsurface = SDL_SetVideoMode(priv->dstwidth, screen_surface_h, priv->bpp, priv->sdlfullflags); + + /* + * In Mac OS X (and possibly others?) SDL_SetVideoMode() appears to + * destroy the datastructure previously retrived, so we need to + * re-assign it. The comment in sdl_close() seems to imply that we + * should not free() anything. + */ + #ifdef SYS_DARWIN + { + const SDL_VideoInfo *vidInfo = NULL; + vidInfo = SDL_GetVideoInfo (); + + /* collect all fullscreen & hardware modes available */ + if (!(priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags))) { + + /* non hardware accelerated fullscreen modes */ + priv->sdlfullflags &= ~SDL_HWSURFACE; + priv->fullmodes = SDL_ListModes (vidInfo->vfmt, priv->sdlfullflags); + } + } + #endif + + /* if creation of new surface was successfull, save it and hide mouse cursor */ if(newsurface) { diff -r 9a123ba671fd -r 22beff6edf75 mencoder.c --- a/mencoder.c Sat Aug 31 14:54:00 2002 +0000 +++ b/mencoder.c Sat Aug 31 15:04:18 2002 +0000 @@ -295,7 +295,7 @@ } -int main(int argc,char* argv[], char *envp[]){ +int main(int argc,char* argv[]){ stream_t* stream=NULL; demuxer_t* demuxer=NULL; @@ -373,7 +373,7 @@ me_register_options(mconfig); parse_cfgfiles(mconfig); - if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) mencoder_exit(1, "error parsing cmdline"); + if(m_config_parse_command_line(mconfig, argc, argv) < 0) mencoder_exit(1, "error parsing cmdline"); playtree = play_tree_cleanup(playtree); if(playtree) { playtree_iter = play_tree_iter_new(playtree,mconfig); diff -r 9a123ba671fd -r 22beff6edf75 mplayer.c --- a/mplayer.c Sat Aug 31 14:54:00 2002 +0000 +++ b/mplayer.c Sat Aug 31 15:04:18 2002 +0000 @@ -469,7 +469,17 @@ return eof; } -int main(int argc,char* argv[], char *envp[]){ +/* + * In Mac OS X the SDL-lib is built upon Cocoa. The easiest way to + * make it all work is to use the builtin SDL-bootstrap code, which + * will be done automatically by replacing our main() if we include SDL.h. + */ +#if defined(SYS_DARWIN) && defined(HAVE_SDL) +#include +#endif + +int main(int argc,char* argv[]){ + static demux_stream_t *d_audio=NULL; @@ -564,7 +574,7 @@ if ( use_gui ) cfg_read(); #endif - if(m_config_parse_command_line(mconfig, argc, argv, envp) < 0) exit(1); // error parsing cmdline + if(m_config_parse_command_line(mconfig, argc, argv) < 0) exit(1); // error parsing cmdline playtree = play_tree_cleanup(playtree); if(playtree) {