Commit 43b27d60 authored by Andy Gatward's avatar Andy Gatward Committed by Christophe Massiot

* output.c: Support for MPEG-TS over raw UDP with the -U switch.

parent 450e39a2
......@@ -5,7 +5,12 @@ linux-dvb API. It opens a DVB device, tunes it, places PID filters,
configures a CAM module, and demultiplexes the packets to several RTP
outputs. It supports the new S2API of linux-dvb (compile option).
The configuration file for RTP outputs can be reloaded without losing
Output to UDP rather than RTP is also supported so those IPTV set top
boxes that don't do RTP over multicast can also use the streams.
This functionality is not recommended and should only be used if
absolutely necessary.
The configuration file for outputs can be reloaded without losing
a single packet. MMI operation and monitoring are provided with an
external control program using a Unix domain socket.
......@@ -16,3 +21,4 @@ features only one thread of execution. It has very few dependencies
--
Meuuh 2009-05-11
gatty 2009-05-24
......@@ -54,6 +54,7 @@ int b_tone = 0;
int i_bandwidth = 8;
char *psz_modulation = NULL;
int b_budget_mode = 0;
int b_output_udp = 0;
volatile int b_hup_received = 0;
/*****************************************************************************
......@@ -181,13 +182,14 @@ static void SigHandler( int i_signal )
*****************************************************************************/
void usage()
{
msg_Err( NULL, "Usage: dvblast -c <config file> [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>][-n <frontend_num>] -f <frequency> [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-m <modulation] [-u] [-d <dest IP:port>]" );
msg_Err( NULL, "Usage: dvblast -c <config file> [-r <remote socket>] [-t <ttl>] [-o <SSRC IP>] [-i <RT priority>] [-a <adapter>][-n <frontend_num>] -f <frequency> [-s <symbol rate>] [-v <0|13|18>] [-p] [-b <bandwidth>] [-m <modulation] [-u] [-U] [-d <dest IP:port>]" );
msg_Err( NULL, "-v: voltage to apply to the LNB (QPSK)" );
msg_Err( NULL, "-p: force 22kHz pulses for high-band selection (DVB-S)" );
msg_Err( NULL, "-m: DVB-C qpsk|qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Err( NULL, " DVB-T qam_16|qam_32|qam_64|qam_128|qam_256 (default qam_auto)" );
msg_Err( NULL, " DVB-S2 qpsk|psk_8 (default legacy DVB-S)" );
msg_Err( NULL, "-u: turn on budget mode (no hardware PID filtering)" );
msg_Err( NULL, "-U: use raw UDP rather than RTP (required by some IPTV set top boxes)" );
msg_Err( NULL, "-d: duplicate all received packets to a given port" );
exit(1);
}
......@@ -206,7 +208,7 @@ int main( int i_argc, char **pp_argv )
{
char c;
if ( (c = getopt(i_argc, pp_argv, "c:r:t:o:i:a:n:f:s:v:pb:m:ud:h")) == -1 )
if ( (c = getopt(i_argc, pp_argv, "c:r:t:o:i:a:n:f:s:v:pb:m:uUd:h")) == -1 )
break;
switch ( c )
......@@ -272,6 +274,12 @@ int main( int i_argc, char **pp_argv )
b_budget_mode = 1;
break;
case 'U':
b_output_udp = 1;
msg_Warn( NULL, "raw UDP output is deprecated. Please consider using RTP." );
msg_Warn( NULL, "for DVB-IP compliance you should use RTP." );
break;
case 'd':
{
char *psz_token;
......
......@@ -88,6 +88,7 @@ extern int b_tone;
extern int i_bandwidth;
extern char *psz_modulation;
extern int b_budget_mode;
extern int b_output_udp;
extern volatile int b_hup_received;
extern mtime_t i_ca_timeout;
extern int i_comm_fd;
......
......@@ -132,22 +132,36 @@ static void output_Flush( output_t *p_output )
struct iovec p_iov[NB_BLOCKS + 1];
uint8_t p_rtp_hdr[RTP_SIZE];
int i;
int i_outblocks = NB_BLOCKS;
p_iov[0].iov_base = p_rtp_hdr;
p_iov[0].iov_len = sizeof(p_rtp_hdr);
rtp_SetHdr( p_output, p_rtp_hdr );
if ( !b_output_udp )
{
p_iov[0].iov_base = p_rtp_hdr;
p_iov[0].iov_len = sizeof(p_rtp_hdr);
rtp_SetHdr( p_output, p_rtp_hdr );
for ( i = 1; i < NB_BLOCKS + 1; i++ )
{
p_iov[i].iov_base = p_output->pp_blocks[i - 1]->p_ts;
p_iov[i].iov_len = TS_SIZE;
}
for ( i = 1; i < NB_BLOCKS + 1; i++ )
i_outblocks += 1;
}
else
{
p_iov[i].iov_base = p_output->pp_blocks[i - 1]->p_ts;
p_iov[i].iov_len = TS_SIZE;
for ( i = 0; i < NB_BLOCKS; i++ )
{
p_iov[i].iov_base = p_output->pp_blocks[i]->p_ts;
p_iov[i].iov_len = TS_SIZE;
}
}
if ( writev( p_output->i_handle, p_iov, NB_BLOCKS + 1 ) < 0 )
if ( writev( p_output->i_handle, p_iov, i_outblocks ) < 0 )
{
struct in_addr s;
s.s_addr = p_output->i_maddr;
msg_Err( NULL, "coundn't writev to %s:%u (%s)", inet_ntoa( s ),
msg_Err( NULL, "couldn't writev to %s:%u (%s)", inet_ntoa( s ),
p_output->i_port, strerror(errno) );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment