Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dbus method SetLoop to switch looping on / off by dbus. #679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions KeyConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class KeyConfig
ACTION_PLAY = 36,
ACTION_CHANGE_FILE = 37,
ACTION_SET_LAYER = 38,
ACTION_SET_LOOP = 39,
};

#define KEY_LEFT 0x5b44
Expand Down
22 changes: 22 additions & 0 deletions OMXControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,28 @@ OMXControlResult OMXControl::handle_event(DBusMessage *m)
return OMXControlResult(KeyConfig::ACTION_SEEK_ABSOLUTE, position);
}
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "SetLoop"))
{
DBusError error;
dbus_error_init(&error);

bool should_loop;
dbus_message_get_args(m, &error, DBUS_TYPE_BOOLEAN, &should_loop, DBUS_TYPE_INVALID);

// Make sure a value is sent for setting layer
if (dbus_error_is_set(&error))
{
CLog::Log(LOGWARNING, "SetLoop D-Bus Error: %s", error.message );
dbus_error_free(&error);
dbus_respond_ok(m);
return KeyConfig::ACTION_BLANK;
}
else
{
dbus_respond_ok(m);
return OMXControlResult(KeyConfig::ACTION_SET_LOOP, should_loop);
}
}
else if (dbus_message_is_method_call(m, OMXPLAYER_DBUS_INTERFACE_PLAYER, "SetAlpha"))
{
DBusError error;
Expand Down
4 changes: 4 additions & 0 deletions dbuscontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ seek)
dbus-send --print-reply=literal --session --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Seek int64:$2 >/dev/null
;;

setloop)
dbus-send --print-reply=literal --session --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.SetLoop boolean:$2 >/dev/null
;;

setposition)
dbus-send --print-reply=literal --session --dest=org.mpris.MediaPlayer2.omxplayer /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.SetPosition objpath:/not/used int64:$2 >/dev/null
;;
Expand Down
3 changes: 3 additions & 0 deletions omxplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1447,6 +1447,9 @@ int main(int argc, char *argv[])
case KeyConfig::ACTION_SET_LAYER:
m_player_video.SetLayer(result.getArg());
break;
case KeyConfig::ACTION_SET_LOOP:
m_loop=result.getArg();
break;
case KeyConfig::ACTION_PLAY:
m_Pause=false;
if(m_has_subtitle)
Expand Down