diff options
-rw-r--r-- | DOCS/man/en/mplayer.1 | 11 | ||||
-rw-r--r-- | cfg-mplayer.h | 5 | ||||
-rw-r--r-- | defaultopts.c | 1 | ||||
-rw-r--r-- | mplayer.c | 32 | ||||
-rw-r--r-- | options.h | 2 |
5 files changed, 37 insertions, 14 deletions
diff --git a/DOCS/man/en/mplayer.1 b/DOCS/man/en/mplayer.1 index a31ffb478b..708fd10199 100644 --- a/DOCS/man/en/mplayer.1 +++ b/DOCS/man/en/mplayer.1 @@ -2663,6 +2663,17 @@ The values that <format> can adopt are listed below in the description of the format audio filter. . .TP +.B \-gapless\-audio +Try to play consecutive audio files with no silence or disruption +at the point of file change. +This feature is implemented in a simple manner and relies on audio output +device buffering to continue playback while moving from one file to another. +If playback of the new file starts slowly, for example because it's played from +a remote network location or because you have specified cache settings that +require time for the initial cache fill, then the buffered audio may run out +before playback of the new file can start. +. +.TP .B \-mixer <device> Use a mixer device different from the default /dev/\:mixer. For ALSA this is the mixer name. diff --git a/cfg-mplayer.h b/cfg-mplayer.h index 7413d171d4..95477edb33 100644 --- a/cfg-mplayer.h +++ b/cfg-mplayer.h @@ -98,9 +98,10 @@ const m_option_t mplayer_opts[]={ {"softvol-max", &soft_vol_max, CONF_TYPE_FLOAT, CONF_RANGE, 10, 10000, NULL}, {"volstep", &volstep, CONF_TYPE_INT, CONF_RANGE, 0, 100, NULL}, {"volume", &start_volume, CONF_TYPE_FLOAT, CONF_RANGE, -1, 10000, NULL}, + OPT_MAKE_FLAGS("gapless-audio", gapless_audio, 0), {"master", "Option -master has been removed, use -af volume instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, - // override audio buffer size (used only by -ao oss, anyway obsolete...) - {"abs", &ao_data.buffersize, CONF_TYPE_INT, CONF_MIN, 0, 0, NULL}, + // override audio buffer size (used only by -ao oss/win32, obsolete) + OPT_INT("abs", ao_buffersize, 0), // -ao pcm options: {"aofile", "-aofile has been removed. Use -ao pcm:file=<filename> instead.\n", CONF_TYPE_PRINT, 0, 0, 0, NULL}, diff --git a/defaultopts.c b/defaultopts.c index cac97c04dd..1314e21f28 100644 --- a/defaultopts.c +++ b/defaultopts.c @@ -10,6 +10,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .audio_driver_list = NULL, .video_driver_list = NULL, .fixed_vo = 1, + .ao_buffersize = -1, .monitor_pixel_aspect = 1.0, .vo_panscanrange = 1.0, .vo_gamma_gamma = 1000, @@ -1742,22 +1742,25 @@ void reinit_audio_chain(struct MPContext *mpctx) } + current_module="af_preinit"; if (!(mpctx->initialized_flags & INITIALIZED_AO)) { - current_module="af_preinit"; ao_data.samplerate=force_srate; ao_data.channels=0; ao_data.format = opts->audio_output_format; - // first init to detect best values - if(!init_audio_filters(mpctx->sh_audio, // preliminary init - // input: - mpctx->sh_audio->samplerate, - // output: - &ao_data.samplerate, &ao_data.channels, &ao_data.format)){ - mp_tmsg(MSGT_CPLAYER,MSGL_ERR, "Error at audio filter chain " - "pre-init!\n"); - exit_player(mpctx, EXIT_ERROR); - } + } + // first init to detect best values + if(!init_audio_filters(mpctx->sh_audio, // preliminary init + // input: + mpctx->sh_audio->samplerate, + // output: + &ao_data.samplerate, &ao_data.channels, &ao_data.format)){ + mp_tmsg(MSGT_CPLAYER,MSGL_ERR, "Error at audio filter chain " + "pre-init!\n"); + exit_player(mpctx, EXIT_ERROR); + } + if (!(mpctx->initialized_flags & INITIALIZED_AO)) { current_module="ao2_init"; + ao_data.buffersize = opts->ao_buffersize; mpctx->audio_out = init_best_audio_out(opts->audio_driver_list, 0, // plugin flag ao_data.samplerate, @@ -4488,7 +4491,12 @@ if(benchmark){ } // time to uninit all, except global stuff: -uninit_player(mpctx, INITIALIZED_ALL-(opts->fixed_vo?INITIALIZED_VO:0)); +int uninitialize_parts = INITIALIZED_ALL; +if (opts->fixed_vo) + uninitialize_parts -= INITIALIZED_VO; +if (opts->gapless_audio && mpctx->stop_play == AT_END_OF_FILE) + uninitialize_parts -= INITIALIZED_AO; +uninit_player(mpctx, uninitialize_parts); if(mpctx->set_of_sub_size > 0) { current_module="sub_free"; @@ -6,6 +6,8 @@ typedef struct MPOpts { char **audio_driver_list; int fixed_vo; int vo_ontop; + int gapless_audio; + int ao_buffersize; int screen_size_x; int screen_size_y; int vo_screenwidth; |