Commit Graph

26 Commits

Author SHA1 Message Date
Lucas De Marchi
557a8ae858 Unregister players' events when disconnected 2011-10-22 12:18:28 +02:00
Frédéric Danis
4a4b56556f Fix implicit declaration of 'g_slist_free_full'
audio/avrcp.c: In function 'avrcp_unregister':
audio/avrcp.c:1253: error: implicit declaration of function 'g_slist_free_full'

thermometer/thermometer.c: In function 'destroy_char':
thermometer/thermometer.c:79: error: implicit declaration of function 'g_slist_free_full'
2011-10-18 13:23:47 +03:00
Lucas De Marchi
b3ba324261 AVRCP: Implement RequestContinuingResponse PDU 2011-10-18 10:25:50 +03:00
Lucas De Marchi
d888f54946 AVRCP: Implement AbortContinuingResponse PDU 2011-10-18 10:25:48 +03:00
Lucas De Marchi
464c36f7d8 AVRCP: respond with UINT32_MAX if duration is not available
Section 5.4.1 of AVRCP 1.3 spec says:

	If TG does not support SongLength And SongPosition on TG, then TG shall
	return 0xFFFFFFFF.

SongPosition is always available, but song length depends on user to
provied it.
2011-10-18 10:25:46 +03:00
Lucas De Marchi
2c920f6d68 AVRCP: implement TRACK-REACHED-START event 2011-10-18 10:25:43 +03:00
Lucas De Marchi
9ab125a8ec AVRCP: Use track's UID in event notification
When registering for TRACK_CHANGED event, CT expects the track's UID in
the INTERIM and CHANGED responses. According to AVRCP 1.3 spec, there
are only 2 possible values:
	1) 0: there's a track selected
	2) UINT32_MAX: there's no track selected

AVRCP 1.4 reserves the value UINT64_MAX for the second case. Since this
later value is the one used in certification process for best IOP
we return UINT64_MAX instead of the former.

This implementation allows to pass PTS test TP/NFY/BV-05-C.
2011-10-18 10:25:40 +03:00
Lucas De Marchi
a2a2db8167 Refactor to share code
Refactor code when we are 'listing selected attributes' to share code
with 'listing all attributes'. This way we always keep the list of
attributes in a GList, and call player_get_media_attribute() in only one
place.
2011-10-13 13:10:45 +03:00
Lucas De Marchi
c8265ec286 AVRCP: Only return available metadata attributes
When remote side requests all available metadata (i.e. it gives number
attributes equals to 0) do not return zero-length strings for
unavailable items. The only exception is title, that must be always present.
2011-10-13 13:10:13 +03:00
Lucas De Marchi
7cddeb379d AVRCP: Check if len matches number of IDs
If number of attributes remote side provided is larger than the length
we read, we would read garbage from stack memory.
2011-10-13 13:09:25 +03:00
Lucas De Marchi
28b3057757 AVRCP: Return error for invalid metadata IDs 2011-10-13 13:08:58 +03:00
Lucas De Marchi
c0cc10498d AVRCP: Do not list values for unsupported attributes 2011-10-13 13:06:39 +03:00
Lucas De Marchi
2932dbeeb3 Move debug messages to their correspondent getters 2011-10-13 13:05:54 +03:00
Lucas De Marchi
b6379821a6 AVRCP: fix loop over number of application settings 2011-10-06 15:35:35 +03:00
Luiz Augusto von Dentz
14ae307458 AVRCP: move MediaPlayer to adapter object
This move the MediaPlayer registration to adapter object on Media
interface so we can track players properly.
2011-10-06 11:13:28 +03:00
Lucas De Marchi
4d3bb39485 AVRCP: fix missing bytes on notification 2011-10-03 16:14:12 +03:00
Lucas De Marchi
4364aa411d AVRCP: fix changed notification
We sure want to send notifications only when section is not NULL.
Otherwise we either crash or do not send the expected notification.
2011-10-02 18:52:05 +03:00
Lucas De Marchi
8ebb3c79e1 AVRCP: fix case when only one setting is provided
If CT tries to change an Application Setting providing only one
setting, the size of the PDU will be 3 bytes. Therefore we should check
if the PDU is shorter than or equal 3, not only shorter.
2011-10-02 18:48:06 +03:00
Lucas De Marchi
138f831787 AVRCP: return empty string instead of rejecting
If media attribute is not available for a certain media file, return an
empty string instead of rejecting the request. The spec is not so clear
if only the title should be handled as an empty string when not present,
but this is the only alternative to rejecting the request.

IOP tests showed that some CT devices don't like reject messages: they
never ask for an attribute again if they previously received a REJECTED
message for that attribute. They consider REJECTED as "TG doesn't
implement it these optional attributes" as opposed to what we had
before, "this attribute is currently not available".
2011-10-02 18:47:58 +03:00
Lucas De Marchi
6d0ec74904 AVRCP: limit AVRCP packet size to the MTU of AV/C
AVRCP is an extension of AV/C spec which has a limit of 512 bytes. The
only place where it can exceed this value is in the response to
GetElementAttributes command.

Now we simply don't add the attributes that would overflow the available
buffer space.
2011-09-27 13:11:35 +03:00
David Stockwell
4dc449c1e3 avrcp: get/set three-byte company-id 2011-09-16 11:32:12 +03:00
David Stockwell
232ba15531 avrcp: fix handling of metadata item 0x7
Metadata field number 0x7 should be the total playing time of the track
(TrackDuration) in msec, not current position within track.
2011-09-16 11:32:10 +03:00
David Stockwell
b0de2a7bc2 avrcp: use LAST element on media_info_id enum 2011-09-16 11:32:08 +03:00
Lucas De Marchi
f2ac0034a0 avrcp: fix overwrite of number of attributes
The response of GetCurrentPlayerApplicationSettingValue expects the
first operand to be the number of attributes in response. Since we start
with len=0, we were overwriting this number with the value of the first
attribute.

Also use g_memdup instead of g_malloc + memcpy.
2011-09-16 11:32:06 +03:00
Lucas De Marchi
66b9d4c7a0 avrcp: fix missing error code 2011-09-16 11:32:04 +03:00
Luiz Augusto von Dentz
99f32ae9ac AVRCP: move handling of vendor dependent PDU from control.c to avrcp.c
This helps to isolate AVRCP PDU handling and MediaPlayer interface.
2011-09-13 10:44:56 +03:00