From 80b324e915e972adee078ac1dc5cf1848de00eb7 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Fri, 3 Jan 2014 16:58:33 +0100 Subject: add gstreamer-0.10 examples, some renamings --- compare.sh | 6 ----- cosin.mux | 67 +++++++++++++++++++++++++++++++++++++++++++++++ encode-fbplus.sh | 4 +-- encode-url-gst-dabplus.sh | 36 ++++++++++++++++++------- test.config | 67 ----------------------------------------------- zmq-rx-raweti.py | 50 +++++++++++++++++++++++++++++++++++ zmq-rx.py | 50 ----------------------------------- zmq-simul.mux | 4 +-- 8 files changed, 148 insertions(+), 136 deletions(-) delete mode 100755 compare.sh create mode 100644 cosin.mux delete mode 100644 test.config create mode 100755 zmq-rx-raweti.py delete mode 100755 zmq-rx.py diff --git a/compare.sh b/compare.sh deleted file mode 100755 index 82e8fd2..0000000 --- a/compare.sh +++ /dev/null @@ -1,6 +0,0 @@ -rm original.eti compare.eti - -./mux-throttled-nofb.sh -n 10 > original.eti -../crc-dabmux-0.3.0.4/src/CRC-DabMux-cfg examplemux.config > compare.eti - -dhex original.eti compare.eti diff --git a/cosin.mux b/cosin.mux new file mode 100644 index 0000000..20859ed --- /dev/null +++ b/cosin.mux @@ -0,0 +1,67 @@ +general { + ; the DAB Transmission mode (values 1-4 accepted) + dabmode 1 + + ; the number of ETI frames to generate (set to 0 to get an unlimited number) + nbframes 0 + + + ; Enable TCPLog on port 12222 + tcplog false + writescca false + tist false +} + +; Some ensemble parameters +ensemble { + id 20479 + ecc 1249 ; Extended Country Code (decimal) + label "TuxMux" + shortlabel "Tux" +} + +services { + fbp { + label "fb+" + shortlabel "fb+" + pty 0 + language 0 + ; also supports id + } +} + +; The subchannels are defined in the corresponding section. +; supported types are : audio, bridge, data, enhancedpacket, +; dabplus, dmb, packet, test +subchannels { + fbp { + type dabplus + inputfile "fb.dabp" + nonblock false + bitrate 96 + id 10 + protection 3 + } +} + +; For now, each component links one service to one subchannel +components { + ; the component unique identifiers are not used anywhere, but + ; are useful to disambiguate different components. + funky { + label "CoSin" + shortlabel "CoSin" + service fbp + subchannel fbp + } +} + +; A list of outputs, in the format +; unique_id "uri" +outputs { + foobar "fifo:///dev/stdout?type=raw" + + ; This throttles muxing down to nominal rate + throttle "simul://" + +} diff --git a/encode-fbplus.sh b/encode-fbplus.sh index f864a0a..e8cfaf8 100755 --- a/encode-fbplus.sh +++ b/encode-fbplus.sh @@ -9,12 +9,12 @@ BITRATE=64 if [ "$WITH_GSTREAMER" == "1" ] then - gst-launch-1.0 -q \ + gst-launch-0.10 -q \ uridecodebin uri=$URL ! \ queue ! \ audioresample quality=8 ! \ audioconvert ! \ - audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \ + audio/x-raw-int, 'rate=48000,format=S16LE,channels=2' ! \ filesink location="/dev/stdout" | \ ../fdk-aac-dabplus/aac-enc-dabplus-zmq -i /dev/stdin -b $BITRATE -f raw -a -o 'tcp://*:2720' else diff --git a/encode-url-gst-dabplus.sh b/encode-url-gst-dabplus.sh index d1e2ce7..bbe3d59 100755 --- a/encode-url-gst-dabplus.sh +++ b/encode-url-gst-dabplus.sh @@ -7,6 +7,8 @@ BITRATE=$2 DSTPORT=$3 QUEUEDELAY=400000 #400ms +GSTREAMER_VERSION="1" + if [ "$DSTPORT" == "" ] then echo "Usage:" @@ -15,12 +17,28 @@ then fi -gst-launch-1.0 -q \ - uridecodebin uri=$URL ! \ - queue "max-size-time=$QUEUEDELAY" ! \ - audioresample quality=8 ! \ - audioconvert ! \ - audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \ - filesink location="/dev/stdout" | \ - ../fdk-aac-dabplus/aac-enc-dabplus-zmq \ - -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}" +if [ "$GSTREAMER_VERSION" == "1" ] +then + gst-launch-1.0 -q \ + uridecodebin uri=$URL ! \ + queue "max-size-time=$QUEUEDELAY" ! \ + audioresample quality=8 ! \ + audioconvert ! \ + audio/x-raw, 'rate=48000,format=S16LE,channels=2' ! \ + filesink location="/dev/stdout" | \ + ../fdk-aac-dabplus/aac-enc-dabplus-zmq \ + -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}" + +elif [ "$GSTREAMER_VERSION" == "0" ] +then + gst-launch -q \ + uridecodebin uri=$URL ! \ + queue "max-size-time=$QUEUEDELAY" ! \ + audioresample quality=8 ! \ + audioconvert ! \ + audio/x-raw-int, 'rate=48000,format=S16LE,channels=2' ! \ + filesink location="/dev/stdout" | \ + ../fdk-aac-dabplus/aac-enc-dabplus-zmq \ + -i /dev/stdin -b $BITRATE -f raw -a -o "tcp://*:${DSTPORT}" +fi + diff --git a/test.config b/test.config deleted file mode 100644 index 20859ed..0000000 --- a/test.config +++ /dev/null @@ -1,67 +0,0 @@ -general { - ; the DAB Transmission mode (values 1-4 accepted) - dabmode 1 - - ; the number of ETI frames to generate (set to 0 to get an unlimited number) - nbframes 0 - - - ; Enable TCPLog on port 12222 - tcplog false - writescca false - tist false -} - -; Some ensemble parameters -ensemble { - id 20479 - ecc 1249 ; Extended Country Code (decimal) - label "TuxMux" - shortlabel "Tux" -} - -services { - fbp { - label "fb+" - shortlabel "fb+" - pty 0 - language 0 - ; also supports id - } -} - -; The subchannels are defined in the corresponding section. -; supported types are : audio, bridge, data, enhancedpacket, -; dabplus, dmb, packet, test -subchannels { - fbp { - type dabplus - inputfile "fb.dabp" - nonblock false - bitrate 96 - id 10 - protection 3 - } -} - -; For now, each component links one service to one subchannel -components { - ; the component unique identifiers are not used anywhere, but - ; are useful to disambiguate different components. - funky { - label "CoSin" - shortlabel "CoSin" - service fbp - subchannel fbp - } -} - -; A list of outputs, in the format -; unique_id "uri" -outputs { - foobar "fifo:///dev/stdout?type=raw" - - ; This throttles muxing down to nominal rate - throttle "simul://" - -} diff --git a/zmq-rx-raweti.py b/zmq-rx-raweti.py new file mode 100755 index 0000000..6363299 --- /dev/null +++ b/zmq-rx-raweti.py @@ -0,0 +1,50 @@ +#!/usr/bin/env python +# Copyright (C) 2013 Matthias P. Braendli +# http://mpb.li +# +# This file is part of CRC-DabMux. +# +# CRC-DabMux is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# CRC-DabMux is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with CRC-DabMux. If not, see . +# +# +# Use this script to receive the zmq+tcp://*:8080 output from +# crc-dabmux. +# +# It can then be piped into CRC-DabMod. Thanks to ZeroMQ, the connection +# stays up even when crc-dabmux is killed and restarted. However, +# frame-sync is lost, and UHD Underruns will happen. + +# This is python3 code, it will probably not work on python2. +# TODO fix that + +import sys +import zmq + +RAW_LEN=6144 + +context = zmq.Context() + +sock = context.socket(zmq.SUB) + +sock.connect("tcp://localhost:8080") + +# set a filter that lets everything through +sock.setsockopt(zmq.SUBSCRIBE, bytes([])) + +sys.stderr.write("Entering loop\n") +while True: + data = sock.recv(flags=0, copy=True, track=False) + + sys.stdout.buffer.write(data) + sys.stdout.buffer.write(bytes([0x55] * (RAW_LEN - len(data)))) diff --git a/zmq-rx.py b/zmq-rx.py deleted file mode 100755 index 6363299..0000000 --- a/zmq-rx.py +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2013 Matthias P. Braendli -# http://mpb.li -# -# This file is part of CRC-DabMux. -# -# CRC-DabMux is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# CRC-DabMux is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with CRC-DabMux. If not, see . -# -# -# Use this script to receive the zmq+tcp://*:8080 output from -# crc-dabmux. -# -# It can then be piped into CRC-DabMod. Thanks to ZeroMQ, the connection -# stays up even when crc-dabmux is killed and restarted. However, -# frame-sync is lost, and UHD Underruns will happen. - -# This is python3 code, it will probably not work on python2. -# TODO fix that - -import sys -import zmq - -RAW_LEN=6144 - -context = zmq.Context() - -sock = context.socket(zmq.SUB) - -sock.connect("tcp://localhost:8080") - -# set a filter that lets everything through -sock.setsockopt(zmq.SUBSCRIBE, bytes([])) - -sys.stderr.write("Entering loop\n") -while True: - data = sock.recv(flags=0, copy=True, track=False) - - sys.stdout.buffer.write(data) - sys.stdout.buffer.write(bytes([0x55] * (RAW_LEN - len(data)))) diff --git a/zmq-simul.mux b/zmq-simul.mux index 8352666..a08f5c7 100644 --- a/zmq-simul.mux +++ b/zmq-simul.mux @@ -42,10 +42,10 @@ services { subchannels { sub_fb { type dabplus - ;use ZeroMQ: + ; use ZeroMQ: inputfile "tcp://localhost:2720" nonblock false - bitrate 96 + bitrate 64 id 24 protection 3 } -- cgit v1.2.3