summaryrefslogtreecommitdiffstats
path: root/xbmc/network/dacp/dacp.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/network/dacp/dacp.cpp
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/network/dacp/dacp.cpp')
-rw-r--r--xbmc/network/dacp/dacp.cpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/xbmc/network/dacp/dacp.cpp b/xbmc/network/dacp/dacp.cpp
new file mode 100644
index 0000000..890d1f2
--- /dev/null
+++ b/xbmc/network/dacp/dacp.cpp
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2015-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "dacp.h"
+
+#include "filesystem/File.h"
+
+#define AIRTUNES_DACP_CMD_URI "ctrl-int/1/"
+
+// AirTunes related DACP implementation taken from http://nto.github.io/AirPlay.html#audio-remotecontrol
+
+CDACP::CDACP(const std::string &active_remote_header, const std::string &hostname, int port)
+{
+ m_dacpUrl.SetHostName(hostname);
+ m_dacpUrl.SetPort(port);
+ m_dacpUrl.SetProtocol("http");
+ m_dacpUrl.SetProtocolOption("Active-Remote", active_remote_header);
+}
+
+void CDACP::SendCmd(const std::string &cmd)
+{
+ m_dacpUrl.SetFileName(AIRTUNES_DACP_CMD_URI + cmd);
+ // issue the command
+ XFILE::CFile file;
+ file.Open(m_dacpUrl);
+ file.Write(NULL, 0);
+}
+
+void CDACP::BeginFwd()
+{
+ SendCmd("beginff");
+}
+
+void CDACP::BeginRewnd()
+{
+ SendCmd("beginrew");
+}
+
+void CDACP::ToggleMute()
+{
+ SendCmd("mutetoggle");
+}
+
+void CDACP::NextItem()
+{
+ SendCmd("nextitem");
+}
+
+void CDACP::PrevItem()
+{
+ SendCmd("previtem");
+}
+
+void CDACP::Pause()
+{
+ SendCmd("pause");
+}
+
+void CDACP::PlayPause()
+{
+ SendCmd("playpause");
+}
+
+void CDACP::Play()
+{
+ SendCmd("play");
+}
+
+void CDACP::Stop()
+{
+ SendCmd("stop");
+}
+
+void CDACP::PlayResume()
+{
+ SendCmd("playresume");
+}
+
+void CDACP::ShuffleSongs()
+{
+ SendCmd("shuffle_songs");
+}
+
+void CDACP::VolumeDown()
+{
+ SendCmd("volumedown");
+}
+
+void CDACP::VolumeUp()
+{
+ SendCmd("volumeup");
+}