[vlc-commits] demux: ts: add custom ETT decoder

Francois Cartegnie git at videolan.org
Sat Feb 13 15:57:04 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Feb 11 18:02:28 2016 +0100| [5723baeb629156c08121ab3d6a0d869430ea10fb] | committer: Francois Cartegnie

demux: ts: add custom ETT decoder

because we need to ignore extension id

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5723baeb629156c08121ab3d6a0d869430ea10fb
---

 modules/demux/mpeg/ts_psip_dvbpsi_fixes.c |   32 +++++++++++++++++++++++++++++
 modules/demux/mpeg/ts_psip_dvbpsi_fixes.h |    1 +
 2 files changed, 33 insertions(+)

diff --git a/modules/demux/mpeg/ts_psip_dvbpsi_fixes.c b/modules/demux/mpeg/ts_psip_dvbpsi_fixes.c
index d939962..bd41186 100644
--- a/modules/demux/mpeg/ts_psip_dvbpsi_fixes.c
+++ b/modules/demux/mpeg/ts_psip_dvbpsi_fixes.c
@@ -28,6 +28,7 @@
 #include <dvbpsi/psi.h>
 #include <dvbpsi/descriptor.h>
 #include <dvbpsi/atsc_stt.h>
+#include <dvbpsi/atsc_ett.h>
 
 #include "ts_psip_dvbpsi_fixes.h"
 
@@ -53,3 +54,34 @@ dvbpsi_atsc_stt_t * DVBPlague_STT_Decode( const dvbpsi_psi_section_t* p_section
 
     return NULL;
 }
+
+dvbpsi_atsc_ett_t * DVBPlague_ETT_Decode( const dvbpsi_psi_section_t* p_section )
+{
+    size_t i_payload = p_section->p_payload_end - p_section->p_payload_start;
+    if( i_payload >= 6 && p_section->p_payload_start[0] == 0x00 )
+    {
+        dvbpsi_atsc_ett_t *p_ett =
+                dvbpsi_atsc_NewETT( ATSC_ETT_TABLE_ID, p_section->i_extension,
+                                    p_section->i_version, 0x00,
+                                    GetDWBE( &p_section->p_payload_start[1] ), true );
+        if(unlikely(!p_ett))
+            return NULL;
+
+        p_ett->i_etm_length = i_payload - 5;
+        p_ett->p_etm_data = malloc(p_ett->i_etm_length);
+        if( likely(p_ett->p_etm_data) )
+        {
+            memcpy( p_ett->p_etm_data, &p_section->p_payload_start[5], p_ett->i_etm_length );
+        }
+        else
+        {
+            p_ett->i_etm_length = 0;
+            dvbpsi_atsc_DeleteETT( p_ett );
+            p_ett = NULL;
+        }
+
+        return p_ett;
+    }
+
+    return NULL;
+}
diff --git a/modules/demux/mpeg/ts_psip_dvbpsi_fixes.h b/modules/demux/mpeg/ts_psip_dvbpsi_fixes.h
index 6d26bee..7a37f75 100644
--- a/modules/demux/mpeg/ts_psip_dvbpsi_fixes.h
+++ b/modules/demux/mpeg/ts_psip_dvbpsi_fixes.h
@@ -20,5 +20,6 @@
 #define VLC_TS_PSIP_DVBPSI_FIXES_H
 
 dvbpsi_atsc_stt_t * DVBPlague_STT_Decode( const dvbpsi_psi_section_t* p_section );
+dvbpsi_atsc_ett_t * DVBPlague_ETT_Decode( const dvbpsi_psi_section_t* p_section );
 
 #endif



More information about the vlc-commits mailing list