summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 7080c5a02e..86260a0598 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -836,7 +836,7 @@ static const char *backup_properties[] = {
"sid",
"sub-delay",
"sub-pos",
- //"sub-visibility",
+ "sub-visibility",
"sub-scale",
"ass-use-margins",
"ass-vsfilter-aspect-compat",
@@ -1112,6 +1112,22 @@ static bool mp_get_cache_idle(struct MPContext *mpctx)
return idle;
}
+static void vo_update_window_title(struct MPContext *mpctx)
+{
+ if (!mpctx->video_out)
+ return;
+ char *title = mp_property_expand_string(mpctx, mpctx->opts.wintitle);
+ if (!mpctx->video_out->window_title ||
+ strcmp(title, mpctx->video_out->window_title))
+ {
+ talloc_free(mpctx->video_out->window_title);
+ mpctx->video_out->window_title = talloc_steal(mpctx, title);
+ vo_control(mpctx->video_out, VOCTRL_UPDATE_WINDOW_TITLE, title);
+ } else {
+ talloc_free(title);
+ }
+}
+
#define saddf(var, ...) (*(var) = talloc_asprintf_append((*var), __VA_ARGS__))
// append time in the hh:mm:ss format (plus fractions if wanted)
@@ -1159,6 +1175,8 @@ static void print_status(struct MPContext *mpctx)
struct MPOpts *opts = &mpctx->opts;
sh_video_t * const sh_video = mpctx->sh_video;
+ vo_update_window_title(mpctx);
+
if (opts->quiet)
return;
@@ -1683,7 +1701,6 @@ void reinit_audio_chain(struct MPContext *mpctx)
goto init_error;
}
if (!ao->initialized) {
- ao->buffersize = opts->ao_buffersize;
ao->encode_lavc_ctx = mpctx->encode_lavc_ctx;
mp_chmap_remove_useless_channels(&ao->channels,
&opts->audio_output_channels);
@@ -2355,15 +2372,6 @@ static int fill_audio_out_buffers(struct MPContext *mpctx, double endpts)
return -partial_fill;
}
-static void vo_update_window_title(struct MPContext *mpctx)
-{
- if (!mpctx->video_out)
- return;
- char *title = mp_property_expand_string(mpctx, mpctx->opts.wintitle);
- talloc_free(mpctx->video_out->window_title);
- mpctx->video_out->window_title = talloc_steal(mpctx, title);
-}
-
static void update_fps(struct MPContext *mpctx)
{
#ifdef CONFIG_ENCODING
@@ -2471,6 +2479,13 @@ int reinit_video_chain(struct MPContext *mpctx)
mpctx->initialized_flags |= INITIALIZED_VCODEC;
+ bool saver_state = opts->pause || !opts->stop_screensaver;
+ vo_control(mpctx->video_out, saver_state ? VOCTRL_RESTORE_SCREENSAVER
+ : VOCTRL_KILL_SCREENSAVER, NULL);
+
+ vo_control(mpctx->video_out, mpctx->paused ? VOCTRL_PAUSE
+ : VOCTRL_RESUME, NULL);
+
sh_video->last_pts = MP_NOPTS_VALUE;
sh_video->num_buffered_pts = 0;
sh_video->next_frame_time = 0;
@@ -2483,8 +2498,7 @@ int reinit_video_chain(struct MPContext *mpctx)
return 1;
err_out:
- if (!opts->fixed_vo)
- uninit_player(mpctx, INITIALIZED_VO);
+ uninit_player(mpctx, INITIALIZED_VO);
cleanup_demux_stream(mpctx, STREAM_VIDEO);
no_video:
mpctx->current_track[STREAM_VIDEO] = NULL;
@@ -2689,7 +2703,7 @@ static double update_video(struct MPContext *mpctx, double endpts)
if (sh_video->last_pts == MP_NOPTS_VALUE)
sh_video->last_pts = sh_video->pts;
else if (sh_video->last_pts > sh_video->pts) {
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "Decreasing video pts: %f < %f\n",
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Decreasing video pts: %f < %f\n",
sh_video->pts, sh_video->last_pts);
/* If the difference in pts is small treat it as jitter around the
* right value (possibly caused by incorrect timestamp ordering) and
@@ -2700,6 +2714,11 @@ static double update_video(struct MPContext *mpctx, double endpts)
sh_video->last_pts = sh_video->pts;
else
sh_video->pts = sh_video->last_pts;
+ } else if (sh_video->pts >= sh_video->last_pts + 60) {
+ // Assume a PTS difference >= 60 seconds is a discontinuity.
+ mp_msg(MSGT_CPLAYER, MSGL_WARN, "Jump in video pts: %f -> %f\n",
+ sh_video->last_pts, sh_video->pts);
+ sh_video->last_pts = sh_video->pts;
}
double frame_time = sh_video->pts - sh_video->last_pts;
sh_video->last_pts = sh_video->pts;
@@ -2712,6 +2731,9 @@ void pause_player(struct MPContext *mpctx)
{
mpctx->opts.pause = 1;
+ if (mpctx->video_out)
+ vo_control(mpctx->video_out, VOCTRL_RESTORE_SCREENSAVER, NULL);
+
if (mpctx->paused)
return;
mpctx->paused = true;
@@ -2738,6 +2760,9 @@ void unpause_player(struct MPContext *mpctx)
{
mpctx->opts.pause = 0;
+ if (mpctx->video_out && mpctx->opts.stop_screensaver)
+ vo_control(mpctx->video_out, VOCTRL_KILL_SCREENSAVER, NULL);
+
if (!mpctx->paused)
return;
// Don't actually unpause while cache is loading.
@@ -2748,8 +2773,7 @@ void unpause_player(struct MPContext *mpctx)
if (mpctx->ao && mpctx->sh_audio)
ao_resume(mpctx->ao);
- if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok
- && !mpctx->step_frames)
+ if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
vo_control(mpctx->video_out, VOCTRL_RESUME, NULL); // resume video
(void)get_relative_time(mpctx); // ignore time that passed during pause
}
@@ -2778,8 +2802,6 @@ void add_step_frame(struct MPContext *mpctx, int dir)
{
if (dir > 0) {
mpctx->step_frames += 1;
- if (mpctx->video_out && mpctx->sh_video && mpctx->video_out->config_ok)
- vo_control(mpctx->video_out, VOCTRL_PAUSE, NULL);
unpause_player(mpctx);
} else if (dir < 0) {
if (!mpctx->backstep_active && !mpctx->hrseek_active) {
@@ -4147,8 +4169,6 @@ static void play_current_file(struct MPContext *mpctx)
if (opts->ass_style_override)
ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list);
#endif
- if (mpctx->video_out && mpctx->video_out->config_ok)
- vo_control(mpctx->video_out, VOCTRL_RESUME, NULL);
mp_tmsg(MSGT_CPLAYER, MSGL_INFO, "Playing %s.\n", mpctx->filename);