summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-04 20:02:53 +0000
committerfaust3 <faust3@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-04 20:02:53 +0000
commit21c079928068bd00ec8e55eeb268e36c9db8bc09 (patch)
tree93a8263f18f0054174a6fa1a5211d78173735f55
parent3a6df1e21e164925f13ba6fdfc26e3add607a882 (diff)
downloadmpv-21c079928068bd00ec8e55eeb268e36c9db8bc09.tar.bz2
mpv-21c079928068bd00ec8e55eeb268e36c9db8bc09.tar.xz
MINGW32 port and select()less fifocode by Arpi
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9832 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--fifo.c29
-rw-r--r--mplayer.c30
2 files changed, 57 insertions, 2 deletions
diff --git a/fifo.c b/fifo.c
index c37a1d2783..ba803eb0e9 100644
--- a/fifo.c
+++ b/fifo.c
@@ -1,4 +1,6 @@
+#ifndef HAVE_NO_POSIX_SELECT
+
// keyboard:
static int keyb_fifo_put=-1;
static int keyb_fifo_get=-1;
@@ -28,3 +30,30 @@ void mplayer_put_key(int code){
// printf("*** key event dropped (FIFO is full) ***\n");
}
}
+
+#else
+
+#define KEY_FIFO_SIZE 1024
+static int key_fifo_data[KEY_FIFO_SIZE];
+static int key_fifo_read=0;
+static int key_fifo_write=0;
+
+void mplayer_put_key(int code){
+// printf("mplayer_put_key(%d)\n",code);
+ if(((key_fifo_write+1)%KEY_FIFO_SIZE)==key_fifo_read) return; // FIFO FULL!!
+ key_fifo_data[key_fifo_write]=code;
+ key_fifo_write=(key_fifo_write+1)%KEY_FIFO_SIZE;
+}
+
+int mplayer_get_key(int fd){
+ int key;
+// printf("mplayer_get_key(%d)\n",fd);
+ if(key_fifo_write==key_fifo_read) return MP_INPUT_NOTHING;
+ key=key_fifo_data[key_fifo_read];
+ key_fifo_read=(key_fifo_read+1)%KEY_FIFO_SIZE;
+// printf("mplayer_get_key => %d\n",key);
+ return key;
+}
+
+#endif
+
diff --git a/mplayer.c b/mplayer.c
index b91b93170b..5106d12033 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -5,10 +5,18 @@
#include <string.h>
#include <unistd.h>
-#include <sys/ioctl.h>
// #include <sys/mman.h>
#include <sys/types.h>
+#ifndef __MINGW32__
+#include <sys/ioctl.h>
#include <sys/wait.h>
+#else
+#define SIGHUP 1 /* hangup */
+#define SIGQUIT 3 /* quit */
+#define SIGKILL 9 /* kill (cannot be caught or ignored) */
+#define SIGBUS 10 /* bus error */
+#endif
+
#include <sys/time.h>
#include <sys/stat.h>
@@ -465,7 +473,9 @@ static void exit_sighandler(int x){
if(sig_count==5 || (inited_flags==0 && sig_count>1)) exit(1);
if(sig_count>5){
// can't stop :(
+#ifndef __MINGW32__
kill(getpid(),SIGKILL);
+#endif
}
mp_msg(MSGT_CPLAYER,MSGL_FATAL,"\n" MSGTR_IntBySignal,x,
current_module?current_module:mp_gettext("unknown")
@@ -508,7 +518,11 @@ if (m_config_parse_config_file(conf, CONFDIR"/mplayer.conf") < 0)
if ((conffile = get_path("")) == NULL) {
mp_msg(MSGT_CPLAYER,MSGL_WARN,MSGTR_NoHomeDir);
} else {
+#ifdef __MINGW32__
+ mkdir(conffile);
+#else
mkdir(conffile, 0777);
+#endif
free(conffile);
if ((conffile = get_path("config")) == NULL) {
mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_GetpathProblem);
@@ -1005,17 +1019,27 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){
#endif
// ========== Init keyboard FIFO (connection to libvo) ============
-make_pipe(&keyb_fifo_get,&keyb_fifo_put);
// Init input system
current_module = "init_input";
mp_input_init();
+#ifndef HAVE_NO_POSIX_SELECT
+make_pipe(&keyb_fifo_get,&keyb_fifo_put);
+
if(keyb_fifo_get > 0)
mp_input_add_key_fd(keyb_fifo_get,1,NULL,NULL);
+#else
+ mp_input_add_key_fd(-1,0,mplayer_get_key,NULL);
+#endif
if(slave_mode)
mp_input_add_cmd_fd(0,1,NULL,NULL);
else if(!use_stdin)
+#ifndef HAVE_NO_POSIX_SELECT
mp_input_add_key_fd(0,1,NULL,NULL);
+#else
+ mp_input_add_key_fd(0,0,NULL,NULL);
+#endif
+
inited_flags|=INITED_INPUT;
current_module = NULL;
@@ -3238,11 +3262,13 @@ if(rel_seek_secs || abs_seek_pos){
}
#endif
+#ifdef HAVE_X11
if (stop_xscreensaver && sh_video) {
current_module="stop_xscreensaver";
xscreensaver_heartbeat(sh_video->pts);
current_module=NULL;
}
+#endif
// DVD sub:
if(vo_config_count && vo_spudec) {