mirror of
https://github.com/mpv-player/mpv
synced 2024-12-28 06:03:45 +01:00
Remove the need for code using stream to export an mp_input_check_interrupt()
function. It also removes the compile-time dependency on input. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26358 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
64868a36cd
commit
f481e7870b
@ -2855,6 +2855,8 @@ if(slave_mode)
|
||||
mp_input_add_cmd_fd(0,USE_SELECT,MP_INPUT_SLAVE_CMD_FUNC,NULL);
|
||||
else if(!noconsolecontrols)
|
||||
mp_input_add_event_fd(0, getch2);
|
||||
// Set the libstream interrupt callback
|
||||
stream_set_interrupt_callback(mp_input_check_interrupt);
|
||||
|
||||
#ifdef HAVE_MENU
|
||||
if(use_menu) {
|
||||
|
@ -32,7 +32,6 @@ static void ThreadProc( void *s );
|
||||
#include "help_mp.h"
|
||||
|
||||
#include "stream.h"
|
||||
#include "input/input.h"
|
||||
extern int use_gui;
|
||||
|
||||
int stream_fill_buffer(stream_t *s);
|
||||
@ -307,7 +306,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){
|
||||
(int64_t)s->max_filepos-s->read_filepos
|
||||
);
|
||||
if(s->eof) break; // file is smaller than prefill size
|
||||
if(mp_input_check_interrupt(PREFILL_SLEEP_TIME))
|
||||
if(stream_check_interrupt(PREFILL_SLEEP_TIME))
|
||||
return 0;
|
||||
}
|
||||
mp_msg(MSGT_CACHE,MSGL_STATUS,"\n");
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
//#include "vcd_read_bincue.h"
|
||||
|
||||
static int (*stream_check_interrupt_cb)(int time) = NULL;
|
||||
|
||||
extern const stream_info_t stream_info_vcd;
|
||||
extern const stream_info_t stream_info_cdda;
|
||||
extern const stream_info_t stream_info_netstream;
|
||||
@ -455,3 +457,12 @@ stream_t* new_ds_stream(demux_stream_t *ds) {
|
||||
s->priv = ds;
|
||||
return s;
|
||||
}
|
||||
|
||||
void stream_set_interrupt_callback(int (*cb)(int)) {
|
||||
stream_check_interrupt_cb = cb;
|
||||
}
|
||||
|
||||
int stream_check_interrupt(int time) {
|
||||
if(!stream_check_interrupt_cb) return 0;
|
||||
return stream_check_interrupt_cb(time);
|
||||
}
|
||||
|
@ -296,6 +296,11 @@ stream_t* new_memory_stream(unsigned char* data,int len);
|
||||
stream_t* open_stream(char* filename,char** options,int* file_format);
|
||||
stream_t* open_stream_full(char* filename,int mode, char** options, int* file_format);
|
||||
stream_t* open_output_stream(char* filename,char** options);
|
||||
/// Set the callback to be used by libstream to check for user
|
||||
/// interruption during long blocking operations (cache filling, etc).
|
||||
void stream_set_interrupt_callback(int (*cb)(int));
|
||||
/// Call the interrupt checking callback if there is one.
|
||||
int stream_check_interrupt(int time);
|
||||
|
||||
extern int dvd_title;
|
||||
extern int dvd_chapter;
|
||||
|
@ -19,7 +19,6 @@
|
||||
|
||||
#include "mp_msg.h"
|
||||
#include "help_mp.h"
|
||||
#include "input/input.h"
|
||||
|
||||
#ifndef HAVE_WINSOCK2
|
||||
#include <netdb.h>
|
||||
@ -195,7 +194,7 @@ connect2Server_with_af(char *host, int port, int af,int verb) {
|
||||
FD_SET( socket_server_fd, &set );
|
||||
// When the connection will be made, we will have a writeable fd
|
||||
while((ret = select(socket_server_fd+1, NULL, &set, NULL, &tv)) == 0) {
|
||||
if(count > 30 || mp_input_check_interrupt(500)) {
|
||||
if(count > 30 || stream_check_interrupt(500)) {
|
||||
if(count > 30)
|
||||
mp_msg(MSGT_NETWORK,MSGL_ERR,MSGTR_MPDEMUX_NW_ConnTimeout);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user