Skip to content

Commit

Permalink
Revert "Updated mpv parameters volume, mute -> ao-volume, ao-mute"
Browse files Browse the repository at this point in the history
This reverts commit 10dd372.
Fixes #293
  • Loading branch information
u8sand committed May 27, 2020
1 parent 2cb9c55 commit 4defb63
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/mpvhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ MpvHandler::MpvHandler(int64_t wid, QObject *parent):

// get updates when these properties change
mpv_observe_property(mpv, 0, "playback-time", MPV_FORMAT_DOUBLE);
mpv_observe_property(mpv, 0, "ao-volume", MPV_FORMAT_DOUBLE);
mpv_observe_property(mpv, 0, "volume", MPV_FORMAT_DOUBLE);
mpv_observe_property(mpv, 0, "sid", MPV_FORMAT_INT64);
mpv_observe_property(mpv, 0, "aid", MPV_FORMAT_INT64);
mpv_observe_property(mpv, 0, "sub-visibility", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "ao-mute", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "mute", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "core-idle", MPV_FORMAT_FLAG);
mpv_observe_property(mpv, 0, "paused-for-cache", MPV_FORMAT_FLAG);

Expand Down Expand Up @@ -156,7 +156,7 @@ bool MpvHandler::event(QEvent *event)
lastTime = time;
}
}
else if(QString(prop->name) == "ao-volume")
else if(QString(prop->name) == "volume")
{
if(prop->format == MPV_FORMAT_DOUBLE)
setVolume((int)*(double*)prop->data);
Expand All @@ -176,7 +176,7 @@ bool MpvHandler::event(QEvent *event)
if(prop->format == MPV_FORMAT_FLAG)
setSubtitleVisibility((bool)*(unsigned*)prop->data);
}
else if(QString(prop->name) == "ao-mute")
else if(QString(prop->name) == "mute")
{
if(prop->format == MPV_FORMAT_FLAG)
setMute((bool)*(unsigned*)prop->data);
Expand Down Expand Up @@ -418,7 +418,7 @@ void MpvHandler::Mute(bool m)
{
if(playState > 0)
{
const char *args[] = {"set", "ao-mute", m ? "yes" : "no", NULL};
const char *args[] = {"set", "mute", m ? "yes" : "no", NULL};
AsyncCommand(args);
}
else
Expand Down Expand Up @@ -503,12 +503,11 @@ void MpvHandler::Volume(int level, bool osd)
{
if(level > 100) level = 100;
else if(level < 0) level = 0;

double v = level;

if(playState > 0)
{
mpv_set_property_async(mpv, MPV_REPLY_PROPERTY, "ao-volume", MPV_FORMAT_DOUBLE, &v);
mpv_set_property_async(mpv, MPV_REPLY_PROPERTY, "volume", MPV_FORMAT_DOUBLE, &v);
if(osd)
ShowText(tr("Volume: %0%").arg(QString::number(level)));
}
Expand Down

0 comments on commit 4defb63

Please sign in to comment.