summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-23 21:17:26 +0000
committeralbeu <albeu@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-02-23 21:17:26 +0000
commitf9d93451a207da615d635f79bc4f803bb39f2b6d (patch)
tree37f2dd4d859b297059ce5fc88d225aa1022ea06e /libmpdemux
parent700bc3c8e2e040ef30ac7b3fc99130486e565111 (diff)
downloadmpv-f9d93451a207da615d635f79bc4f803bb39f2b6d.tar.bz2
mpv-f9d93451a207da615d635f79bc4f803bb39f2b6d.tar.xz
These 2 files are intended for code common to the whole lib
mainly code to let limpdemux independent from mplayer. Now contain a function to check external interruption from blocking code (network connection and cache fililng) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4823 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/mpdemux.c37
-rw-r--r--libmpdemux/mpdemux.h2
2 files changed, 39 insertions, 0 deletions
diff --git a/libmpdemux/mpdemux.c b/libmpdemux/mpdemux.c
new file mode 100644
index 0000000000..ea7302aa94
--- /dev/null
+++ b/libmpdemux/mpdemux.c
@@ -0,0 +1,37 @@
+
+#include "config.h"
+#include <stdlib.h>
+
+
+#ifdef HAVE_NEW_INPUT
+#include "../input/input.h"
+int mpdemux_check_interrupt(int time) {
+ mp_cmd_t* cmd;
+ if((cmd = mp_input_get_cmd(time,0)) == NULL)
+ return 0;
+
+ switch(cmd->id) {
+ case MP_CMD_QUIT:
+ case MP_CMD_PLAY_TREE_STEP:
+ case MP_CMD_PLAY_TREE_UP_STEP:
+ case MP_CMD_PLAY_ALT_SRC_STEP:
+ // The cmd will be executed when we are back in the main loop
+ if(! mp_input_queue_cmd(cmd)) {
+ printf("mpdemux_check_interrupt: can't queue cmd %s\n",cmd->name);
+ mp_cmd_free(cmd);
+ }
+ return 1;
+ default:
+ mp_cmd_free(cmd);
+ return 0;
+ }
+}
+
+#else // Default function
+int mpdemux_input_check_interrupt(int time){
+ usec_sleep(time*1000);
+ return 0;
+}
+#endif
+
+
diff --git a/libmpdemux/mpdemux.h b/libmpdemux/mpdemux.h
new file mode 100644
index 0000000000..939c6936ad
--- /dev/null
+++ b/libmpdemux/mpdemux.h
@@ -0,0 +1,2 @@
+
+extern int mpdemux_check_interrupt(int time);