[dvblast-devel] add stream pass-through from config file ('*')

Christophe Massiot git at videolan.org
Tue Jul 28 16:16:56 CEST 2015


dvblast | branch: master | Christophe Massiot <cmassiot at openheadend.tv> | Sat Jul 25 12:45:11 2015 +0200| [5994cd7a462b5bbf1307c9f8b42145f0554c3534] | committer: Christophe Massiot

add stream pass-through from config file ('*')

> http://git.videolan.org/gitweb.cgi/dvblast.git/?a=commit;h=5994cd7a462b5bbf1307c9f8b42145f0554c3534
---

 NEWS      |    1 +
 README    |   14 ++++++++++++--
 demux.c   |   25 ++++++++++++++++++++++---
 dvblast.c |   40 ++++++++++++++++++++++++++++------------
 dvblast.h |    1 +
 5 files changed, 64 insertions(+), 17 deletions(-)

diff --git a/NEWS b/NEWS
index 8b4a6b8..d6142c7 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Changes between 2.2 and 3.0:
   * Added support for multi-delivery system frontends
   * Added support for multistream that appeared in Linux 3.6
   * Added support for Deltacast ASI cards
+  * Added support for stream pass-through from the config file
 
 Changes between 2.1 and 2.2:
 ----------------------------
diff --git a/README b/README
index e4ceaff..48a2432 100644
--- a/README
+++ b/README
@@ -207,8 +207,18 @@ included PAT and PMT may contain ghost programs or ESes.
 All four PIDs are required!
 
 Note that the CAM will not be programmed in that case (unless it has
-been programmed by another line of the config file). The file is read
-from the command-line :
+been programmed by another line of the config file).
+
+5. Pass-through
+
+239.255.0.1:1234	1	*	
+
+The entire received stream will be passed through the output. Please bear in
+mind that when reading from a DVB adapter, hardware PID filtering is used by
+default, so not all packets will be output unless you specify the -u option.
+
+
+The file is read from the command-line :
 
 dvblast -c /tmp/dvblast.conf
 
diff --git a/demux.c b/demux.c
index bc874fd..a11f6eb 100644
--- a/demux.c
+++ b/demux.c
@@ -508,6 +508,17 @@ static void demux_Handle( block_t *p_ts )
         }
     }
 
+    for ( i = 0; i < i_nb_outputs; i++ )
+    {
+        output_t *p_output = pp_outputs[i];
+
+        if ( !(p_output->config.i_config & OUTPUT_VALID) ||
+             !p_output->config.b_passthrough )
+            continue;
+
+        output_Put( p_output, p_ts );
+    }
+
     if ( output_dup.config.i_config & OUTPUT_VALID )
         output_Put( &output_dup, p_ts );
 
@@ -581,7 +592,8 @@ void demux_Change( output_t *p_output, const output_config_t *p_config )
         b_tsid_change = true;
     }
 
-    if ( !b_sid_change && p_config->i_nb_pids == p_output->config.i_nb_pids &&
+    if ( p_config->b_passthrough == p_output->config.b_passthrough &&
+         !b_sid_change && p_config->i_nb_pids == p_output->config.i_nb_pids &&
          (!p_config->i_nb_pids ||
           !memcmp( p_output->config.pi_pids, p_config->pi_pids,
                    p_config->i_nb_pids * sizeof(uint16_t) )) )
@@ -663,6 +675,7 @@ void demux_Change( output_t *p_output, const output_config_t *p_config )
             en50221_UpdatePMT( p_sid->p_current_pmt );
     }
 
+    p_output->config.b_passthrough = p_config->b_passthrough;
     p_output->config.i_sid = i_sid;
     free( p_output->config.pi_pids );
     p_output->config.pi_pids = malloc( sizeof(uint16_t) * i_nb_pids );
