summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-24 16:06:27 +0100
committerwm4 <wm4@nowhere>2013-02-24 16:06:27 +0100
commit63601415d85041d439f43d5f489d034f118fb2ba (patch)
tree06f70f054a8bd431d1b5df86854465c664755493
parente013fbd34e66270cf012a162ad1c46030a53fe69 (diff)
downloadmpv-63601415d85041d439f43d5f489d034f118fb2ba.tar.bz2
mpv-63601415d85041d439f43d5f489d034f118fb2ba.tar.xz
core: print correct quit message when quitting, simplify code
"End of file" was printed to the terminal instead of "Quit" when exiting with the "quit" slave command (closing the window and such). Note that it will still print EOF when it exists because the end of the playlist is reached. Do some other (not strictly related) simplifications.
-rw-r--r--core/command.c6
-rw-r--r--core/mplayer.c35
2 files changed, 14 insertions, 27 deletions
diff --git a/core/command.c b/core/command.c
index 50fe09c555..644b1d37b2 100644
--- a/core/command.c
+++ b/core/command.c
@@ -1734,8 +1734,8 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
switch (cmd->id) {
case MP_CMD_SEEK: {
float v = cmd->args[0].v.f;
- int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
- int exact = (cmd->nargs > 2) ? cmd->args[2].v.i : 0;
+ int abs = cmd->args[1].v.i;
+ int exact = cmd->args[2].v.i;
if (abs == 2) { // Absolute seek to a timestamp in seconds
queue_seek(mpctx, MPSEEK_ABSOLUTE, v, exact);
set_osd_function(mpctx,
@@ -1825,7 +1825,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_QUIT:
mpctx->stop_play = PT_QUIT;
- mpctx->quit_player_rc = (cmd->nargs > 0) ? cmd->args[0].v.i : 0;
+ mpctx->quit_player_rc = cmd->args[0].v.i;
break;
case MP_CMD_PLAYLIST_NEXT:
diff --git a/core/mplayer.c b/core/mplayer.c
index 0e4e1076b8..fa12403a82 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -134,8 +134,6 @@ char *heartbeat_cmd;
// Input media streaming & demultiplexer:
//**************************************************************************//
-static int max_framesize = 0;
-
#include "stream/stream.h"
#include "demux/demux.h"
#include "demux/stheader.h"
@@ -614,24 +612,16 @@ static MP_NORETURN void exit_player(struct MPContext *mpctx,
talloc_free(mpctx->key_fifo);
- switch (how) {
- case EXIT_QUIT:
- mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "\nExiting... (%s)\n", "Quit");
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=QUIT\n");
- break;
- case EXIT_EOF:
- mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "\nExiting... (%s)\n", "End of file");
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=EOF\n");
- break;
- case EXIT_ERROR:
- mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "\nExiting... (%s)\n", "Fatal error");
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=ERROR\n");
- break;
- default:
- mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_EXIT=NONE\n");
+ if (how != EXIT_NONE) {
+ const char *reason;
+ switch (how) {
+ case EXIT_QUIT: reason = "Quit"; break;
+ case EXIT_EOF: reason = "End of file"; break;
+ case EXIT_ERROR: reason = "Fatal error"; break;
+ default: abort();
+ }
+ mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "\nExiting... (%s)\n", reason);
}
- mp_msg(MSGT_CPLAYER, MSGL_DBG2,
- "max framesize was %d bytes\n", max_framesize);
// must be last since e.g. mp_msg uses option values
// that will be freed by this.
@@ -2458,8 +2448,6 @@ static double update_video_nocorrect_pts(struct MPContext *mpctx)
&packet, force_fps);
if (in_size < 0)
return -1;
- if (in_size > max_framesize)
- max_framesize = in_size;
sh_video->timer += frame_time;
if (mpctx->sh_audio)
mpctx->delay -= frame_time;
@@ -2544,8 +2532,6 @@ static double update_video(struct MPContext *mpctx)
}
if (pts != MP_NOPTS_VALUE)
pts += mpctx->video_offset;
- if (in_size > max_framesize)
- max_framesize = in_size;
if (pts >= mpctx->hrseek_pts - .005)
mpctx->hrseek_framedrop = false;
int framedrop_type = mpctx->hrseek_framedrop ? 1 :
@@ -4419,7 +4405,8 @@ int main(int argc, char *argv[])
mpctx->playlist->current = mpctx->playlist->first;
play_files(mpctx);
- exit_player(mpctx, EXIT_EOF, mpctx->quit_player_rc);
+ exit_player(mpctx, mpctx->stop_play == PT_QUIT ? EXIT_QUIT : EXIT_EOF,
+ mpctx->quit_player_rc);
return 1;
}