linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] AVRCP: Metadata item #7 should return TrackDuration
@ 2011-08-25  0:14 David Stockwell
  2011-09-08 23:23 ` Lucas De Marchi
  0 siblings, 1 reply; 2+ messages in thread
From: David Stockwell @ 2011-08-25  0:14 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: lucas.demarchi, luiz.dentz, johan.hedberg

AVRCP: Metadata item #7 should return TrackDuration

Should be total playing time of the track (TrackDuration)
in msec, not current position within track.
---
 audio/control.c |   21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/audio/control.c b/audio/control.c
index be95c19..4aad67d 100644
--- a/audio/control.c
+++ b/audio/control.c
@@ -194,7 +194,8 @@ enum media_info_id {
 	MEDIA_INFO_TRACK =		4,
 	MEDIA_INFO_N_TRACKS =		5,
 	MEDIA_INFO_GENRE =		6,
-	MEDIA_INFO_CURRENT_POSITION =	7,
+	MEDIA_INFO_PLAYING_TIME =	7,
+	MEDIA_INFO_LAST,
 };
 
 static DBusConnection *connection = NULL;
@@ -928,19 +929,13 @@ static int mp_get_media_attribute(struct media_player 
*mp,
 		len = strlen(valstr);
 		memcpy(elem->val, valstr, len);
 		break;
-	case MEDIA_INFO_CURRENT_POSITION:
-		if (mi->elapsed != 0xFFFFFFFF) {
-			uint32_t elapsed;
-
-			mp_get_playback_status(mp, NULL, &elapsed, NULL);
-
-			snprintf(valstr, 20, "%u", elapsed);
-			len = strlen(valstr);
-			memcpy(elem->val, valstr, len);
-		} else {
+	case MEDIA_INFO_PLAYING_TIME:
+		if (mi->track_len == 0xFFFFFFFF)
 			return -ENOENT;
-		}
 
+		snprintf(valstr, 20, "%u", mi->track_len);
+		len = strlen(valstr);
+		memcpy(elem->val, valstr, len);
 		break;
 	default:
 		return -EINVAL;
@@ -1126,7 +1121,7 @@ static int avrcp_handle_get_element_attributes(struct 
control *control,
 		 * Return all available information, at least
 		 * title must be returned.
 		 */
-		for (i = 1; i <= MEDIA_INFO_CURRENT_POSITION; i++) {
+		for (i = 1; i < MEDIA_INFO_LAST; i++) {
 			size = mp_get_media_attribute(control->mp, i,
 							&pdu->params[pos]);
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] AVRCP: Metadata item #7 should return TrackDuration
  2011-08-25  0:14 [PATCH] AVRCP: Metadata item #7 should return TrackDuration David Stockwell
@ 2011-09-08 23:23 ` Lucas De Marchi
  0 siblings, 0 replies; 2+ messages in thread
From: Lucas De Marchi @ 2011-09-08 23:23 UTC (permalink / raw)
  To: David Stockwell; +Cc: linux-bluetooth, luiz.dentz, johan.hedberg

Hi David,

* David Stockwell <dstockwell@frequency-one.com> [2011-08-24 19:14:07 -0500]:

> AVRCP: Metadata item #7 should return TrackDuration
> 
> Should be total playing time of the track (TrackDuration)
> in msec, not current position within track.
> ---
>  audio/control.c |   21 ++++++++-------------
>  1 files changed, 8 insertions(+), 13 deletions(-)
> 
> diff --git a/audio/control.c b/audio/control.c
> index be95c19..4aad67d 100644
> --- a/audio/control.c
> +++ b/audio/control.c
> @@ -194,7 +194,8 @@ enum media_info_id {
>  	MEDIA_INFO_TRACK =		4,
>  	MEDIA_INFO_N_TRACKS =		5,
>  	MEDIA_INFO_GENRE =		6,
> -	MEDIA_INFO_CURRENT_POSITION =	7,
> +	MEDIA_INFO_PLAYING_TIME =	7,
> +	MEDIA_INFO_LAST,
>  };
>  
>  static DBusConnection *connection = NULL;
> @@ -928,19 +929,13 @@ static int mp_get_media_attribute(struct media_player 
> *mp,

Your email client is wrapping at 80 cols, so your patches cannot be
properly applied.

Consider using git-sent-email for sending patches, or fix your email
client. As far as I could see you are using Kmail. It can be fixed by
following Documentation/email-clients.txt in the kernel repository.

I rebased your patches on top of upstream, and sent to the mailing list
since I needed these changes applied to make some others. I kept
you as the author of the patches.


regards,
Lucas De Marchi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-09-08 23:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-25  0:14 [PATCH] AVRCP: Metadata item #7 should return TrackDuration David Stockwell
2011-09-08 23:23 ` Lucas De Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).