add a song info dialog and show the encoding in the manager

The song context menus gain Info, which lists every field we hold for the song
and, when it is downloaded, the file's format, bitrate, sample rate, channels
and size read from the file itself. For the song currently playing it takes the
encoding from the media3 stream instead, so a transcoded stream reports what is
actually being played. The menu is shared, so this reaches the album, playlist,
now playing and queue menus at once.

The downloads manager shows the same format and bitrate beside the size on each
song row, read lazily for the rows on screen rather than for the whole tree.
This commit is contained in:
austinried
2026-10-04 00:30:03 +00:00
parent adb9367f18
commit 02b3ddbb98
15 changed files with 286 additions and 13 deletions
@@ -0,0 +1,25 @@
package com.subtracks.data.model
import org.junit.Assert.assertEquals
import org.junit.Assert.assertNull
import org.junit.Test
class AudioEncodingTest {
@Test
fun commonTypesGetReadableNames() {
assertEquals("MP3", AudioEncoding("audio/mpeg").format)
assertEquals("FLAC", AudioEncoding("audio/flac").format)
assertEquals("AAC", AudioEncoding("audio/mp4").format)
assertEquals("Opus", AudioEncoding("audio/opus").format)
}
@Test
fun anUnknownTypeFallsBackToItsSubtype() {
assertEquals("X-CUSTOM", AudioEncoding("audio/x-custom").format)
}
@Test
fun noTypeMeansNoFormat() {
assertNull(AudioEncoding(null).format)
}
}
@@ -54,6 +54,7 @@ class DownloadTreeTest {
size: Long,
) = DownloadedSong(
songId = id,
sourceId = 1,
title = title,
albumId = albumId,
albumName = albumName,