vo: replace driver->untimed with VO_CAP_UNTIMED
There's a weird mix and match of ways to set special things about a VO so let's consolidate it all to use VO_CAP bits. More importantly this fixes do_redraw not being properly ignored/skipped in the untimed VO case. This was intended in8657b8e1f3but later the code got reorganized/moved around to make it no longer a no-op but we just got lucky and there were not any known problems with the broken logic until5338f4ba70.
This commit is contained in:
1 parent
2799d8b130
commit
8798cec7fa
5 files changed
+11
-12
No files matched your search
+4
-3
@@ -410,7 +410,7 @@ static bool use_video_lookahead(struct MPContext *mpctx)
|
||||
{
|
||||
return mpctx->video_out &&
|
||||
!(mpctx->video_out->driver->caps & VO_CAP_NORETAIN) &&
|
||||
!(mpctx->opts->untimed || mpctx->video_out->driver->untimed) &&
|
||||
!(mpctx->opts->untimed || (mpctx->video_out->driver->caps & VO_CAP_UNTIMED)) &&
|
||||
!mpctx->opts->video_latency_hacks;
|
||||
}
|
||||
|
||||
@@ -627,7 +627,8 @@ static void update_avsync_before_frame(struct MPContext *mpctx)
|
||||
* If untimed is set always output frames immediately
|
||||
* without sleeping.
|
||||
*/
|
||||
if (mpctx->time_frame < -0.2 || opts->untimed || vo->driver->untimed)
|
||||
if (mpctx->time_frame < -0.2 || opts->untimed ||
|
||||
(vo->driver->caps & VO_CAP_UNTIMED))
|
||||
mpctx->time_frame = 0;
|
||||
}
|
||||
}
|
||||
@@ -1247,7 +1248,7 @@ void write_video(struct MPContext *mpctx)
|
||||
struct vo_frame *frame = vo_frame_ref(&dummy);
|
||||
|
||||
double diff = mpctx->past_frames[0].approx_duration;
|
||||
if (opts->untimed || vo->driver->untimed)
|
||||
if (opts->untimed || (vo->driver->caps & VO_CAP_UNTIMED))
|
||||
diff = -1; // disable frame dropping and aspects of frame timing
|
||||
if (diff >= 0) {
|
||||
diff /= mpctx->video_speed;
|
||||
|
||||
+3
-4
@@ -1076,15 +1076,14 @@ static void do_redraw(struct vo *vo)
|
||||
{
|
||||
struct vo_internal *in = vo->in;
|
||||
|
||||
if (!vo->config_ok || (vo->driver->caps & VO_CAP_NORETAIN))
|
||||
if (!vo->config_ok || (vo->driver->caps & VO_CAP_NORETAIN) ||
|
||||
(vo->driver->caps & VO_CAP_UNTIMED))
|
||||
return;
|
||||
|
||||
mp_mutex_lock(&in->lock);
|
||||
in->request_redraw = false;
|
||||
bool full_redraw = in->dropped_frame;
|
||||
struct vo_frame *frame = NULL;
|
||||
if (!vo->driver->untimed)
|
||||
frame = vo_frame_ref(in->current_frame);
|
||||
struct vo_frame *frame = vo_frame_ref(in->current_frame);
|
||||
if (frame)
|
||||
in->dropped_frame = false;
|
||||
struct vo_frame dummy = {0};
|
||||
|
||||
+2
-3
@@ -202,6 +202,8 @@ enum {
|
||||
VO_CAP_NORETAIN = 1 << 2,
|
||||
// VO supports applying film grain
|
||||
VO_CAP_FILM_GRAIN = 1 << 3,
|
||||
// VO is drawn untimed and is never redrawn
|
||||
VO_CAP_UNTIMED = 1 << 4,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -324,9 +326,6 @@ struct vo_driver {
|
||||
// VO_CAP_* bits
|
||||
int caps;
|
||||
|
||||
// Disable video timing, push frames as quickly as possible, never redraw.
|
||||
bool untimed;
|
||||
|
||||
// The VO is responsible for freeing frames.
|
||||
bool frame_owner;
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ const struct vo_driver video_out_image =
|
||||
{
|
||||
.description = "Write video frames to image files",
|
||||
.name = "image",
|
||||
.untimed = true,
|
||||
.caps = VO_CAP_UNTIMED,
|
||||
.priv_size = sizeof(struct priv),
|
||||
.preinit = preinit,
|
||||
.query_format = query_format,
|
||||
|
||||
+1
-1
@@ -259,8 +259,8 @@ const struct vo_driver video_out_lavc = {
|
||||
.encode = true,
|
||||
.description = "video encoding using libavcodec",
|
||||
.name = "lavc",
|
||||
.caps = VO_CAP_UNTIMED,
|
||||
.initially_blocked = true,
|
||||
.untimed = true,
|
||||
.priv_size = sizeof(struct priv),
|
||||
.preinit = preinit,
|
||||
.query_format = query_format,
|
||||
|
||||
Reference in new issue
Block a user