RaspDAB/Add Program Associated Data with ODR-PadEnc
Program Associated Data is information that, as the name implies, is somehow linked with the audio program. And as such it is logical to carry the information in the audio bitstream. ODR-PadEnc enables 2 types of program associated data: simple text ('Dynamic Label Segment') and a slideshow (using the Multimedia Object Transfer protocol). The text is read from a file and the slides from a directory. Both are encoded by ODR-PadEnc and placed in a FIFO (First In First Out) structure, one for every audio program, from where ODR-AudioEnc gets the information and includes it in the audio bitstream.
So we first need to create the FIFO. This is done with
$ mkfifo /tmp/srv1_pad.fifo
You can give any name for the fifo file, but here we stick to [service name]_pad.fifo for clarity. And it is placed in the /tmp folder as it is just a conduit to transfer information from one program to another.
The DLS text information is normally shown as scrolling text on the display of the receiver. Each line of text can be at maximum 128 characters, though some receivers are known not to be able to display all 128. Also some receivers seem to show one character more than what is included in the text file, which seems to be from the previous DLS text. These are just annoying software bugs in the receivers, but you may want to prepare your texts for it by always sending the same length - less that 128 characters (actually, shorter is better as scolling will take less time) - and always having a 'space' character at the end to cover up any text still left in the memory.
We'll first create a directory for the PAD and DLS:
$ mkdir PAD $ chdir PAD $ mkdir srv1 $ chdir srv1 $ mkdir DLS
In this directory you can place the text files to be carried as DLS. Here we call them DLS1.txt and DLS2.txt.
In the directory PAD we also create the MOT directory:
$ mkdir MOT
In this directory you can place .jpg or .png files with a size of maximum 50 kbytes, and dimensions of 320 by 240 pixels. Typically just a single slide is put here, with the station logo, but you can add more if you want to. These will be carried in a caroussel, just like the DLS text. We call the slide logo.jpg. It's good practice to add a description file, called logo.jpg.sls_params . This is a simple text file with e.g. the following content:
# this slide is in category #1 and slide #1 within this category CategoryID/SlideID=1 1 # the used category #1 gets named CategoryTitle=Station Logo
# a URL is provided where further information can be found ClickThroughURL=http://wiki.opendigitalradio.org/ODR-PadEnc # provide an alternative location for this slide AlternativeLocationURL=http://wiki.opendigitalradio.org/logo.jpg
This will enable more advanced receivers to keep a categorized selection of slides in memory, e.g. the logo, news pages etc.
Including PAD in the audio stream
Once you have put the text files in the PAD directory and the slide(s) in the MOT directory you can invoke the PAD encoder with
$ odr-padenc -o /tmp/srv1-pad.fifo -t /home/[UserID]/PAD/srv1/DLS/DLS1.txt -t /home/[UserID]/PAD/srv1/DLS/DLS2.txt -d /home/[UserID]/PAD/srv1/MOT -p 58
This will read the text files and transcode them, and also ingress the slides in the MOT directory and put all information in the fifo, where the audio encoder can pick them up. The number of PAD bytes per audio frame is signalled here as 58 (the default). You may want to reduce this at lower audio bitrates, to slightly improve the audio quality.
NOTE: I have no clue why the text files have to be mentioned each individually, and just the directory of the slides needs to be indicated... Seems the latter approach could be used for the text files as well.
Now the audio encoder needs to be told where to pick up the PAD:
$ odr-audioenc -v http://server-66.stream-server.nl:8852 -C 200 -b 64 -o tcp://localhost:59000 -D -L --audio-resampler=samplerate -L --src-converter-type=1 -l -V -p 58 -P /tmp/srv1_pad.fifo
So you add the -p 58 to indicate the length (should be identical to the value in the odr-padenc invokation) and indicate with -P the location of the PAD fifo.
That's it ! You should see PAD text now on your DAB receiver, and - if you have a receiver or software to decode it (like DAB Player) - should see the slide(s) starting to appear.
For more information, also on DL-plus, see the examples in the ODR Wiki. And now all elements are up and running, let's ensure this is started automatically upon booting !