* [PATCH 1/2] test: Add sample media player properties
@ 2015-08-20 9:03 Bharat Panda
2015-08-20 9:03 ` [PATCH 2/2] audio/avrcp: Set Media Player Properties Bharat Panda
2015-08-20 12:48 ` [PATCH 1/2] test: Add sample media player properties Luiz Augusto von Dentz
0 siblings, 2 replies; 6+ messages in thread
From: Bharat Panda @ 2015-08-20 9:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: cpgs, Bharat Panda
Polulates media player properties with player name, type,
sub-type and features with sample values.
---
test/simple-player | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/test/simple-player b/test/simple-player
index a8ae0b1..a89767a 100755
--- a/test/simple-player
+++ b/test/simple-player
@@ -43,6 +43,10 @@ class Player(dbus.service.Object):
self.properties = dbus.Dictionary({
"PlaybackStatus" : "playing",
+ "DisplayName" : "SimplePlayer",
+ "Type" : "Audio",
+ "SubType" : "Audio Book",
+ "Features" : "0000000000b701ef0200000000000000",
"LoopStatus" : "None",
"Rate" : dbus.Double(1.0),
"Shuffle" : dbus.Boolean(False),
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] audio/avrcp: Set Media Player Properties
2015-08-20 9:03 [PATCH 1/2] test: Add sample media player properties Bharat Panda
@ 2015-08-20 9:03 ` Bharat Panda
2015-08-26 10:40 ` Luiz Augusto von Dentz
2015-08-20 12:48 ` [PATCH 1/2] test: Add sample media player properties Luiz Augusto von Dentz
1 sibling, 1 reply; 6+ messages in thread
From: Bharat Panda @ 2015-08-20 9:03 UTC (permalink / raw)
To: linux-bluetooth; +Cc: cpgs, Bharat Panda
Add methods to set missing media player properties value, like
player name, type, sub-type and features.
---
profiles/audio/media.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 81 insertions(+)
diff --git a/profiles/audio/media.c b/profiles/audio/media.c
index ed441d0..f55ecc1 100644
--- a/profiles/audio/media.c
+++ b/profiles/audio/media.c
@@ -112,6 +112,10 @@ struct media_player {
bool next;
bool previous;
bool control;
+ char *name;
+ char *type;
+ char *subtype;
+ unsigned int features[16];
};
static GSList *adapters = NULL;
@@ -1607,6 +1611,71 @@ static gboolean set_flag(struct media_player *mp, DBusMessageIter *iter,
return TRUE;
}
+static gboolean set_name(struct media_player *mp, DBusMessageIter *iter)
+{
+ const char *value;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ dbus_message_iter_get_basic(iter, &value);
+
+ if (g_strcmp0(mp->name, value) == 0)
+ return TRUE;
+
+ mp->name = g_strdup(value);
+
+ return TRUE;
+}
+
+static gboolean set_type(struct media_player *mp, DBusMessageIter *iter)
+{
+ const char *value;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ dbus_message_iter_get_basic(iter, &value);
+
+ mp->type = g_strdup(value);
+
+ return TRUE;
+}
+
+static gboolean set_features(struct media_player *mp, DBusMessageIter *iter)
+{
+ const char *value;
+ uint8_t i = 0;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ dbus_message_iter_get_basic(iter, &value);
+
+ memset(&mp->features, 0x00, 16);
+
+ while ((i < (strlen(value)/2))) {
+ sscanf(value+(2*i), "%02x", &mp->features[i]);
+ i++;
+ }
+
+ return TRUE;
+}
+
+static gboolean set_subtype(struct media_player *mp, DBusMessageIter *iter)
+{
+ const char *value;
+
+ if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
+ return FALSE;
+
+ dbus_message_iter_get_basic(iter, &value);
+
+ mp->subtype = g_strdup(value);
+
+ return TRUE;
+}
+
static gboolean set_player_property(struct media_player *mp, const char *key,
DBusMessageIter *entry)
{
@@ -1647,6 +1716,18 @@ static gboolean set_player_property(struct media_player *mp, const char *key,
if (strcasecmp(key, "CanControl") == 0)
return set_flag(mp, &var, &mp->control);
+ if (strcasecmp(key, "DisplayName") == 0)
+ return set_name(mp, &var);
+
+ if (strcasecmp(key, "Type") == 0)
+ return set_type(mp, &var);
+
+ if (strcasecmp(key, "SubType") == 0)
+ return set_subtype(mp, &var);
+
+ if (strcasecmp(key, "Features") == 0)
+ return set_features(mp, &var);
+
DBG("%s not supported, ignoring", key);
return TRUE;
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] test: Add sample media player properties
2015-08-20 9:03 [PATCH 1/2] test: Add sample media player properties Bharat Panda
2015-08-20 9:03 ` [PATCH 2/2] audio/avrcp: Set Media Player Properties Bharat Panda
@ 2015-08-20 12:48 ` Luiz Augusto von Dentz
2015-08-20 13:01 ` Bharat Bhusan Panda
1 sibling, 1 reply; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2015-08-20 12:48 UTC (permalink / raw)
To: Bharat Panda; +Cc: linux-bluetooth@vger.kernel.org, cpgs
Hi Bharat,
On Thu, Aug 20, 2015 at 12:03 PM, Bharat Panda <bharat.panda@samsung.com> wrote:
> Polulates media player properties with player name, type,
> sub-type and features with sample values.
> ---
> test/simple-player | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/test/simple-player b/test/simple-player
> index a8ae0b1..a89767a 100755
> --- a/test/simple-player
> +++ b/test/simple-player
> @@ -43,6 +43,10 @@ class Player(dbus.service.Object):
>
> self.properties = dbus.Dictionary({
> "PlaybackStatus" : "playing",
> + "DisplayName" : "SimplePlayer",
> + "Type" : "Audio",
> + "SubType" : "Audio Book",
> + "Features" : "0000000000b701ef0200000000000000",
> "LoopStatus" : "None",
> "Rate" : dbus.Double(1.0),
> "Shuffle" : dbus.Boolean(False),
> --
> 1.9.1
This properties do not exist in MPRIS
http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html,
for DisplayName you can probably use Identity but for other we might
have to infer based on the available MPRIS properties.
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH 1/2] test: Add sample media player properties
2015-08-20 12:48 ` [PATCH 1/2] test: Add sample media player properties Luiz Augusto von Dentz
@ 2015-08-20 13:01 ` Bharat Bhusan Panda
2015-08-20 13:23 ` Luiz Augusto von Dentz
0 siblings, 1 reply; 6+ messages in thread
From: Bharat Bhusan Panda @ 2015-08-20 13:01 UTC (permalink / raw)
To: 'Luiz Augusto von Dentz'; +Cc: linux-bluetooth, cpgs
Hi Luiz,
> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Thursday, August 20, 2015 6:19 PM
> To: Bharat Panda
> Cc: linux-bluetooth@vger.kernel.org; cpgs@samsung.com
> Subject: Re: [PATCH 1/2] test: Add sample media player properties
>
> Hi Bharat,
>
> On Thu, Aug 20, 2015 at 12:03 PM, Bharat Panda
> <bharat.panda@samsung.com> wrote:
> > Polulates media player properties with player name, type, sub-type and
> > features with sample values.
> > ---
> > test/simple-player | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/test/simple-player b/test/simple-player index
> > a8ae0b1..a89767a 100755
> > --- a/test/simple-player
> > +++ b/test/simple-player
> > @@ -43,6 +43,10 @@ class Player(dbus.service.Object):
> >
> > self.properties = dbus.Dictionary({
> > "PlaybackStatus" : "playing",
> > + "DisplayName" : "SimplePlayer",
> > + "Type" : "Audio",
> > + "SubType" : "Audio Book",
> > + "Features" :
> > + "0000000000b701ef0200000000000000",
> > "LoopStatus" : "None",
> > "Rate" : dbus.Double(1.0),
> > "Shuffle" :
> > dbus.Boolean(False),
> > --
> > 1.9.1
>
> This properties do not exist in MPRIS
> http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html,
> for DisplayName you can probably use Identity but for other we might have
> to infer based on the available MPRIS properties.
So except DisplayName, others(type, sub-type and features) will be inferred. How about building response for GetFolderItems, as it needs all these player properties to be filled in response PDU? What shall be filled in there?
>
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
>
> --
> Luiz Augusto von Dentz
Regards,
Bharat
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] test: Add sample media player properties
2015-08-20 13:01 ` Bharat Bhusan Panda
@ 2015-08-20 13:23 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2015-08-20 13:23 UTC (permalink / raw)
To: Bharat Bhusan Panda; +Cc: linux-bluetooth@vger.kernel.org, cpgs
Hi Bharat,
On Thu, Aug 20, 2015 at 4:01 PM, Bharat Bhusan Panda
<bharat.panda@samsung.com> wrote:
> Hi Luiz,
>
>> -----Original Message-----
>> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
>> Sent: Thursday, August 20, 2015 6:19 PM
>> To: Bharat Panda
>> Cc: linux-bluetooth@vger.kernel.org; cpgs@samsung.com
>> Subject: Re: [PATCH 1/2] test: Add sample media player properties
>>
>> Hi Bharat,
>>
>> On Thu, Aug 20, 2015 at 12:03 PM, Bharat Panda
>> <bharat.panda@samsung.com> wrote:
>> > Polulates media player properties with player name, type, sub-type and
>> > features with sample values.
>> > ---
>> > test/simple-player | 4 ++++
>> > 1 file changed, 4 insertions(+)
>> >
>> > diff --git a/test/simple-player b/test/simple-player index
>> > a8ae0b1..a89767a 100755
>> > --- a/test/simple-player
>> > +++ b/test/simple-player
>> > @@ -43,6 +43,10 @@ class Player(dbus.service.Object):
>> >
>> > self.properties = dbus.Dictionary({
>> > "PlaybackStatus" : "playing",
>> > + "DisplayName" : "SimplePlayer",
>> > + "Type" : "Audio",
>> > + "SubType" : "Audio Book",
>> > + "Features" :
>> > + "0000000000b701ef0200000000000000",
>> > "LoopStatus" : "None",
>> > "Rate" : dbus.Double(1.0),
>> > "Shuffle" :
>> > dbus.Boolean(False),
>> > --
>> > 1.9.1
>>
>> This properties do not exist in MPRIS
>> http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html,
>> for DisplayName you can probably use Identity but for other we might have
>> to infer based on the available MPRIS properties.
> So except DisplayName, others(type, sub-type and features) will be inferred. How about building response for GetFolderItems, as it needs all these player properties to be filled in response PDU? What shall be filled in there?
For type and sub-type we could perhaps look at SupportedMimeTypes, we
can assume it is at least audio type. For features there are some
indication already what the player support in terms of key presses,
etc and if NowPlaying is support with
http://specifications.freedesktop.org/mpris-spec/latest/Media_Player.html#Property:HasTrackList.
>>
>> >
>> > --
>> > To unsubscribe from this list: send the line "unsubscribe
>> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
>> > More majordomo info at http://vger.kernel.org/majordomo-info.html
>>
>>
>>
>> --
>> Luiz Augusto von Dentz
>
> Regards,
> Bharat
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] audio/avrcp: Set Media Player Properties
2015-08-20 9:03 ` [PATCH 2/2] audio/avrcp: Set Media Player Properties Bharat Panda
@ 2015-08-26 10:40 ` Luiz Augusto von Dentz
0 siblings, 0 replies; 6+ messages in thread
From: Luiz Augusto von Dentz @ 2015-08-26 10:40 UTC (permalink / raw)
To: Bharat Panda; +Cc: linux-bluetooth@vger.kernel.org, cpgs
Hi Bharat,
On Thu, Aug 20, 2015 at 12:03 PM, Bharat Panda <bharat.panda@samsung.com> wrote:
> Add methods to set missing media player properties value, like
> player name, type, sub-type and features.
> ---
> profiles/audio/media.c | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 81 insertions(+)
>
> diff --git a/profiles/audio/media.c b/profiles/audio/media.c
> index ed441d0..f55ecc1 100644
> --- a/profiles/audio/media.c
> +++ b/profiles/audio/media.c
> @@ -112,6 +112,10 @@ struct media_player {
> bool next;
> bool previous;
> bool control;
> + char *name;
> + char *type;
> + char *subtype;
> + unsigned int features[16];
> };
To start with I would like to just have the passed to, for the rest we
can assume some values and disable all the features that require the
browsing command.
> static GSList *adapters = NULL;
> @@ -1607,6 +1611,71 @@ static gboolean set_flag(struct media_player *mp, DBusMessageIter *iter,
> return TRUE;
> }
>
> +static gboolean set_name(struct media_player *mp, DBusMessageIter *iter)
> +{
> + const char *value;
> +
> + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
> + return FALSE;
> +
> + dbus_message_iter_get_basic(iter, &value);
> +
> + if (g_strcmp0(mp->name, value) == 0)
> + return TRUE;
> +
> + mp->name = g_strdup(value);
> +
> + return TRUE;
> +}
> +
> +static gboolean set_type(struct media_player *mp, DBusMessageIter *iter)
> +{
> + const char *value;
> +
> + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
> + return FALSE;
> +
> + dbus_message_iter_get_basic(iter, &value);
> +
> + mp->type = g_strdup(value);
> +
> + return TRUE;
> +}
> +
> +static gboolean set_features(struct media_player *mp, DBusMessageIter *iter)
> +{
> + const char *value;
> + uint8_t i = 0;
> +
> + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
> + return FALSE;
> +
> + dbus_message_iter_get_basic(iter, &value);
> +
> + memset(&mp->features, 0x00, 16);
> +
> + while ((i < (strlen(value)/2))) {
> + sscanf(value+(2*i), "%02x", &mp->features[i]);
> + i++;
> + }
> +
> + return TRUE;
> +}
> +
> +static gboolean set_subtype(struct media_player *mp, DBusMessageIter *iter)
> +{
> + const char *value;
> +
> + if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_STRING)
> + return FALSE;
> +
> + dbus_message_iter_get_basic(iter, &value);
> +
> + mp->subtype = g_strdup(value);
> +
> + return TRUE;
> +}
> +
> static gboolean set_player_property(struct media_player *mp, const char *key,
> DBusMessageIter *entry)
> {
> @@ -1647,6 +1716,18 @@ static gboolean set_player_property(struct media_player *mp, const char *key,
> if (strcasecmp(key, "CanControl") == 0)
> return set_flag(mp, &var, &mp->control);
>
> + if (strcasecmp(key, "DisplayName") == 0)
> + return set_name(mp, &var);
> +
> + if (strcasecmp(key, "Type") == 0)
> + return set_type(mp, &var);
> +
> + if (strcasecmp(key, "SubType") == 0)
> + return set_subtype(mp, &var);
> +
> + if (strcasecmp(key, "Features") == 0)
> + return set_features(mp, &var);
> +
> DBG("%s not supported, ignoring", key);
>
> return TRUE;
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-08-26 10:40 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-20 9:03 [PATCH 1/2] test: Add sample media player properties Bharat Panda
2015-08-20 9:03 ` [PATCH 2/2] audio/avrcp: Set Media Player Properties Bharat Panda
2015-08-26 10:40 ` Luiz Augusto von Dentz
2015-08-20 12:48 ` [PATCH 1/2] test: Add sample media player properties Luiz Augusto von Dentz
2015-08-20 13:01 ` Bharat Bhusan Panda
2015-08-20 13:23 ` Luiz Augusto von Dentz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox