Populate richer DIDL-Lite metadata for DLNA cast (#934)
Extend MediaItemMetadata with TrackNumber, Size, BitRate, SampleRate, BitDepth, and ChannelCount (all already present on Track) and populate them in Track.Metadata(). Thread them through dlnaplayer.go into the avtransport.MediaItem so the renderer's DIDL-Lite includes upnp:artist, upnp:album, upnp:originalTrackNumber, plus <res> attributes for duration, size, bitrate, sampleFrequency, bitsPerSample, and nrAudioChannels. The previously dropped Duration field is now populated too. For cover art, add a CoverArtPathFn callback on PlaybackManager wired to ImageManager.GetCoverArtPath in app.go. The DLNA player invokes it when a track is queued, registers the cached cover-thumbnail path with the local proxy, and emits the resulting proxy URL as upnp:albumArtURI so the renderer can display album art alongside the audio. Bumps go-upnpcast to pull in the MediaItem fields and DIDL-Lite emission added in supersonic-app/go-upnpcast#4.
This commit is contained in:
@@ -224,16 +224,22 @@ const (
|
||||
)
|
||||
|
||||
type MediaItemMetadata struct {
|
||||
Type MediaItemType
|
||||
MIMEType string
|
||||
ID string
|
||||
Name string
|
||||
Artists []string
|
||||
ArtistIDs []string
|
||||
Album string
|
||||
AlbumID string
|
||||
CoverArtID string
|
||||
Duration time.Duration
|
||||
Type MediaItemType
|
||||
MIMEType string
|
||||
ID string
|
||||
Name string
|
||||
Artists []string
|
||||
ArtistIDs []string
|
||||
Album string
|
||||
AlbumID string
|
||||
CoverArtID string
|
||||
Duration time.Duration
|
||||
TrackNumber int
|
||||
Size int64
|
||||
BitRate int // kbps as reported by the server
|
||||
SampleRate int // Hz
|
||||
BitDepth int
|
||||
ChannelCount int
|
||||
}
|
||||
|
||||
type MediaItem interface {
|
||||
@@ -246,16 +252,22 @@ func (t *Track) Metadata() MediaItemMetadata {
|
||||
return MediaItemMetadata{}
|
||||
}
|
||||
return MediaItemMetadata{
|
||||
Type: MediaItemTypeTrack,
|
||||
MIMEType: t.ContentType,
|
||||
ID: t.ID,
|
||||
Name: t.Title,
|
||||
Artists: t.ArtistNames,
|
||||
ArtistIDs: t.ArtistIDs,
|
||||
Album: t.Album,
|
||||
AlbumID: t.AlbumID,
|
||||
CoverArtID: t.CoverArtID,
|
||||
Duration: t.Duration,
|
||||
Type: MediaItemTypeTrack,
|
||||
MIMEType: t.ContentType,
|
||||
ID: t.ID,
|
||||
Name: t.Title,
|
||||
Artists: t.ArtistNames,
|
||||
ArtistIDs: t.ArtistIDs,
|
||||
Album: t.Album,
|
||||
AlbumID: t.AlbumID,
|
||||
CoverArtID: t.CoverArtID,
|
||||
Duration: t.Duration,
|
||||
TrackNumber: t.TrackNumber,
|
||||
Size: t.Size,
|
||||
BitRate: t.BitRate,
|
||||
SampleRate: t.SampleRate,
|
||||
BitDepth: t.BitDepth,
|
||||
ChannelCount: t.Channels,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user