summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorLeon van Stuivenberg <leonvs@iae.nl>2004-03-14 19:40:43 +0000
committerMichael Niedermayer <michaelni@gmx.at>2004-03-14 19:40:43 +0000
commitb51469a0c54b30079eecc4891cc050778f343683 (patch)
treeab4c2260b0b8dab865ceccb4a0e49d575e8606b6 /ffmpeg.c
parent35fe5cc53ff1b2a23e01557cad19ffdbe14cad6f (diff)
tcp select() check and enables pressing 'q' when reading/(writing) from
tcp/http in ffmpeg.c patch by (Leon van Stuivenberg <l dot vanstuivenberg at chello dot nl>) Originally committed as revision 2891 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 8fce0beec5..42ed00d18c 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -193,6 +193,7 @@ static int using_stdin = 0;
static int using_vhook = 0;
static int verbose = 1;
static int thread_count= 1;
+static int q_pressed = 0;
#define DEFAULT_PASS_LOGFILENAME "ffmpeg2pass"
@@ -322,6 +323,11 @@ static int read_key(void)
return -1;
}
+static int decode_interrupt_cb(void)
+{
+ return q_pressed || (q_pressed = read_key() == 'q');
+}
+
#else
static volatile int received_sigterm = 0;
@@ -1411,8 +1417,10 @@ static int av_encode(AVFormatContext **output_files,
}
#ifndef CONFIG_WIN32
- if ( !using_stdin )
+ if ( !using_stdin ) {
fprintf(stderr, "Press [q] to stop encoding\n");
+ url_set_interrupt_cb(decode_interrupt_cb);
+ }
#endif
term_init();
@@ -1427,6 +1435,8 @@ static int av_encode(AVFormatContext **output_files,
redo:
/* if 'q' pressed, exits */
if (!using_stdin) {
+ if (q_pressed)
+ break;
/* read_key() returns 0 on EOF */
key = read_key();
if (key == 'q')