mirror of
https://github.com/mpv-player/mpv
synced 2024-10-30 04:46:41 +01:00
Print a ANS_ERROR reply if one of the *_property slave command fails.
Based on patch by Adrian Stutz [adrian sttz ch]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30119 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
3241bdffd6
commit
6838445737
27
command.c
27
command.c
@ -2327,6 +2327,23 @@ static const struct {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const char *property_error_string(int error_value)
|
||||||
|
{
|
||||||
|
switch (error_value) {
|
||||||
|
case M_PROPERTY_ERROR:
|
||||||
|
return "ERROR";
|
||||||
|
case M_PROPERTY_UNAVAILABLE:
|
||||||
|
return "PROPERTY_UNAVAILABLE";
|
||||||
|
case M_PROPERTY_NOT_IMPLEMENTED:
|
||||||
|
return "NOT_IMPLEMENTED";
|
||||||
|
case M_PROPERTY_UNKNOWN:
|
||||||
|
return "PROPERTY_UNKNOWN";
|
||||||
|
case M_PROPERTY_DISABLED:
|
||||||
|
return "DISABLED";
|
||||||
|
}
|
||||||
|
return "UNKNOWN";
|
||||||
|
}
|
||||||
|
|
||||||
int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
||||||
{
|
{
|
||||||
sh_audio_t * const sh_audio = mpctx->sh_audio;
|
sh_audio_t * const sh_audio = mpctx->sh_audio;
|
||||||
@ -2370,6 +2387,8 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
|||||||
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
||||||
"Failed to set property '%s' to '%s'.\n",
|
"Failed to set property '%s' to '%s'.\n",
|
||||||
cmd->args[0].v.s, cmd->args[1].v.s);
|
cmd->args[0].v.s, cmd->args[1].v.s);
|
||||||
|
if (r <= 0)
|
||||||
|
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", property_error_string(r));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2411,16 +2430,20 @@ int run_command(MPContext * mpctx, mp_cmd_t * cmd)
|
|||||||
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
||||||
"Failed to increment property '%s' by %f.\n",
|
"Failed to increment property '%s' by %f.\n",
|
||||||
cmd->args[0].v.s, cmd->args[1].v.f);
|
cmd->args[0].v.s, cmd->args[1].v.f);
|
||||||
|
if (r <= 0)
|
||||||
|
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", property_error_string(r));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MP_CMD_GET_PROPERTY:{
|
case MP_CMD_GET_PROPERTY:{
|
||||||
char *tmp;
|
char *tmp;
|
||||||
if (mp_property_do(cmd->args[0].v.s, M_PROPERTY_TO_STRING,
|
int r = mp_property_do(cmd->args[0].v.s, M_PROPERTY_TO_STRING,
|
||||||
&tmp, mpctx) <= 0) {
|
&tmp, mpctx);
|
||||||
|
if (r <= 0) {
|
||||||
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
mp_msg(MSGT_CPLAYER, MSGL_WARN,
|
||||||
"Failed to get value of property '%s'.\n",
|
"Failed to get value of property '%s'.\n",
|
||||||
cmd->args[0].v.s);
|
cmd->args[0].v.s);
|
||||||
|
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_ERROR=%s\n", property_error_string(r));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_%s=%s\n",
|
mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_%s=%s\n",
|
||||||
|
Loading…
Reference in New Issue
Block a user