Add support for m4a audio container (#303)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Wed, 11 May 2022 11:39:40 +0000 (13:39 +0200)
committerGitHub <noreply@github.com>
Wed, 11 May 2022 11:39:40 +0000 (13:39 +0200)
music_assistant/models/enums.py
music_assistant/models/player.py
music_assistant/models/player_queue.py

index 5c03dccf5da37afd43eacdcbb9f429cde32ec806..52b8a2592ecdde666fde992ad809c040119aa4de 100644 (file)
@@ -79,14 +79,18 @@ class StreamType(Enum):
 
 
 class ContentType(Enum):
-    """Enum with audio content types supported by ffmpeg."""
+    """Enum with audio content/container types supported by ffmpeg."""
 
     OGG = "ogg"
     FLAC = "flac"
     MP3 = "mp3"
     AAC = "aac"
     MPEG = "mpeg"
-    WAV = "wav"
+    ALAC = "alac"
+    WAVE = "wave"
+    AIFF = "aiff"
+    WMA = "wma"
+    M4A = "m4a"
     PCM_S16LE = "s16le"  # PCM signed 16-bit little-endian
     PCM_S24LE = "s24le"  # PCM signed 24-bit little-endian
     PCM_S32LE = "s32le"  # PCM signed 32-bit little-endian
@@ -114,7 +118,13 @@ class ContentType(Enum):
 
     def sox_supported(self):
         """Return if ContentType is supported by SoX."""
-        return self not in [ContentType.AAC, ContentType.MPEG]
+        return self.is_pcm() or self in [
+            ContentType.OGG,
+            ContentType.FLAC,
+            ContentType.MP3,
+            ContentType.WAVE,
+            ContentType.AIFF,
+        ]
 
     def sox_format(self):
         """Convert the ContentType to SoX compatible format."""
index 3cf6b8405eca65b4b6c1aff62c28e0a9bbcc6659..61ab614727b446da69396d56ff86db3dc573353d 100755 (executable)
@@ -23,7 +23,7 @@ DEFAULT_SUPPORTED_CONTENT_TYPES = (
     # if a player does not report/set its supported content types, we use a pretty safe default
     ContentType.FLAC,
     ContentType.MP3,
-    ContentType.WAV,
+    ContentType.WAVE,
     ContentType.PCM_S16LE,
     ContentType.PCM_S24LE,
 )
index 3c57f017840a157e37d8c0389d411b2ea45ab590..9fcad8d077b762574b6dc585fbb7b2f7bcc185ee 100644 (file)
@@ -195,7 +195,7 @@ class QueueSettings:
             x
             for x in (
                 ContentType.FLAC,
-                ContentType.WAV,
+                ContentType.WAVE,
                 ContentType.PCM_S16LE,
                 ContentType.MP3,
                 ContentType.MPEG,