summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-31 15:04:18 +0000
committeratmos4 <atmos4@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-08-31 15:04:18 +0000
commita63ea1a018ca781936dc0d4663b249676382844f (patch)
treefc476b9b3221705be7aad9d935edec29c2b0b0b6
parentdc1ccbc50e06a6f87381c6a08bf6f2f79d5eeb25 (diff)
downloadmpv-a63ea1a018ca781936dc0d4663b249676382844f.tar.bz2
mpv-a63ea1a018ca781936dc0d4663b249676382844f.tar.xz
Improved MacOS X SDL support, enable SDL main() wrapper for Darwin, remove unused envp.
Patch by Donnie Smith <xc0bead2d8130df59@f4n.org>, updated by me. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7202 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--Makefile2
-rw-r--r--cfgparser.c3
-rw-r--r--cfgparser.h2
-rw-r--r--libvo/vo_sdl.c23
-rw-r--r--mencoder.c4
-rw-r--r--mplayer.c14
6 files changed, 40 insertions, 8 deletions
diff --git a/Makefile b/Makefile
index 9724af68a6..a08e798fcb 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ COMMON_LIBS = $(CODEC_LIBS) libmpdemux/libmpdemux.a input/libinput.a postproc/li
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 --git a/cfgparser.c b/cfgparser.c
index d6aea51a71..b0799e0562 100644
--- a/cfgparser.c
+++ b/cfgparser.c
@@ -1033,7 +1033,7 @@ out:
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 @@ int m_config_parse_command_line(m_config_t *config, int argc, char **argv, char
assert(config != NULL);
assert(config->pt != NULL);
assert(argv != NULL);
- assert(envp != NULL);
assert(argc >= 1);
#endif
diff --git a/cfgparser.h b/cfgparser.h
index f4b52c2a01..f860a3cd52 100644
--- a/cfgparser.h
+++ b/cfgparser.h
@@ -95,7 +95,7 @@ int m_config_parse_config_file(m_config_t *config, char *conffile);
* -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 --git a/libvo/vo_sdl.c b/libvo/vo_sdl.c
index ba7070a9ce..5ca488c1c7 100644
--- a/libvo/vo_sdl.c
+++ b/libvo/vo_sdl.c
@@ -731,6 +731,29 @@ static void set_fullmode (int mode) {
/* 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 --git a/mencoder.c b/mencoder.c
index 949aad3d01..1f9208a9b2 100644
--- a/mencoder.c
+++ b/mencoder.c
@@ -295,7 +295,7 @@ void mencoder_write_chunk(aviwrite_stream_t *s,int len,unsigned int flags){
}
-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 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
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 --git a/mplayer.c b/mplayer.c
index 975529d163..30d85d73d9 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -469,7 +469,17 @@ static int libmpdemux_was_interrupted(int eof) {
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 <SDL.h>
+#endif
+
+int main(int argc,char* argv[]){
+
static demux_stream_t *d_audio=NULL;
@@ -564,7 +574,7 @@ int gui_no_filename=0;
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) {