mpdemux.c|h moved to libinput, mpdemux_check_interrupt() -> mp_input_check_interrupt()

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@7863 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
arpi 2002-10-23 14:46:20 +00:00
parent d782c21b57
commit bf3c311ee8
8 changed files with 39 additions and 31 deletions

View File

@ -1367,3 +1367,26 @@ static int mp_input_print_cmd_list(config_t* cfg) {
}
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;
}

View File

@ -171,3 +171,8 @@ mp_input_init(void);
void
mp_input_uninit(void);
// Interruptible usleep: (used by libmpdemux)
int
mp_input_check_interrupt(int time);

View File

@ -3,7 +3,7 @@ LIBNAME = libmpdemux.a
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)

View File

@ -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 @@ int stream_enable_cache(stream_t *stream,int size,int min,int prefill){
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

View File

@ -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;
}
}

View File

@ -1,2 +0,0 @@
extern int mpdemux_check_interrupt(int time);

View File

@ -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 @@ connect2Server(char *host, int port) {
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

View File

@ -19,6 +19,11 @@ void skip_audio_frame(sh_audio_t *sh_audio){
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"