From 9fbfac25daaf6bdaab4c1213a294b59bded29b24 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 7 May 2012 23:51:58 +0300 Subject: options: change -v parsing Handle -v flags as a special case in command line preparsing stage, and change the option entry into a dummy one. Specifying "v" in config file no longer works (and the dummy entry shows an error in this case); "msglevel" can still be used for that purpose. Because the flag is now interpreted at an earlier parsing stage, it now affects the printing of some early messages that were only affected by the MPLAYER_VERBOSE environment variable before. The main motivation for this change is to get rid of the last CONF_TYPE_FUNC option. --- mplayer.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 2ca8518335..e1984e601c 100644 --- a/mplayer.c +++ b/mplayer.c @@ -149,12 +149,6 @@ char *heartbeat_cmd; // Config file //**************************************************************************// -static int cfg_inc_verbose(m_option_t *conf) -{ - ++verbose; - return 0; -} - #include "path.h" //**************************************************************************// @@ -3952,7 +3946,7 @@ int main(int argc, char *argv[]) mp_input_register_options(mpctx->mconfig); // Preparse the command line - m_config_preparse_command_line(mpctx->mconfig, argc, argv); + m_config_preparse_command_line(mpctx->mconfig, argc, argv, &verbose); #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_WIN32DLL) set_path_env(); -- cgit v1.2.3 From 1e90a8657d19918dc7564f559b96dc3982286ba2 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 8 May 2012 02:10:39 +0300 Subject: options: simplify option parsing/setting machinery Each option type had three separate operations to copy option values between memory locations: copy between general memory locations ("copy"), copy from general memory to active configuration of the program ("set"), and in the other direction ("save"). No normal option depends on this distinction any more. Change everything to define and use a single "copy" operation only. Change the special options "include" and "profile", which depended on hacky option types, to be special-cased directly in option parsing instead. Remove the now unused option types m_option_type_func and m_option_type_func_param. --- mplayer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index e1984e601c..f0c1e2fb83 100644 --- a/mplayer.c +++ b/mplayer.c @@ -857,9 +857,9 @@ static void exit_sighandler(int x) #include "cfg-mplayer.h" -static int cfg_include(m_option_t *conf, char *filename) +static int cfg_include(struct m_config *conf, char *filename) { - return m_config_parse_config_file(conf->priv, filename); + return m_config_parse_config_file(conf, filename); } #define DEF_CONFIG "# Write your default config options here!\n\n\n" -- cgit v1.2.3 From f9beb08a61f5c631bab5c2e06e1ce44aea80dc10 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 14 May 2012 12:52:59 +0300 Subject: core: fix EOF handling with untimed audio outputs When using an audio output without a native playback rate (such as ao_pcm), the code plays audio further when the current write position is behind video. After support for continuing audio after the end of video was added, this could cause a deadlock: audio was not played further, but neither was EOF triggered. Fix the code to properly handle playback of remaining audio after video ends in the untimed audio case (audio-only case was not affected, only the case where a video stream exists but ends before the audio stream). --- mplayer.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index f0c1e2fb83..5aa6f4cde0 100644 --- a/mplayer.c +++ b/mplayer.c @@ -2529,9 +2529,6 @@ static int fill_audio_out_buffers(struct MPContext *mpctx, double endpts) current_module = "play_audio"; - if (ao->untimed && mpctx->sh_video && mpctx->delay > 0) - return 0; - // hack used by some mpeg-writing AOs ao->brokenpts = ((mpctx->sh_video ? mpctx->sh_video->timer : 0) + mpctx->delay) * 90000.0; @@ -3453,9 +3450,9 @@ static void run_playloop(struct MPContext *mpctx) pause_player(mpctx); } - if (mpctx->sh_audio && !mpctx->restart_playback) { + if (mpctx->sh_audio && !mpctx->restart_playback && !mpctx->ao->untimed) { int status = fill_audio_out_buffers(mpctx, endpts); - full_audio_buffers = status >= 0 && !mpctx->ao->untimed; + full_audio_buffers = status >= 0; // Not at audio stream EOF yet audio_left = status > -2; } @@ -3667,15 +3664,16 @@ static void run_playloop(struct MPContext *mpctx) } #endif - if (mpctx->restart_playback && !video_left) { - if (mpctx->sh_audio) { - int status = fill_audio_out_buffers(mpctx, endpts); - full_audio_buffers = status >= 0 && !mpctx->ao->untimed; - // Not at audio stream EOF yet - audio_left = status > -2; - } - mpctx->restart_playback = false; + if (mpctx->sh_audio && (mpctx->restart_playback ? !video_left : + mpctx->ao->untimed && (mpctx->delay <= 0 || + !video_left))) { + int status = fill_audio_out_buffers(mpctx, endpts); + full_audio_buffers = status >= 0 && !mpctx->ao->untimed; + // Not at audio stream EOF yet + audio_left = status > -2; } + if (!video_left) + mpctx->restart_playback = false; if (mpctx->sh_audio && buffered_audio == -1) buffered_audio = mpctx->paused ? 0 : ao_get_delay(mpctx->ao); @@ -3724,7 +3722,7 @@ static void run_playloop(struct MPContext *mpctx) double audio_sleep = 9; if (mpctx->sh_audio && !mpctx->paused) { if (mpctx->ao->untimed) { - if (!mpctx->sh_video) + if (!video_left) audio_sleep = 0; } else if (full_audio_buffers) { audio_sleep = buffered_audio - 0.050; -- cgit v1.2.3