# HG changeset patch # User albeu # Date 1014499046 0 # Node ID 3e2c7bf57035bf96fa66e133e24513ff56002a46 # Parent 5a71377d27592ee5a55df0ff0f159fbcd3bce7dc 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) diff -r 5a71377d2759 -r 3e2c7bf57035 libmpdemux/mpdemux.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpdemux/mpdemux.c Sat Feb 23 21:17:26 2002 +0000 @@ -0,0 +1,37 @@ + +#include "config.h" +#include + + +#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 -r 5a71377d2759 -r 3e2c7bf57035 libmpdemux/mpdemux.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libmpdemux/mpdemux.h Sat Feb 23 21:17:26 2002 +0000 @@ -0,0 +1,2 @@ + +extern int mpdemux_check_interrupt(int time);