1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 08:12:17 +00:00

command: run OSD display code even if a property is unavailable

Trying to jump chapters in a gile that has no chapters does nothing,
not even show a warning. This is confusing. The reason is that the
"add chapter" command will just bail out completely if the property
is unavailable.

This was because it exited when it couldn't get the property type.
Instead of exiting, just don't enter the code that needs the type.

(I'm not sure when this behavior changed. I consider it a regression.
It was probably caused by changes to the chapter code, which perhaps
started returning UNAVAILABLE instead of OK if there are no chapters.)
This commit is contained in:
wm4 2014-08-08 23:53:11 +02:00
parent e0fb2a4f2d
commit 26d69758f6

View File

@ -3023,13 +3023,9 @@ static const struct property_osd_display {
static void show_property_osd(MPContext *mpctx, const char *pname, int osd_mode)
{
struct MPOpts *opts = mpctx->opts;
struct m_option prop = {0};
const struct property_osd_display *p;
const char *name = pname;
if (mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx) <= 0)
return;
int osd_progbar = 0;
const char *osd_name = NULL;
const char *msg = NULL;
@ -3074,6 +3070,8 @@ static void show_property_osd(MPContext *mpctx, const char *pname, int osd_mode)
if (!msg && osd_name)
msg = talloc_asprintf(tmp, "%s: ${%s}", osd_name, name);
struct m_option prop = {0};
mp_property_do(pname, M_PROPERTY_GET_TYPE, &prop, mpctx);
if (osd_progbar && (prop.flags & CONF_RANGE) == CONF_RANGE) {
bool ok = false;
if (prop.type == CONF_TYPE_INT) {