From a80f21e57ca709cc50a73a67472de9fd9c8e8c99 Mon Sep 17 00:00:00 2001 From: sonny Date: Wed, 21 Aug 2024 12:23:28 +0200 Subject: [PATCH] Add mobile mpd stream --- templates/mpd.j2 | 21 ++++++++++++++++++--- templates/nftables.j2 | 1 + vars/network.yml | 1 + 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/templates/mpd.j2 b/templates/mpd.j2 index ed7f1ad..154b109 100644 --- a/templates/mpd.j2 +++ b/templates/mpd.j2 @@ -89,20 +89,35 @@ auto_update "yes" # Use a fixed format for the HTTP stream because it cannot switch its audio # format on-the-fly when the song changes. -# see https://mpd.readthedocs.io/en/latest/plugins.html#httpd +# See https://mpd.readthedocs.io/en/latest/plugins.html#httpd. +# See https://wiki.xiph.org/Opus_Recommended_Settings#Recommended_Bitrates for +# recommended Opus settings. audio_output { type "httpd" - name "HTTP Stream" + name "HTTP high quality stream" encoder "opus" port "{{ mpd_http_stream_port }}" bind_to_address "{{ vpn_listen_address }}" bitrate "128000" - format "48000:16:1" + format "192000:24:2" always_on "yes" tags "yes" max_clients "0" } +audio_output { + type "httpd" + name "HTTP mobile stream" + encoder "opus" + port "{{ mpd_http_mobile_stream_port }}" + bind_to_address "{{ vpn_listen_address }}" + bitrate "96000" + format "44100:16:2" + always_on "yes" + tags "yes" + max_clients "1" +} + # # Character Encoding ########################################################## diff --git a/templates/nftables.j2 b/templates/nftables.j2 index 05e0099..c521d68 100644 --- a/templates/nftables.j2 +++ b/templates/nftables.j2 @@ -32,6 +32,7 @@ table ip filter { iifname "{{ vpn_interface }}" tcp dport { {{ syncthing_gui_port }}, {{ syncthing_protocol_port }} } ip saddr {{ vpn_source_range }} ip daddr {{ vpn_destination_range }} accept comment "Syncthing" iifname "{{ vpn_interface }}" tcp dport {{ mpd_port }} ip saddr {{ vpn_source_range }} ip daddr {{ vpn_destination_range }} accept comment "MPD" iifname "{{ vpn_interface }}" tcp dport {{ mpd_http_stream_port }} ip saddr {{ vpn_source_range }} ip daddr {{ vpn_destination_range }} accept comment "MPD HTTP stream" + iifname "{{ vpn_interface }}" tcp dport {{ mpd_http_mobile_stream_port }} ip saddr {{ vpn_source_range }} ip daddr {{ vpn_destination_range }} accept comment "MPD HTTP mobile stream" iifname "{{ vpn_media_interface }}" tcp dport {{ jellyfin_http_port }} ip saddr {{ vpn_media_source_range }} ip daddr {{ vpn_media_destination_range }} accept comment "Jellyfin HTTP" diff --git a/vars/network.yml b/vars/network.yml index df16f92..bd9f4bf 100644 --- a/vars/network.yml +++ b/vars/network.yml @@ -10,6 +10,7 @@ ssh_port: 39901 mpd_port: 21000 mpd_http_stream_port: 8000 +mpd_http_mobile_stream_port: 8001 gitlab_ip: '127.0.0.1' gitlab_port: '9090'