CONF_OUTPUT_CHANNELS,
CONF_PUBLISH_IP,
CONF_SAMPLE_RATES,
+ MASS_LOGO_ONLINE,
SILENCE_FILE,
VERBOSE_LOG_LEVEL,
)
"Pragma": "no-cache",
"Connection": "close",
"Accept-Ranges": "none",
- "Icy-Name": "Music Assistant",
- "Icy-Url": "https://music-assistant.io",
+}
+ICY_HEADERS = {
+ "icy-name": "Music Assistant",
+ "icy-description": "Music Assistant - Your personal music assistant",
+ "icy-version": "1",
+ "icy-logo": MASS_LOGO_ONLINE,
}
FLOW_DEFAULT_SAMPLE_RATE = 48000
FLOW_DEFAULT_BIT_DEPTH = 24
"Accept-Ranges": "none",
"Cache-Control": "no-cache",
"Connection": "close",
+ "icy-name": queue_item.name,
}
resp = web.StreamResponse(
status=200,
# prepare request, add some DLNA/UPNP compatible headers
headers = {
**DEFAULT_STREAM_HEADERS,
+ **ICY_HEADERS,
"Content-Type": f"audio/{output_format.output_format_str}",
"Accept-Ranges": "none",
"Cache-Control": "no-cache",
player.player_id, CONF_OUTPUT_CHANNELS, "stereo"
)
output_channels = 1 if output_channels_str != "stereo" else 2
+ if not content_type.is_lossless():
+ output_bit_depth = 16
+ output_sample_rate = min(48000, output_sample_rate)
return AudioFormat(
content_type=content_type,
sample_rate=output_sample_rate,
elif output_format.content_type == ContentType.UNKNOWN:
raise RuntimeError("Invalid output format specified")
elif output_format.content_type == ContentType.AAC:
- output_args = ["-f", "adts", output_path]
+ output_args = ["-f", "adts", "-c:a", "aac", "-b:a", "256k", output_path]
+ elif output_format.content_type == ContentType.MP3:
+ output_args = ["-f", "mp3", "-b:a", "320k", output_path]
else:
if output_format.content_type.is_pcm():
output_args += ["-acodec", output_format.content_type.name.lower()]
str(output_format.channels),
output_path,
]
+ if output_format.output_format_str == "flac":
+ output_args += ["-compression_level", "6"]
# edge case: source file is not stereo - downmix to stereo
if input_format.channels > 2 and output_format.channels == 2: