[dvblast-devel] [PATCH] Improved preserve original TS ID

Marian Ďurkovič md at bts.sk
Wed Sep 30 11:02:19 CEST 2009


On Wed, Sep 30, 2009 at 10:37:59AM +0200, Christophe Massiot wrote:
> >   Thus I believe that keeping the original TSID has clear benefits and therefore
> > I haven't made it optional in my patch. But if there are other requirements, we
> > should certainly go for a new CLI switch - however the open questions are what
> > should be the default and whether rewriting TSID with SID satisfies the intended
> > purpose.
> 
> The current behaviour could indeed become optional.

OK, attached is a patch which implements this, i.e. TSID is preserved by
default and set to SID when -T switch was given.

    With kind regards,

        M.
-------------- next part --------------
Index: dvblast.c
===================================================================
--- dvblast.c	(revision 19)
+++ dvblast.c	(working copy)
@@ -5,6 +5,7 @@
  * $Id$
  *
  * Authors: Christophe Massiot <massiot at via.ecp.fr>
+ *          Andy Gatward <a.j.gatward at reading.ac.uk>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -56,6 +57,7 @@
 int b_budget_mode = 0;
 int b_output_udp = 0;
 int b_enable_epg = 0;
+int b_unique_tsid = 0;
 volatile int b_hup_received = 0;
 int i_verbose = DEFAULT_VERBOSITY;
 
@@ -184,7 +186,7 @@
  *****************************************************************************/
 void usage()
 {
-    msg_Raw( NULL, "Usage: dvblast [-q] -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>] [-e]" );
+    msg_Raw( NULL, "Usage: dvblast [-q] -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>] [-e] [-T]" );
     msg_Raw( NULL, "    -q: be quiet (less verbosity, repeat or use number for even quieter)" );
     msg_Raw( NULL, "    -v: voltage to apply to the LNB (QPSK)" );
     msg_Raw( NULL, "    -p: force 22kHz pulses for high-band selection (DVB-S)" );
@@ -195,6 +197,7 @@
     msg_Raw( NULL, "    -U: use raw UDP rather than RTP (required by some IPTV set top boxes)" );
     msg_Raw( NULL, "    -d: duplicate all received packets to a given port" );
     msg_Raw( NULL, "    -e: enable EPG pass through (EIT data)" );
+    msg_Raw( NULL, "    -T: generate unique TS ID for each program" );
     exit(1);
 }
 
@@ -209,7 +212,7 @@
 
     msg_Warn( NULL, "restarting" );
 
-    while ( ( c = getopt(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:s:v:pb:m:uUd:eh")) != (char)EOF )
+    while ( ( c = getopt(i_argc, pp_argv, "q::c:r:t:o:i:a:n:f:s:v:pb:m:uUTd:eh")) != (char)EOF )
     {
         switch ( c )
         {
@@ -321,6 +324,10 @@
             b_enable_epg = 1;
             break;
 
+        case 'T':
+            b_unique_tsid = 1;
+            break;
+
         case 'h':
         default:
             usage();
Index: dvblast.h
===================================================================
--- dvblast.h	(revision 19)
+++ dvblast.h	(working copy)
@@ -95,6 +95,7 @@
 extern int b_budget_mode;
 extern int b_output_udp;
 extern int b_enable_epg;
+extern int b_unique_tsid;
 extern volatile int b_hup_received;
 extern mtime_t i_ca_timeout;
 extern int i_comm_fd;
Index: demux.c
===================================================================
--- demux.c	(revision 19)
+++ demux.c	(working copy)
@@ -744,8 +755,12 @@
     {
         if ( pp_outputs[i]->i_maddr && pp_outputs[i]->i_sid == i_sid )
         {
-            p_section->p_data[8]  = (i_sid >> 8) & 0xff;
-            p_section->p_data[9]  = i_sid & 0xff;
+            if( b_unique_tsid )
+            {
+                p_section->p_data[8]  = (i_sid >> 8) & 0xff;
+                p_section->p_data[9]  = i_sid & 0xff;
+            }
+
             dvbpsi_BuildPSISection( p_section );
 
             block_t *p_block;
@@ -795,7 +810,11 @@
         return;
     }
 
-    dvbpsi_InitPAT( &pat, p_output->i_sid, p_output->i_pat_version, 1 );
+    if ( b_unique_tsid )
+        dvbpsi_InitPAT( &pat, p_output->i_sid, p_output->i_pat_version, 1 );
+    else
+        dvbpsi_InitPAT( &pat, p_current_pat->i_ts_id, p_output->i_pat_version, 1 );
+
     dvbpsi_PATAddProgram( &pat, p_output->i_sid, p_program->i_pid );
 
     p_output->p_pat_section = dvbpsi_GenPATSections( &pat, 0 );
@@ -1292,9 +1311,15 @@
             {
                 p_new_sdt = malloc(sizeof(dvbpsi_sdt_t));
 
-                dvbpsi_InitSDT( p_new_sdt, p_service->i_service_id,
-                                p_sdt->i_version, p_sdt->b_current_next,
-                                p_sdt->i_network_id );
+                if ( b_unique_tsid )
+                    dvbpsi_InitSDT( p_new_sdt, p_service->i_service_id,
+                                    p_sdt->i_version, p_sdt->b_current_next,
+                                    p_sdt->i_network_id );
+                else
+                    dvbpsi_InitSDT( p_new_sdt, p_sdt->i_ts_id,
+                                    p_sdt->i_version, p_sdt->b_current_next,
+                                    p_sdt->i_network_id );
+
                 p_new_service = dvbpsi_SDTAddService( p_new_sdt,
                     p_service->i_service_id, p_service->b_eit_schedule,
                     p_service->b_eit_present, p_service->i_running_status, 0 );


More information about the dvblast-devel mailing list