summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexei Svitkine <alexei.svitkine@gmail.com>2010-07-04 12:43:12 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-07-04 12:43:12 +0000
commit066ce8c93d908cac1eb63b8afbc711946f711a2f (patch)
tree7e7e90aa7d00b195af6aa94471cdd2d85252b4b0
parentdbb113e89e104f1b801d893fe1443180c0f317a5 (diff)
Implement -onkeydown and -onmousedown options for ffplay.
Patch by Alexei Svitkine cout << name << "." << surname << "@" << "gmail.com". See thread: Subject: [FFmpeg-devel] new command-line option for ffplay Date: Wed, 23 Jun 2010 09:13:50 -0400 Originally committed as revision 24037 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--Changelog1
-rw-r--r--doc/ffplay-doc.texi4
-rw-r--r--ffplay.c12
3 files changed, 17 insertions, 0 deletions
diff --git a/Changelog b/Changelog
index 5e38a9b480..b588a9f084 100644
--- a/Changelog
+++ b/Changelog
@@ -18,6 +18,7 @@ version <next>:
- RTSP tunneling over HTTP
- RTP depacketization of SVQ3
- -strict inofficial replaced by -strict unofficial
+- ffplay -exitonkeydown and -exitonmousedown options added
version 0.6:
diff --git a/doc/ffplay-doc.texi b/doc/ffplay-doc.texi
index 49f46479f7..ad1a652f90 100644
--- a/doc/ffplay-doc.texi
+++ b/doc/ffplay-doc.texi
@@ -108,6 +108,10 @@ Select the desired subtitle stream number, counting from 0. The number
refers to the list of all the input subtitle streams. If it is greater
than the number of subtitle streams minus one, then the last one is
selected, if it is negative the subtitle rendering is disabled.
+@item -exitonkeydown
+Exit if any key is pressed.
+@item -exitonmousedown
+Exit if any mouse button is pressed.
@end table
@section While playing
diff --git a/ffplay.c b/ffplay.c
index 9d6411de32..67e2437253 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -260,6 +260,8 @@ static int error_recognition = FF_ER_CAREFUL;
static int error_concealment = 3;
static int decoder_reorder_pts= -1;
static int autoexit;
+static int exit_on_keydown;
+static int exit_on_mousedown;
static int loop=1;
static int framedrop=1;
@@ -2819,6 +2821,10 @@ static void event_loop(void)
SDL_WaitEvent(&event);
switch(event.type) {
case SDL_KEYDOWN:
+ if (exit_on_keydown) {
+ do_exit();
+ break;
+ }
switch(event.key.keysym.sym) {
case SDLK_ESCAPE:
case SDLK_q:
@@ -2887,6 +2893,10 @@ static void event_loop(void)
}
break;
case SDL_MOUSEBUTTONDOWN:
+ if (exit_on_mousedown) {
+ do_exit();
+ break;
+ }
case SDL_MOUSEMOTION:
if(event.type ==SDL_MOUSEBUTTONDOWN){
x= event.button.x;
@@ -3068,6 +3078,8 @@ static const OptionDef options[] = {
{ "sync", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_sync}, "set audio-video sync. type (type=audio/video/ext)", "type" },
{ "threads", HAS_ARG | OPT_FUNC2 | OPT_EXPERT, {(void*)opt_thread_count}, "thread count", "count" },
{ "autoexit", OPT_BOOL | OPT_EXPERT, {(void*)&autoexit}, "exit at the end", "" },
+ { "exitonkeydown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_keydown}, "exit on key down", "" },
+ { "exitonmousedown", OPT_BOOL | OPT_EXPERT, {(void*)&exit_on_mousedown}, "exit on mouse down", "" },
{ "loop", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&loop}, "set number of times the playback shall be looped", "loop count" },
{ "framedrop", OPT_BOOL | OPT_EXPERT, {(void*)&framedrop}, "drop frames when cpu is too slow", "" },
{ "window_title", OPT_STRING | HAS_ARG, {(void*)&window_title}, "set window title", "window title" },