mirror of
https://github.com/mpv-player/mpv
synced 2025-04-17 12:54:40 +00:00
vo: pass through framedrop flag differently
There is some sort-of awkwardness here, because option access needs to happen in a synchronized manner, and the framedrop flag is not in the VO option struct. Remove the mp_read_option_raw() call and the awkward change notification via VO_EVENT_WIN_STATE from command.c, and pass it through as new vo_frame flag.
This commit is contained in:
parent
e42a194062
commit
290341c777
@ -2730,16 +2730,6 @@ static int mp_property_display_fps(void *ctx, struct m_property *prop,
|
||||
return mp_property_generic_option(mpctx, prop, action, arg);
|
||||
}
|
||||
|
||||
static int mp_property_framedrop(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
{
|
||||
MPContext *mpctx = ctx;
|
||||
int ret = mp_property_generic_option(mpctx, prop, action, arg);
|
||||
if (action == M_PROPERTY_SET && ret == M_PROPERTY_OK && mpctx->video_out)
|
||||
vo_event(mpctx->video_out, VO_EVENT_WIN_STATE);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int mp_property_estimated_display_fps(void *ctx, struct m_property *prop,
|
||||
int action, void *arg)
|
||||
{
|
||||
@ -4001,7 +3991,6 @@ static const struct m_property mp_properties_base[] = {
|
||||
{"display-fps", mp_property_display_fps},
|
||||
{"estimated-display-fps", mp_property_estimated_display_fps},
|
||||
{"vsync-jitter", mp_property_vsync_jitter},
|
||||
{"framedrop", mp_property_framedrop},
|
||||
|
||||
{"working-directory", mp_property_cwd},
|
||||
|
||||
|
@ -777,7 +777,7 @@ static void handle_display_sync_frame(struct MPContext *mpctx,
|
||||
mode == VS_DISP_RESAMPLE_NONE;
|
||||
bool drop = mode == VS_DISP_VDROP || mode == VS_DISP_RESAMPLE ||
|
||||
mode == VS_DISP_ADROP || mode == VS_DISP_RESAMPLE_VDROP;
|
||||
drop &= (opts->frame_dropping & 1);
|
||||
drop &= frame->can_drop;
|
||||
|
||||
if (resample && using_spdif_passthrough(mpctx))
|
||||
return;
|
||||
@ -1109,6 +1109,7 @@ void write_video(struct MPContext *mpctx)
|
||||
.pts = pts,
|
||||
.duration = -1,
|
||||
.still = mpctx->step_frames > 0,
|
||||
.can_drop = opts->frame_dropping & 1,
|
||||
.num_frames = MPMIN(mpctx->num_next_frames, req),
|
||||
.num_vsyncs = 1,
|
||||
};
|
||||
|
@ -164,7 +164,6 @@ struct vo_internal {
|
||||
|
||||
double display_fps;
|
||||
double reported_display_fps;
|
||||
int opt_framedrop;
|
||||
};
|
||||
|
||||
extern const struct m_sub_options gl_video_conf;
|
||||
@ -531,9 +530,6 @@ static void update_display_fps(struct vo *vo)
|
||||
|
||||
pthread_mutex_unlock(&in->lock);
|
||||
|
||||
mp_read_option_raw(vo->global, "framedrop", &m_option_type_choice,
|
||||
&in->opt_framedrop);
|
||||
|
||||
double fps = 0;
|
||||
vo->driver->control(vo, VOCTRL_GET_DISPLAY_FPS, &fps);
|
||||
|
||||
@ -851,7 +847,7 @@ bool vo_render_frame_external(struct vo *vo)
|
||||
|
||||
in->dropped_frame &= !frame->display_synced;
|
||||
in->dropped_frame &= !(vo->driver->caps & VO_CAP_FRAMEDROP);
|
||||
in->dropped_frame &= (in->opt_framedrop & 1);
|
||||
in->dropped_frame &= frame->can_drop;
|
||||
// Even if we're hopelessly behind, rather degrade to 10 FPS playback,
|
||||
// instead of just freezing the display forever.
|
||||
in->dropped_frame &= now - in->prev_vsync < 100 * 1000;
|
||||
|
@ -236,6 +236,8 @@ struct vo_frame {
|
||||
bool still;
|
||||
// Frames are output as fast as possible, with implied vsync blocking.
|
||||
bool display_synced;
|
||||
// Dropping the frame is allowed if the VO is behind.
|
||||
bool can_drop;
|
||||
// The current frame to be drawn.
|
||||
// Warning: When OSD should be redrawn in --force-window --idle mode, this
|
||||
// can be NULL. The VO should draw a black background, OSD on top.
|
||||
|
Loading…
Reference in New Issue
Block a user