Fix support for mpeg dash based radio streams (#450)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sun, 7 Aug 2022 22:58:20 +0000 (00:58 +0200)
committerGitHub <noreply@github.com>
Sun, 7 Aug 2022 22:58:20 +0000 (00:58 +0200)
music_assistant/helpers/audio.py
music_assistant/models/enums.py

index 9ee9e2cadfed63f7e0b6a231a882661f60a3b850..f33547fde331981e047e355a66d89adf6d842b0e 100644 (file)
@@ -271,6 +271,13 @@ async def get_stream_details(
         streamdetails.loudness = loudness
     if not streamdetails.duration:
         streamdetails.duration = queue_item.duration
+    # make sure that ffmpeg handles mpeg dash streams directly
+    if (
+        streamdetails.content_type == ContentType.MPEG_DASH
+        and streamdetails.data
+        and streamdetails.data.startswith("http")
+    ):
+        streamdetails.direct = streamdetails.data
     # set streamdetails as attribute on the media_item
     # this way the app knows what content is playing
     queue_item.streamdetails = streamdetails
index 23d1e44d4a0d572fbda34caa9592997a6a296411..5e11347b0ee85b4e9865695812bcf8996a6ae853 100644 (file)
@@ -121,6 +121,7 @@ class ContentType(Enum):
     PCM_S32LE = "s32le"  # PCM signed 32-bit little-endian
     PCM_F32LE = "f32le"  # PCM 32-bit floating-point little-endian
     PCM_F64LE = "f64le"  # PCM 64-bit floating-point little-endian
+    MPEG_DASH = "dash"
     UNKNOWN = "?"
 
     @classmethod
@@ -141,6 +142,7 @@ class ContentType(Enum):
         tempstr = tempstr.split("&")[0]
         tempstr = tempstr.split(";")[0]
         tempstr = tempstr.replace("mp4", "m4a")
+        tempstr = tempstr.replace("mpd", "dash")
         try:
             return cls(tempstr)
         except ValueError: