Commit 8fb566fd authored by Anton Khirnov's avatar Anton Khirnov

ffmpeg: get rid of the 'q' key schizofrenia

SIGINT for quitting should be enough for everybody.
parent 552a9995
...@@ -8,6 +8,7 @@ version <next>: ...@@ -8,6 +8,7 @@ version <next>:
- fft and imdct optimizations for AVX (Sandy Bridge) processors - fft and imdct optimizations for AVX (Sandy Bridge) processors
- DPX image encoder - DPX image encoder
- SMPTE 302M AES3 audio decoder - SMPTE 302M AES3 audio decoder
- Remove support for quitting ffmpeg with 'q', ctrl+c should be used.
version 0.7_beta1: version 0.7_beta1:
......
...@@ -1069,7 +1069,6 @@ HAVE_LIST=" ...@@ -1069,7 +1069,6 @@ HAVE_LIST="
inet_aton inet_aton
inline_asm inline_asm
isatty isatty
kbhit
ldbrx ldbrx
libdc1394_1 libdc1394_1
libdc1394_2 libdc1394_2
...@@ -2792,7 +2791,6 @@ check_func ${malloc_prefix}posix_memalign && enable posix_memalign ...@@ -2792,7 +2791,6 @@ check_func ${malloc_prefix}posix_memalign && enable posix_memalign
check_func setrlimit check_func setrlimit
check_func strerror_r check_func strerror_r
check_func strtok_r check_func strtok_r
check_func_headers conio.h kbhit
check_func_headers io.h setmode check_func_headers io.h setmode
check_func_headers lzo/lzo1x.h lzo1x_999_compress check_func_headers lzo/lzo1x.h lzo1x_999_compress
check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi check_lib2 "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
......
...@@ -66,9 +66,6 @@ ...@@ -66,9 +66,6 @@
#include <sys/select.h> #include <sys/select.h>
#endif #endif
#if HAVE_KBHIT
#include <conio.h>
#endif
#include <time.h> #include <time.h>
#include "cmdutils.h" #include "cmdutils.h"
...@@ -229,7 +226,6 @@ static int exit_on_error = 0; ...@@ -229,7 +226,6 @@ static int exit_on_error = 0;
static int using_stdin = 0; static int using_stdin = 0;
static int verbose = 1; static int verbose = 1;
static int thread_count= 1; static int thread_count= 1;
static int q_pressed = 0;
static int64_t video_size = 0; static int64_t video_size = 0;
static int64_t audio_size = 0; static int64_t audio_size = 0;
static int64_t extra_size = 0; static int64_t extra_size = 0;
...@@ -440,19 +436,9 @@ static void term_init(void) ...@@ -440,19 +436,9 @@ static void term_init(void)
#endif #endif
} }
/* read a key without blocking */
static int read_key(void)
{
#if HAVE_KBHIT
if(kbhit())
return(getch());
#endif
return -1;
}
static int decode_interrupt_cb(void) static int decode_interrupt_cb(void)
{ {
return q_pressed || (q_pressed = read_key() == 'q'); return received_sigterm;
} }
static int ffmpeg_exit(int ret) static int ffmpeg_exit(int ret)
...@@ -1894,7 +1880,6 @@ static int transcode(AVFormatContext **output_files, ...@@ -1894,7 +1880,6 @@ static int transcode(AVFormatContext **output_files,
AVInputStream *ist, **ist_table = NULL; AVInputStream *ist, **ist_table = NULL;
AVInputFile *file_table; AVInputFile *file_table;
char error[1024]; char error[1024];
int key;
int want_sdp = 1; int want_sdp = 1;
uint8_t no_packet[MAX_FILES]={0}; uint8_t no_packet[MAX_FILES]={0};
int no_packet_count=0; int no_packet_count=0;
...@@ -2456,14 +2441,8 @@ static int transcode(AVFormatContext **output_files, ...@@ -2456,14 +2441,8 @@ static int transcode(AVFormatContext **output_files,
print_sdp(output_files, nb_output_files); print_sdp(output_files, nb_output_files);
} }
if (!using_stdin && verbose >= 0) { if (verbose >= 0)
#if HAVE_KBHIT
fprintf(stderr, "Press [q] to stop encoding\n");
#else
fprintf(stderr, "Press ctrl-c to stop encoding\n"); fprintf(stderr, "Press ctrl-c to stop encoding\n");
#endif
avio_set_interrupt_cb(decode_interrupt_cb);
}
term_init(); term_init();
timer_start = av_gettime(); timer_start = av_gettime();
...@@ -2477,15 +2456,6 @@ static int transcode(AVFormatContext **output_files, ...@@ -2477,15 +2456,6 @@ static int transcode(AVFormatContext **output_files,
redo: redo:
ipts_min= 1e100; ipts_min= 1e100;
opts_min= 1e100; opts_min= 1e100;
/* if 'q' pressed, exits */
if (!using_stdin) {
if (q_pressed)
break;
/* read_key() returns 0 on EOF */
key = read_key();
if (key == 'q')
break;
}
/* select the stream that we must read now by looking at the /* select the stream that we must read now by looking at the
smallest output pts */ smallest output pts */
...@@ -4372,10 +4342,7 @@ int main(int argc, char **argv) ...@@ -4372,10 +4342,7 @@ int main(int argc, char **argv)
#endif #endif
av_register_all(); av_register_all();
#if HAVE_ISATTY avio_set_interrupt_cb(decode_interrupt_cb);
if(isatty(STDIN_FILENO))
avio_set_interrupt_cb(decode_interrupt_cb);
#endif
init_opts(); init_opts();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment