diff mbox series

[BlueZ,3/7] player: Add image handle support property

Message ID 20240904140421.283166-4-frederic.danis@collabora.com (mailing list archive)
State Superseded
Headers show
Series Add BIP for AVRCP covert art OBEX client | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/CheckPatch success CheckPatch PASS
tedd_an/GitLint success Gitlint PASS
tedd_an/IncrementalBuild success Incremental Build PASS

Commit Message

Frédéric Danis Sept. 4, 2024, 2:04 p.m. UTC
This is part of the metadata when the AVRCP target supports covert
art download and a OBEX BIP session is connected.
The image handle references the cover art associated to the track,
and is valid only during OBEX BIP session.
---
 doc/org.bluez.MediaPlayer.rst | 4 ++++
 monitor/avctp.c               | 3 +++
 profiles/audio/avrcp.c        | 7 ++++++-
 profiles/audio/avrcp.h        | 3 ++-
 tools/parser/avrcp.c          | 3 +++
 5 files changed, 18 insertions(+), 2 deletions(-)

Comments

Luiz Augusto von Dentz Sept. 4, 2024, 3:07 p.m. UTC | #1
Hi Frédéric,

On Wed, Sep 4, 2024 at 10:04 AM Frédéric Danis
<frederic.danis@collabora.com> wrote:
>
> This is part of the metadata when the AVRCP target supports covert
> art download and a OBEX BIP session is connected.
> The image handle references the cover art associated to the track,
> and is valid only during OBEX BIP session.
> ---
>  doc/org.bluez.MediaPlayer.rst | 4 ++++
>  monitor/avctp.c               | 3 +++
>  profiles/audio/avrcp.c        | 7 ++++++-
>  profiles/audio/avrcp.h        | 3 ++-
>  tools/parser/avrcp.c          | 3 +++
>  5 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/doc/org.bluez.MediaPlayer.rst b/doc/org.bluez.MediaPlayer.rst
> index f1e999bdf..5bb38e7c2 100644
> --- a/doc/org.bluez.MediaPlayer.rst
> +++ b/doc/org.bluez.MediaPlayer.rst
> @@ -237,6 +237,10 @@ dict Track [readonly]
>
>                 Track duration in milliseconds
>
> +       :string ImgHandle:
> +
> +               Track image handle

I guess we want something more descriptive here, as ThumbnailURL or
something .e.g obex://<handle>, that said I don't know if perhaps we
could load it automatically via plugin.

>  object Device [readonly]
>  ````````````````````````
>
> diff --git a/monitor/avctp.c b/monitor/avctp.c
> index c59e93b20..4da448750 100644
> --- a/monitor/avctp.c
> +++ b/monitor/avctp.c
> @@ -156,6 +156,7 @@
>  #define AVRCP_MEDIA_ATTRIBUTE_TOTAL    0x05
>  #define AVRCP_MEDIA_ATTRIBUTE_GENRE    0x06
>  #define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07
> +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE       0x08
>
>  /* play status */
>  #define AVRCP_PLAY_STATUS_STOPPED      0x00
> @@ -582,6 +583,8 @@ static const char *mediattr2str(uint32_t attr)
>                 return "Genre";
>         case AVRCP_MEDIA_ATTRIBUTE_DURATION:
>                 return "Track duration";
> +       case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
> +               return "Imaging handle";
>         default:
>                 return "Reserved";
>         }
> diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
> index 61558e492..fe24b5a92 100644
> --- a/profiles/audio/avrcp.c
> +++ b/profiles/audio/avrcp.c
> @@ -417,7 +417,8 @@ static sdp_record_t *avrcp_ct_record(bool browsing)
>         uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
>                                                 AVRCP_FEATURE_CATEGORY_2 |
>                                                 AVRCP_FEATURE_CATEGORY_3 |
> -                                               AVRCP_FEATURE_CATEGORY_4);
> +                                               AVRCP_FEATURE_CATEGORY_4 |
> +                                               AVRCP_FEATURE_CT_GET_THUMBNAIL);
>
>         record = sdp_record_alloc();
>         if (!record)
> @@ -883,6 +884,8 @@ static const char *metadata_to_str(uint32_t id)
>                 return "NumberOfTracks";
>         case AVRCP_MEDIA_ATTRIBUTE_DURATION:
>                 return "Duration";
> +       case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
> +               return "ImgHandle";
>         }
>
>         return NULL;
> @@ -1197,6 +1200,8 @@ static uint32_t str_to_metadata(const char *str)
>                 return AVRCP_MEDIA_ATTRIBUTE_N_TRACKS;
>         else if (strcasecmp(str, "Duration") == 0)
>                 return AVRCP_MEDIA_ATTRIBUTE_DURATION;
> +       else if (strcasecmp(str, "ImgHandle") == 0)
> +               return AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE;
>
>         return 0;
>  }
> diff --git a/profiles/audio/avrcp.h b/profiles/audio/avrcp.h
> index dcc580e37..59117e946 100644
> --- a/profiles/audio/avrcp.h
> +++ b/profiles/audio/avrcp.h
> @@ -46,7 +46,8 @@
>  #define AVRCP_MEDIA_ATTRIBUTE_N_TRACKS 0x05
>  #define AVRCP_MEDIA_ATTRIBUTE_GENRE    0x06
>  #define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x07
> -#define AVRCP_MEDIA_ATTRIBUTE_LAST     AVRCP_MEDIA_ATTRIBUTE_DURATION
> +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE       0x08
> +#define AVRCP_MEDIA_ATTRIBUTE_LAST     AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE
>
>  /* play status */
>  #define AVRCP_PLAY_STATUS_STOPPED      0x00
> diff --git a/tools/parser/avrcp.c b/tools/parser/avrcp.c
> index e73a6317e..d574c7ee3 100644
> --- a/tools/parser/avrcp.c
> +++ b/tools/parser/avrcp.c
> @@ -160,6 +160,7 @@
>  #define AVRCP_MEDIA_ATTRIBUTE_TOTAL    0x5
>  #define AVRCP_MEDIA_ATTRIBUTE_GENRE    0x6
>  #define AVRCP_MEDIA_ATTRIBUTE_DURATION 0x7
> +#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE       0x08
>
>  /* play status */
>  #define AVRCP_PLAY_STATUS_STOPPED      0x00
> @@ -933,6 +934,8 @@ static const char *mediattr2str(uint32_t attr)
>                 return "Genre";
>         case AVRCP_MEDIA_ATTRIBUTE_DURATION:
>                 return "Track duration";
> +       case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
> +               return "Imaging handle";
>         default:
>                 return "Reserved";
>         }
> --
> 2.34.1
>
>
diff mbox series

Patch

diff --git a/doc/org.bluez.MediaPlayer.rst b/doc/org.bluez.MediaPlayer.rst
index f1e999bdf..5bb38e7c2 100644
--- a/doc/org.bluez.MediaPlayer.rst
+++ b/doc/org.bluez.MediaPlayer.rst
@@ -237,6 +237,10 @@  dict Track [readonly]
 
 		Track duration in milliseconds
 
+	:string ImgHandle:
+
+		Track image handle
+
 object Device [readonly]
 ````````````````````````
 
diff --git a/monitor/avctp.c b/monitor/avctp.c
index c59e93b20..4da448750 100644
--- a/monitor/avctp.c
+++ b/monitor/avctp.c
@@ -156,6 +156,7 @@ 
 #define AVRCP_MEDIA_ATTRIBUTE_TOTAL	0x05
 #define AVRCP_MEDIA_ATTRIBUTE_GENRE	0x06
 #define AVRCP_MEDIA_ATTRIBUTE_DURATION	0x07
