summaryrefslogtreecommitdiff
path: root/.local/bin/pashare
blob: 6fe8f2585e530477d87fc32c795a1dcb3e187774 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/sh

# using: PulseDroidRTP 
# https://github.com/wenxin-wang/PulseDroidRtp

main () {
    case "$1" in
        start)
            start ;;
        stop)
            stop ;;
        *)
            echo "usage: pashare [start|stop]"
            ;;
    esac
}

start () {
    stop &>/dev/null

    DEST=$(<$XDG_CONFIG_HOME/pashare/dest)

    pactl load-module module-null-sink \
        sink_name=rtp \
        sink_properties=device.description=RTP \
        format=s16be \
        channels=2 \
        rate=48000 >/dev/null

    pactl load-module module-rtp-send source=rtp.monitor destination=$DEST port=4010 mtu=320 >/dev/null
}

stop () {
    pactl unload-module module-null-sink
    pactl unload-module module-rtp-send
}

main "$@"