Even if it can, it's not quite practical since the recordings of the 2 programs need to start and end at the same time. For example we cannot start recording Jade at 10:00 and then Pearl at 10:30.
My recording scripts can also record multiple programs simultaneously and they can start at same or different times. For this purpose, I wrote 2 small C programs: relay.c and tscat.c. 'relay' simply read TS data from stdin, and store into temporarily buffers (total buffer size is limited so new data would overwrite old ones) and is ready for piping to multiple receivers via fifos. 'tscat' is a problem, which when runs, sends a signal to 'relay', asking it to pipe TS data to it. 'tscat' then simply rewrite the TS data to stdout.
Let's say we need to record 2 programs: ATV Home starting at 10:00, and TVB Jade starting at 10:30. Then at 10:00, my script would perform the followings:
1. run 'tzap -c /etc/dvb/channels.conf "jade"' to get the tuner tuned.
2. run 'dvbsnoop -adapter 0 -s ts -tsraw -b | /tmp/relay 0'. TS data are then sent to 'relay' continuously.
3. tscat 0 /tmp/fifo0_16713 | cvlc fd://0 --programs=11 --sout file/ts:/common/tv/file1.ts 1>/dev/null 2>&1
tscat sends a signal to relay requesting it to pipe the TS data into fifo /tmp/fifo0_16713. tscat then pipe the data to vlc via stdout.
At 10:30, recording of TVB Jade starts as follows simply by another instance of tscat + vlc:
tscat 0 /tmp/fifo0_23456 | cvlc fd://0 --programs=1 --sout file/ts:/common/tv/file2.ts 1>/dev/null 2>&1
This tscat instance sends a signal to relay, request it to send the TS data also to it via /tmp/fifo0_23456. Hence relay will then be sending data to 2 clients.
My script takes care of the time duration of each recording. When one of the programs finishes recording, it kills its corresponding tscat + vlc. If all recordings of an adapter has finished, it kills tzap + dvbsnoop as well. |