From 1deac5948f6cbcb6cfad35eec5b77f482958c553 Mon Sep 17 00:00:00 2001 From: Guillaume Pellerin Date: Sat, 5 Oct 2024 00:45:32 +0200 Subject: [PATCH] add pipewire test dir --- tests/pipewire/tc_pw_audio-proc.sh | 18 ++++++++++++ tests/pipewire/tc_pw_audio.sh | 13 +++++++++ tests/pipewire/tc_pw_link.sh | 44 ++++++++++++++++++++++++++++++ tests/pipewire/tc_pw_video.sh | 20 ++++++++++++++ 4 files changed, 95 insertions(+) create mode 100755 tests/pipewire/tc_pw_audio-proc.sh create mode 100755 tests/pipewire/tc_pw_audio.sh create mode 100755 tests/pipewire/tc_pw_link.sh create mode 100755 tests/pipewire/tc_pw_video.sh diff --git a/tests/pipewire/tc_pw_audio-proc.sh b/tests/pipewire/tc_pw_audio-proc.sh new file mode 100755 index 0000000..24ca397 --- /dev/null +++ b/tests/pipewire/tc_pw_audio-proc.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +set -e + +# Default TeleCaster video parameters + +source /etc/telecaster/telecaster.conf + +gst-launch-1.0 pipewiresrc client-name="audio_processing" ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ + ! queue ! audioconvert \ + ! queue ! audiocheblimit mode=high-pass cutoff=120 poles=4 \ + ! queue ! volume volume=$AUDIO_GAIN_PRE \ + ! queue ! audiodynamic characteristics=soft-knee mode=compressor threshold=0.125 ratio=0.125 \ + ! queue ! volume volume=$AUDIO_GAIN_POST \ + ! queue ! audiodynamic characteristics=hard-knee mode=compressor threshold=0.95 ratio=0.001 \ + ! queue ! pipewiresink client-name="audio_processing" target-object="none" + + diff --git a/tests/pipewire/tc_pw_audio.sh b/tests/pipewire/tc_pw_audio.sh new file mode 100755 index 0000000..97708f1 --- /dev/null +++ b/tests/pipewire/tc_pw_audio.sh @@ -0,0 +1,13 @@ +# !/usr/bin/env bash + +set -e + +# Default TeleCaster video parameters + +source /etc/telecaster/telecaster.conf + +gst-launch-1.0 pipewiresrc client-name="audio_streaming" target-object="audio_processing" ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ + ! queue ! audioconvert \ + ! queue ! lamemp3enc quality=$AUDIO_MP3_QUALITY \ + ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.mp3 + diff --git a/tests/pipewire/tc_pw_link.sh b/tests/pipewire/tc_pw_link.sh new file mode 100755 index 0000000..8062cd0 --- /dev/null +++ b/tests/pipewire/tc_pw_link.sh @@ -0,0 +1,44 @@ +#!/usr/bin/python3 + +from pipewire_python import link + + +def find_object(puts, device): + for put in puts: + if hasattr(put, "left"): + p = put.left + if device in p.device and hasattr(p, "port_type"): + if not "monitor" in p.name: + return put + else: + if device in put.device and hasattr(put, "port_type"): + return put + +inputs = link.list_inputs() +outputs = link.list_outputs() + +# print(inputs) +# print(outputs) + +firefox_input = find_object(inputs, "Firefox") +audio_processing_output = find_object(outputs, "audio_processing") +audio_processing_input = find_object(inputs, "audio_processing") +alsa_output = find_object(outputs, "alsa_input.pci-0000") +alsa_input = find_object(inputs, "alsa_output.pci-0000") +mic_output = find_object(outputs, "U192k_0_1") + +# print(alsa_output) +# print(alsa_inputs) +# print(firefox) +# print(audio_processing_input) + +alsa_output.disconnect(audio_processing_input) +alsa_input.disconnect(audio_processing_output) + +# mono source +mic_output.connect(audio_processing_input.left) +mic_output.connect(audio_processing_input.right) + +firefox_input.connect(audio_processing_output) +firefox_input.disconnect(alsa_output) + diff --git a/tests/pipewire/tc_pw_video.sh b/tests/pipewire/tc_pw_video.sh new file mode 100755 index 0000000..7fb9403 --- /dev/null +++ b/tests/pipewire/tc_pw_video.sh @@ -0,0 +1,20 @@ +# !/usr/bin/env bash + +set -e + +# Default TeleCaster video parameters + +source /etc/telecaster/telecaster.conf + +gst-launch-1.0 pipewiresrc client-name="video_streaming" \ + ! queue ! $VIDEO_DECODER \ + ! queue ! videoconvert \ + ! queue ! vp8enc threads=4 deadline=2 target-bitrate=2000000 \ + ! queue ! muxout. \ + pipewiresrc client-name="video_streaming" target-object="audio_processing" ! audio/x-raw, format=F32LE, channels=$AUDIO_CHANNELS \ + ! queue ! audioconvert \ + ! queue ! opusenc bitrate=$AUDIO_OPUS_BITRATE \ + ! queue ! muxout. \ + webmmux streamable=true name=muxout \ + ! queue ! shout2send ip=127.0.0.1 port=8000 password=source2parisson mount=telecaster_live.webm + -- 2.39.5