[vlc-devel] [PATCH 1/3] aribcam: ARIB STD-B25 compliant TS packet is always 188 bytes length

Kazuki Yamaguchi k at rhe.jp
Mon Feb 15 16:33:27 CET 2016


ARIB STD-B25 [1] says associated information must be transmitted in
compliance with the Ministry of Internal Affairs and Communications
Notification No. 223, 2014 [2], which says the TS packet size is 188
bytes.

[1] http://www.arib.or.jp/english/html/overview/doc/2-STD-B25v6_5.pdf
(p.315, Japanese)
[2] http://www.soumu.go.jp/main_content/000353390.pdf (p.14, Japanese)
---
 modules/stream_filter/aribcam.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/modules/stream_filter/aribcam.c b/modules/stream_filter/aribcam.c
index 20fc7be..b5ff755 100644
--- a/modules/stream_filter/aribcam.c
+++ b/modules/stream_filter/aribcam.c
@@ -94,8 +94,6 @@ struct stream_sys_t
         size_t   i_size;
         block_t *p_list;
     } remain;
-
-    bool   b_unitsizeset;
 };
 
 static const char * GetErrorMessage( const int i_error,
@@ -239,19 +237,6 @@ static int DecoderRead( stream_t *p_stream, uint8_t *p_dst, int i_toread )
 static ssize_t Read( stream_t *p_stream, void *p_buf, size_t i_toread )
 {
     stream_sys_t *p_sys = p_stream->p_sys;
-
-    /* We force unit size from 1st TS packet as the lib wants to auto detect
-       size but requires larger amount of data for that purpose */
-    if ( !p_sys->b_unitsizeset )
-    {
-        if ( i_toread >= 188 && i_toread <= 320 )
-            p_sys->b_unitsizeset = ! p_sys->p_b25->set_unit_size( p_sys->p_b25, i_toread );
-        if ( !p_sys->b_unitsizeset )
-            msg_Warn( p_stream, "Unit size not set." );
-        else
-            msg_Dbg( p_stream, "Set unit size to %u", i_toread );
-    }
-
     int i_read = DecoderRead( p_stream, p_buf, i_toread );
     if ( i_read < 0 )
         return -1;
@@ -302,6 +287,10 @@ static int Open( vlc_object_t *p_object )
         if ( p_sys->p_b25->set_emm_proc( p_sys->p_b25, 0 ) < 0 )
             msg_Warn( p_stream, "cannot set B25 emm_proc" );
 
+        /* ARIB STD-B25 scrambled TS's packet size is always 188 bytes */
+        if ( p_sys->p_b25->set_unit_size( p_sys->p_b25, 188 ) < 0)
+            msg_Warn( p_stream, "cannot set B25 TS packet size" );
+
         p_sys->p_bcas = create_b_cas_card();
         if ( p_sys->p_bcas )
         {
-- 
2.7.0



More information about the vlc-devel mailing list