command: wait until MPV_EVENT_VIDEO_RECONFIG to pretty print hwdec
It's not actually possible to truly know the hwdec-current value until after this event is successfully signalled. Add some special handling to the pretty printing of hwdec to delay it until we get the video reconfig event in command_event and then do the pretty print there if appropriate.
This commit is contained in:
1 parent
f2ef360444
commit
0fee7c1b37
1 file changed
+14
@@ -118,6 +118,8 @@ struct command_ctx {
|
||||
mpv_node udata;
|
||||
mpv_node mdata;
|
||||
|
||||
int hwdec_osd_mode;
|
||||
|
||||
double cached_window_scale;
|
||||
};
|
||||
|
||||
@@ -4747,10 +4749,17 @@ static void show_property_osd(MPContext *mpctx, const char *name, int osd_mode)
|
||||
{
|
||||
struct MPOpts *opts = mpctx->opts;
|
||||
struct property_osd_display disp = {.name = name, .osd_name = name};
|
||||
struct command_ctx *cmd = mpctx->command_ctx;
|
||||
|
||||
if (!osd_mode)
|
||||
return;
|
||||
|
||||
// hwdec is a special case that must wait until video reconfig
|
||||
if (strcmp(name, "hwdec") == 0 && !cmd->hwdec_osd_mode) {
|
||||
cmd->hwdec_osd_mode = osd_mode;
|
||||
return;
|
||||
}
|
||||
|
||||
// look for the command
|
||||
for (const struct property_osd_display *p = property_osd_display; p->name; p++)
|
||||
{
|
||||
@@ -7593,6 +7602,11 @@ static void command_event(struct MPContext *mpctx, int event, void *arg)
|
||||
run_command_opts(mpctx);
|
||||
}
|
||||
|
||||
if (event == MPV_EVENT_VIDEO_RECONFIG && ctx->hwdec_osd_mode) {
|
||||
show_property_osd(mpctx, "hwdec", ctx->hwdec_osd_mode);
|
||||
ctx->hwdec_osd_mode = 0;
|
||||
}
|
||||
|
||||
if (event == MPV_EVENT_IDLE)
|
||||
run_command_opts(mpctx);
|
||||
|
||||
|
||||
Reference in new issue
Block a user