summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-10-21 15:54:22 +0200
committerwm4 <wm4@nowhere>2012-10-24 21:56:34 +0200
commitf80a32a8ebd1573f1578d707416b07880c1a08c1 (patch)
tree908845c81c04e393ce28beef519f6f6cfedc47ea
parent0c49ddc818fee8059d764f7fbd25820584f335a3 (diff)
downloadmpv-f80a32a8ebd1573f1578d707416b07880c1a08c1.tar.bz2
mpv-f80a32a8ebd1573f1578d707416b07880c1a08c1.tar.xz
core: do not try to redraw OSD if VO doesn't support OSD
This fixes awkward framestepping when seeking with -vo null while paused (caused because seeking by default draws an OSD bar, and mplayer trying to redraw the OSD in that case; this logic is actually needed with vo_xv). It would have been simpler to just check vo->driver->draw_osd (and leave that callback to NULL for VOs which don't support OSD), but for now try to retain the capability to let VOs decide based on the image format whether to support OSD or not.
-rw-r--r--libmpcodecs/vf_vo.c9
-rw-r--r--libvo/video_out.c10
-rw-r--r--libvo/video_out.h1
-rw-r--r--mplayer.c33
4 files changed, 29 insertions, 24 deletions
diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c
index 16d10f0cdc..d11724f881 100644
--- a/libmpcodecs/vf_vo.c
+++ b/libmpcodecs/vf_vo.c
@@ -37,7 +37,6 @@ struct vf_priv_s {
};
#define video_out (vf->priv->vo)
-static int query_format(struct vf_instance *vf, unsigned int fmt);
static void draw_slice(struct vf_instance *vf, unsigned char **src,
int *stride, int w, int h, int x, int y);
@@ -66,13 +65,13 @@ static int config(struct vf_instance *vf,
if (info->comment && strlen(info->comment) > 0)
mp_msg(MSGT_CPLAYER, MSGL_V, "VO: Comment: %s\n", info->comment);
- // save vo's stride capability for the wanted colorspace:
- vf->default_caps = query_format(vf, outfmt);
- vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
-
if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt))
return 0;
+ // save vo's stride capability for the wanted colorspace:
+ vf->default_caps = video_out->default_caps;
+ vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice;
+
return 1;
}
diff --git a/libvo/video_out.c b/libvo/video_out.c
index 2503fa93e3..c16968574d 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -38,6 +38,7 @@
#include "mp_fifo.h"
#include "m_config.h"
#include "mp_msg.h"
+#include "libmpcodecs/vfcap.h"
#include "osdep/shmem.h"
#ifdef CONFIG_X11
@@ -224,9 +225,8 @@ void vo_new_frame_imminent(struct vo *vo)
void vo_draw_osd(struct vo *vo, struct osd_state *osd)
{
- if (!vo->config_ok)
- return;
- vo->driver->draw_osd(vo, osd);
+ if (vo->config_ok && (vo->default_caps & VFCAP_OSD))
+ vo->driver->draw_osd(vo, osd);
}
void vo_flip_page(struct vo *vo, unsigned int pts_us, int duration)
@@ -385,10 +385,14 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height,
vo->dheight = d_height;
}
+ vo->default_caps = vo_control(vo, VOCTRL_QUERY_FORMAT, &format);
+
int ret = vo->driver->config(vo, width, height, d_width, d_height, flags,
format);
vo->config_ok = (ret == 0);
vo->config_count += vo->config_ok;
+ if (!vo->config_ok)
+ vo->default_caps = 0;
if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) {
mp_input_add_key_fd(vo->input_ctx, vo->event_fd, 1, event_fd_callback,
NULL, vo);
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 1c48b5fb06..efe3624b52 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -233,6 +233,7 @@ struct vo_driver {
struct vo {
int config_ok; // Last config call was successful?
int config_count; // Total number of successful config calls
+ int default_caps; // query_format() result for configured video format
bool frame_loaded; // Is there a next frame the VO could flip to?
struct mp_image *waiting_mpi;
diff --git a/mplayer.c b/mplayer.c
index f9b6f687c1..49edfc4636 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -2553,16 +2553,16 @@ static void draw_osd(struct MPContext *mpctx)
mpctx->osd->want_redraw = false;
}
-static int redraw_osd(struct MPContext *mpctx)
+static bool redraw_osd(struct MPContext *mpctx)
{
struct vo *vo = mpctx->video_out;
if (vo_redraw_frame(vo) < 0)
- return -1;
+ return false;
draw_osd(mpctx);
vo_flip_page(vo, 0, -1);
- return 0;
+ return true;
}
void add_step_frame(struct MPContext *mpctx)
@@ -3304,22 +3304,23 @@ static void run_playloop(struct MPContext *mpctx)
audio_sleep = 0.020;
}
sleeptime = FFMIN(sleeptime, audio_sleep);
- if (sleeptime > 0) {
- if (!mpctx->sh_video)
- goto novideo;
- if (mpctx->osd->want_redraw || mpctx->video_out->want_redraw) {
- mpctx->osd->want_redraw = false;
- if (redraw_osd(mpctx) < 0) {
- if (mpctx->paused && video_left)
- add_step_frame(mpctx);
- else
- goto novideo;
+ if (sleeptime > 0 && mpctx->sh_video) {
+ bool want_redraw = mpctx->video_out->want_redraw;
+ if (mpctx->video_out->default_caps & VFCAP_OSD)
+ want_redraw |= mpctx->osd->want_redraw;
+ mpctx->osd->want_redraw = false;
+ if (want_redraw) {
+ if (redraw_osd(mpctx)) {
+ sleeptime = 0;
+ } else if (mpctx->paused && video_left) {
+ // force redrawing OSD by framestepping
+ add_step_frame(mpctx);
+ sleeptime = 0;
}
- } else {
- novideo:
- mp_input_get_cmd(mpctx->input, sleeptime * 1000, true);
}
}
+ if (sleeptime > 0)
+ mp_input_get_cmd(mpctx->input, sleeptime * 1000, true);
}
//================= Keyboard events, SEEKing ====================