changeset 7862:013c255225d8

mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()
author arpi
date Wed, 23 Oct 2002 14:46:20 +0000
parents 210bf936571f
children 45d64e3fa09a
files input/input.c input/input.h libmpdemux/Makefile libmpdemux/cache2.c libmpdemux/mpdemux.c libmpdemux/mpdemux.h libmpdemux/network.c libmpdemux/test.c
diffstat 8 files changed, 39 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/input/input.c	Wed Oct 23 14:45:01 2002 +0000
+++ b/input/input.c	Wed Oct 23 14:46:20 2002 +0000
@@ -1367,3 +1367,26 @@
   }
   exit(0);
 }
+
+int
+mp_input_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)) {
+      mp_msg(MSGT_INPUT,MSGL_ERR,"mpdemux_check_interrupt: can't queue cmd %s\n",cmd->name);
+      mp_cmd_free(cmd);
+    }
+    return 1;
+  }
+  mp_cmd_free(cmd);
+  return 0;
+}
+
+
--- a/input/input.h	Wed Oct 23 14:45:01 2002 +0000
+++ b/input/input.h	Wed Oct 23 14:46:20 2002 +0000
@@ -171,3 +171,8 @@
 
 void
 mp_input_uninit(void);
+
+// Interruptible usleep:  (used by libmpdemux)
+int
+mp_input_check_interrupt(int time);
+
--- a/libmpdemux/Makefile	Wed Oct 23 14:45:01 2002 +0000
+++ b/libmpdemux/Makefile	Wed Oct 23 14:46:20 2002 +0000
@@ -3,7 +3,7 @@
 
 include ../config.mak
 
-SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c opt-reg.c mpdemux.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c
+SRCS = mp3_hdr.c video.c mpeg_hdr.c cache2.c asfheader.c aviheader.c aviprint.c aviwrite.c demux_asf.c demux_avi.c demux_mov.c parse_mp4.c demux_mpg.c demux_pva.c demux_viv.c demuxer.c dvdauth.c dvdnav_stream.c open.c parse_es.c stream.c tv.c tvi_dummy.c tvi_v4l.c tvi_bsdbt848.c frequencies.c demux_fli.c demux_real.c demux_y4m.c yuv4mpeg.c yuv4mpeg_ratio.c demux_nuv.c demux_film.c demux_roq.c mf.c demux_mf.c demux_audio.c demux_demuxers.c opt-reg.c demux_ogg.c demux_bmp.c cdda.c demux_rawaudio.c cddb.c cdinfo.c demux_rawdv.c ai_alsa.c ai_oss.c audio_in.c demux_smjpeg.c
 ifeq ($(STREAMING),yes)
 SRCS += asf_streaming.c url.c http.c network.c asf_mmst_streaming.c
 ifeq ($(STREAMING_LIVE_DOT_COM),yes)
--- a/libmpdemux/cache2.c	Wed Oct 23 14:45:01 2002 +0000
+++ b/libmpdemux/cache2.c	Wed Oct 23 14:46:20 2002 +0000
@@ -26,6 +26,7 @@
 int stream_fill_buffer(stream_t *s);
 int stream_seek_long(stream_t *s,off_t pos);
 
+extern int mp_input_check_interrupt(int time);
 
 typedef struct {
   // constats:
@@ -221,7 +222,7 @@
 	    s->max_filepos-s->read_filepos
 	);
 	if(s->eof) break; // file is smaller than prefill size
-	if(mpdemux_check_interrupt(PREFILL_SLEEP_TIME))
+	if(mp_input_check_interrupt(PREFILL_SLEEP_TIME))
 	  return 0;
     }
     return 1; // parent exits
--- a/libmpdemux/mpdemux.c	Wed Oct 23 14:45:01 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#include "config.h"
-#include <stdlib.h>
-
-#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;
-  }
-}
--- a/libmpdemux/mpdemux.h	Wed Oct 23 14:45:01 2002 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-
-extern int mpdemux_check_interrupt(int time);
--- a/libmpdemux/network.c	Wed Oct 23 14:45:01 2002 +0000
+++ b/libmpdemux/network.c	Wed Oct 23 14:46:20 2002 +0000
@@ -19,7 +19,6 @@
 #include "stream.h"
 #include "demuxer.h"
 #include "../cfgparser.h"
-#include "mpdemux.h"
 
 #include "network.h"
 #include "http.h"
@@ -34,6 +33,8 @@
 extern int verbose;
 extern m_config_t *mconfig;
 
+extern int mp_input_check_interrupt(int time);
+
 /* Variables for the command line option -user, -passwd & -bandwidth */
 char *network_username;
 char *network_password;
@@ -193,7 +194,7 @@
 	while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) {
 	      if( ret<0 ) mp_msg(MSGT_NETWORK,MSGL_ERR,"select failed\n");
 	      else if(ret > 0) break;
-	      else if(count > 30 || mpdemux_check_interrupt(500)) {
+	      else if(count > 30 || mp_input_check_interrupt(500)) {
 		if(count > 30)
 		  mp_msg(MSGT_NETWORK,MSGL_ERR,"Connection timeout\n");
 		else
--- a/libmpdemux/test.c	Wed Oct 23 14:45:01 2002 +0000
+++ b/libmpdemux/test.c	Wed Oct 23 14:46:20 2002 +0000
@@ -19,6 +19,11 @@
 void resync_audio_stream(sh_audio_t *sh_audio){
 }
 
+int mp_input_check_interrupt(int time){
+    if(time) usec_sleep(time);
+    return 0;
+}
+
 // for libmpdvdkit2:
 #include "../get_path.c"