Skip to content

Commit

Permalink
Bug 1353652 - Initial Draft of MPRIS API Provider (Media API on Linux…
Browse files Browse the repository at this point in the history
…) r=alwu

Differential Revision: https://phabricator.services.mozilla.com/D47999

--HG--
extra : moz-landing-system : lando
  • Loading branch information
MeFisto94 committed Feb 12, 2020
1 parent 2731ff1 commit 1eb3d68
Show file tree
Hide file tree
Showing 6 changed files with 936 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ tools/clang-tidy/test/.*
# We are testing the incorrect formatting.
tools/lint/test/files/file-whitespace/

# Contains an XML definition and formatting would break the layout
widget/gtk/MPRISInterfaceDescription.h

# The XPTCall stubs files have some inline assembly macros
# that get reformatted badly. See bug 1510781.
xpcom/reflect/xptcall/md/win32/.*
Expand Down
115 changes: 115 additions & 0 deletions widget/gtk/MPRISInterfaceDescription.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef WIDGET_GTK_MPRIS_INTERFACE_DESCRIPTION_H_
#define WIDGET_GTK_MPRIS_INTERFACE_DESCRIPTION_H_

#include <gio/gio.h>

extern const gchar introspection_xml[] =
// adopted from https://github.com/freedesktop/mpris-spec/blob/master/spec/org.mpris.MediaPlayer2.xml
// everything starting with tp can be removed, as it is used for HTML Spec Documentation Generation
"<node>"
"<interface name=\"org.mpris.MediaPlayer2\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"<method name=\"Raise\"/>"
"<method name=\"Quit\"/>"
"<property name=\"CanQuit\" type=\"b\" access=\"read\"/>"
#ifdef MPRIS_FULLSCREEN
"<property name=\"Fullscreen\" type=\"b\" access=\"readwrite\">"
"<annotation name=\"org.mpris.MediaPlayer2.property.optional\" value=\"true\"/>"
"</property>"
"<property name=\"CanSetFullscreen\" type=\"b\" access=\"read\">"
"<annotation name=\"org.mpris.MediaPlayer2.property.optional\" value=\"true\"/>"
"</property>"
#endif
"<property name=\"CanRaise\" type=\"b\" access=\"read\"/>"
"<property name=\"HasTrackList\" type=\"b\" access=\"read\"/>"
"<property name=\"Identity\" type=\"s\" access=\"read\"/>"
#ifdef MPRIS_DESKTOP_ENTRY
"<property name=\"DesktopEntry\" type=\"s\" access=\"read\">"
"<annotation name=\"org.mpris.MediaPlayer2.property.optional\" value=\"true\"/>"
"</property>"
#endif
"<property name=\"SupportedUriSchemes\" type=\"as\" access=\"read\"/>"
"<property name=\"SupportedMimeTypes\" type=\"as\" access=\"read\"/>"
"</interface>"
// Note that every property emits a changed signal (which is default) apart from Position.
"<interface name=\"org.mpris.MediaPlayer2.Player\">"
"<method name=\"Next\"/>"
"<method name=\"Previous\"/>"
"<method name=\"Pause\"/>"
"<method name=\"PlayPause\"/>"
"<method name=\"Stop\"/>"
"<method name=\"Play\"/>"
"<method name=\"Seek\">"
"<arg direction=\"in\" type=\"x\" name=\"Offset\"/>"
"</method>"
"<method name=\"SetPosition\">"
"<arg direction=\"in\" type=\"o\" name=\"TrackId\"/>"
"<arg direction=\"in\" type=\"x\" name=\"Position\"/>"
"</method>"
"<method name=\"OpenUri\">"
"<arg direction=\"in\" type=\"s\" name=\"Uri\"/>"
"</method>"
"<property name=\"PlaybackStatus\" type=\"s\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
#ifdef MPRIS_LOOP_STATUS
"<property name=\"LoopStatus\" type=\"s\" access=\"readwrite\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"<annotation name=\"org.mpris.MediaPlayer2.property.optional\" value=\"true\"/>"
"</property>"
#endif
"<property name=\"Rate\" type=\"d\" access=\"readwrite\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
#ifdef MRPIS_SHUFFLE
"<property name=\"Shuffle\" type=\"b\" access=\"readwrite\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"<annotation name=\"org.mpris.MediaPlayer2.property.optional\" value=\"true\"/>"
"</property>"
#endif
"<property name=\"Metadata\" type=\"a{sv}\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"Volume\" type=\"d\" access=\"readwrite\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"Position\" type=\"x\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>"
"</property>"
"<property name=\"MinimumRate\" type=\"d\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"MaximumRate\" type=\"d\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanGoNext\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanGoPrevious\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanPlay\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanPause\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanSeek\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"true\"/>"
"</property>"
"<property name=\"CanControl\" type=\"b\" access=\"read\">"
"<annotation name=\"org.freedesktop.DBus.Property.EmitsChangedSignal\" value=\"false\"/>"
"</property>"
"<signal name=\"Seeked\">"
"<arg name=\"Position\" type=\"x\"/>"
"</signal>"
"</interface>"
"</node>";

#endif // WIDGET_GTK_MPRIS_INTERFACE_DESCRIPTION_H_
Loading

0 comments on commit 1eb3d68

Please sign in to comment.