@@ -1008,7 +1021,8 @@ static void SendPAT( mtime_t i_dts )
     {
         output_t *p_output = pp_outputs[i];
 
-        if ( !(p_output->config.i_config & OUTPUT_VALID) )
+        if ( !(p_output->config.i_config & OUTPUT_VALID) ||
+             p_output->config.b_passthrough )
             continue;
 
         if ( p_output->p_pat_section == NULL &&
@@ -1077,6 +1091,7 @@ static void SendNIT( mtime_t i_dts )
         output_t *p_output = pp_outputs[i];
 
         if ( (p_output->config.i_config & OUTPUT_VALID)
+               && !p_output->config.b_passthrough
                && (p_output->config.i_config & OUTPUT_DVB)
                && p_output->p_nit_section != NULL )
             OutputPSISection( p_output, p_output->p_nit_section, NIT_PID,
@@ -1096,6 +1111,7 @@ static void SendSDT( mtime_t i_dts )
         output_t *p_output = pp_outputs[i];
 
         if ( (p_output->config.i_config & OUTPUT_VALID)
+               && !p_output->config.b_passthrough
                && (p_output->config.i_config & OUTPUT_DVB)
                && p_output->p_sdt_section != NULL )
             OutputPSISection( p_output, p_output->p_sdt_section, SDT_PID,
@@ -1118,6 +1134,7 @@ static void SendEIT( sid_t *p_sid, mtime_t i_dts, uint8_t *p_eit )
         output_t *p_output = pp_outputs[i];
 
         if ( (p_output->config.i_config & OUTPUT_VALID)
+               && !p_output->config.b_passthrough
                && (p_output->config.i_config & OUTPUT_DVB)
                && (!b_epg || (p_output->config.i_config & OUTPUT_EPG))
                && p_output->config.i_sid == p_sid->i_sid )
@@ -1165,6 +1182,7 @@ static void SendTDT( block_t *p_ts )
         output_t *p_output = pp_outputs[i];
 
         if ( (p_output->config.i_config & OUTPUT_VALID)
+               && !p_output->config.b_passthrough
                && (p_output->config.i_config & OUTPUT_DVB)
                && p_output->p_sdt_section != NULL )
             output_Put( p_output, p_ts );
@@ -1181,7 +1199,8 @@ static void SendEMM( block_t *p_ts )
     {
         output_t *p_output = pp_outputs[i];
 
-        if ( (p_output->config.i_config & OUTPUT_VALID) )
+        if ( (p_output->config.i_config & OUTPUT_VALID)
+               && !p_output->config.b_passthrough )
             output_Put( p_output, p_ts );
     }
 }
diff --git a/dvblast.c b/dvblast.c
index 6ed9d12..0719d3b 100644
--- a/dvblast.c
+++ b/dvblast.c
@@ -147,6 +147,7 @@ void config_Init( output_config_t *p_config )
     p_config->i_srcport = 0;
 
     p_config->pi_pids = NULL;
+    p_config->b_passthrough = false;
     p_config->b_do_remap = false;
     unsigned int i;
     for ( i = 0; i < N_MAP_PIDS; i++ ) {
@@ -324,6 +325,13 @@ end:
 
 static void config_Print( output_config_t *p_config )
 {
+    if ( p_config->b_passthrough )
+    {
+        msg_Dbg( NULL, "conf: %s config=0x%"PRIx64" sid=*",
+                 p_config->psz_displayname, p_config->i_config);
+        return;
+    }
+
     const char *psz_base = "conf: %s config=0x%"PRIx64" sid=%hu pids[%d]=";
     size_t i_len = strlen(psz_base) + 6 * p_config->i_nb_pids + 1;
     char psz_format[i_len];
@@ -396,21 +404,29 @@ void config_ReadFile(void)
             config_Free( &config );
             continue;
         }
-        config.i_sid = strtol(psz_token, NULL, 0);
 
-        psz_token = strtok_r( NULL, "\t\n ", &psz_parser );
-        if ( psz_token != NULL )
+        if ( psz_token[0] == '*' )
+        {
+            config.b_passthrough = true;
+        }
+        else
         {
-            psz_parser = NULL;
-            for ( ; ; )
+            config.i_sid = strtol(psz_token, NULL, 0);
+
+            psz_token = strtok_r( NULL, "\t\n ", &psz_parser );
+            if ( psz_token != NULL )
             {
-                psz_token = strtok_r( psz_token, ",", &psz_parser );
-                if ( psz_token == NULL )
-                    break;
-                config.pi_pids = realloc( config.pi_pids,
-                                 (config.i_nb_pids + 1) * sizeof(uint16_t) );
-                config.pi_pids[config.i_nb_pids++] = strtol(psz_token, NULL, 0);
-                psz_token = NULL;
+                psz_parser = NULL;
+                for ( ; ; )
+                {
+                    psz_token = strtok_r( psz_token, ",", &psz_parser );
+                    if ( psz_token == NULL )
+                        break;
+                    config.pi_pids = realloc( config.pi_pids,
+                                     (config.i_nb_pids + 1) * sizeof(uint16_t) );
+                    config.pi_pids[config.i_nb_pids++] = strtol(psz_token, NULL, 0);
+                    psz_token = NULL;
+                }
             }
         }
 
diff --git a/dvblast.h b/dvblast.h
index 14fcc09..b7ff883 100644
--- a/dvblast.h
+++ b/dvblast.h
@@ -140,6 +140,7 @@ typedef struct output_config_t
     uint16_t *pi_pids;
     int i_nb_pids;
     uint16_t i_new_sid;
+    bool b_passthrough;
 
     /* for pidmap from config file */
     bool b_do_remap;



More information about the dvblast-devel mailing list