+#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE	0x08
 
 /* play status */
 #define AVRCP_PLAY_STATUS_STOPPED	0x00
@@ -582,6 +583,8 @@  static const char *mediattr2str(uint32_t attr)
 		return "Genre";
 	case AVRCP_MEDIA_ATTRIBUTE_DURATION:
 		return "Track duration";
+	case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
+		return "Imaging handle";
 	default:
 		return "Reserved";
 	}
diff --git a/profiles/audio/avrcp.c b/profiles/audio/avrcp.c
index 61558e492..fe24b5a92 100644
--- a/profiles/audio/avrcp.c
+++ b/profiles/audio/avrcp.c
@@ -417,7 +417,8 @@  static sdp_record_t *avrcp_ct_record(bool browsing)
 	uint16_t feat = ( AVRCP_FEATURE_CATEGORY_1 |
 						AVRCP_FEATURE_CATEGORY_2 |
 						AVRCP_FEATURE_CATEGORY_3 |
-						AVRCP_FEATURE_CATEGORY_4);
+						AVRCP_FEATURE_CATEGORY_4 |
+						AVRCP_FEATURE_CT_GET_THUMBNAIL);
 
 	record = sdp_record_alloc();
 	if (!record)
@@ -883,6 +884,8 @@  static const char *metadata_to_str(uint32_t id)
 		return "NumberOfTracks";
 	case AVRCP_MEDIA_ATTRIBUTE_DURATION:
 		return "Duration";
+	case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
+		return "ImgHandle";
 	}
 
 	return NULL;
@@ -1197,6 +1200,8 @@  static uint32_t str_to_metadata(const char *str)
 		return AVRCP_MEDIA_ATTRIBUTE_N_TRACKS;
 	else if (strcasecmp(str, "Duration") == 0)
 		return AVRCP_MEDIA_ATTRIBUTE_DURATION;
+	else if (strcasecmp(str, "ImgHandle") == 0)
+		return AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE;
 
 	return 0;
 }
diff --git a/profiles/audio/avrcp.h b/profiles/audio/avrcp.h
index dcc580e37..59117e946 100644
--- a/profiles/audio/avrcp.h
+++ b/profiles/audio/avrcp.h
@@ -46,7 +46,8 @@ 
 #define AVRCP_MEDIA_ATTRIBUTE_N_TRACKS	0x05
 #define AVRCP_MEDIA_ATTRIBUTE_GENRE	0x06
 #define AVRCP_MEDIA_ATTRIBUTE_DURATION	0x07
-#define AVRCP_MEDIA_ATTRIBUTE_LAST	AVRCP_MEDIA_ATTRIBUTE_DURATION
+#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE	0x08
+#define AVRCP_MEDIA_ATTRIBUTE_LAST	AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE
 
 /* play status */
 #define AVRCP_PLAY_STATUS_STOPPED	0x00
diff --git a/tools/parser/avrcp.c b/tools/parser/avrcp.c
index e73a6317e..d574c7ee3 100644
--- a/tools/parser/avrcp.c
+++ b/tools/parser/avrcp.c
@@ -160,6 +160,7 @@ 
 #define AVRCP_MEDIA_ATTRIBUTE_TOTAL	0x5
 #define AVRCP_MEDIA_ATTRIBUTE_GENRE	0x6
 #define AVRCP_MEDIA_ATTRIBUTE_DURATION	0x7
+#define AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE	0x08
 
 /* play status */
 #define AVRCP_PLAY_STATUS_STOPPED	0x00
@@ -933,6 +934,8 @@  static const char *mediattr2str(uint32_t attr)
 		return "Genre";
 	case AVRCP_MEDIA_ATTRIBUTE_DURATION:
 		return "Track duration";
+	case AVRCP_MEDIA_ATTRIBUTE_IMG_HANDLE:
+		return "Imaging handle";
 	default:
 		return "Reserved";
 	}