summaryrefslogtreecommitdiffstats
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-01-09 07:03:55 +0100
committerMarton Balint <cus@passwd.hu>2012-01-09 23:22:56 +0100
commit73f2cf4ed9d61d1fcd06d260a5d3f22131d2fb07 (patch)
tree4e876c6792488e6c1f6412adcec7c2fa946b4107 /ffplay.c
parentf247f4cf47f4bf6ceb647459f5c78dbf29a59178 (diff)
downloadffmpeg-streaming-73f2cf4ed9d61d1fcd06d260a5d3f22131d2fb07.zip
ffmpeg-streaming-73f2cf4ed9d61d1fcd06d260a5d3f22131d2fb07.tar.gz
ffplay: Exit on ctrl-c.
This allows to get out of ffplay if it or SDL got stuck. This for example happens when the audio driver is playing something else and doesnt support mixing multiple sources. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ffplay.c b/ffplay.c
index 1c4289c..bd7374a 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -27,6 +27,7 @@
#include <inttypes.h>
#include <math.h>
#include <limits.h>
+#include <signal.h>
#include "libavutil/avstring.h"
#include "libavutil/colorspace.h"
#include "libavutil/mathematics.h"
@@ -925,6 +926,11 @@ static void do_exit(VideoState *is)
exit(0);
}
+static void sigterm_handler(int sig)
+{
+ exit(123);
+}
+
static int video_open(VideoState *is, int force_set_video_mode)
{
int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
@@ -3182,6 +3188,9 @@ int main(int argc, char **argv)
init_opts();
+ signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
+ signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
+
show_banner(argc, argv, options);
parse_options(NULL, argc, argv, options, opt_input_file);
OpenPOWER on IntegriCloud