]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvb_psi: add ATSC STT parsing (no data is stored though)
authorLauri Myllari <lauri.myllari@gmail.com>
Mon, 12 Jan 2015 05:05:03 +0000 (21:05 -0800)
committerJaroslav Kysela <perex@perex.cz>
Thu, 22 Oct 2015 15:33:59 +0000 (17:33 +0200)
src/input/mpegts.h
src/input/mpegts/dvb.h
src/input/mpegts/dvb_psi.c

index 0f61f3cabfee5a812245a1ffecebce91f962fa8c..c156b3ea69258f92caf56eab73464c22e89fa03f 100644 (file)
@@ -153,6 +153,7 @@ typedef struct mpegts_pid_sub
 #define MPS_WEIGHT_NIT      999
 #define MPS_WEIGHT_BAT      999
 #define MPS_WEIGHT_VCT      999
+#define MPS_WEIGHT_STT      999
 #define MPS_WEIGHT_EIT      999
 #define MPS_WEIGHT_PMT      998
 #define MPS_WEIGHT_PCR      997
@@ -989,6 +990,8 @@ int dvb_tot_callback
   (struct mpegts_table *mt, const uint8_t *ptr, int len, int tableid);
 int atsc_vct_callback
   (struct mpegts_table *mt, const uint8_t *ptr, int len, int tableid);
+int atsc_stt_callback
+  (struct mpegts_table *mt, const uint8_t *ptr, int len, int tableid);
 
 void psi_tables_install
   (mpegts_input_t *mi, mpegts_mux_t *mm, dvb_fe_delivery_system_t delsys);
index 9ca170ae95516e4713f49f2e0990eb557e4c06c1..1e1084991550c17a4bbd3efaf931e324a1b6e843 100644 (file)
@@ -48,6 +48,7 @@ struct mpegts_mux;
 #define DVB_DIT_PID                   0x1E
 #define DVB_SIT_PID                   0x1F
 #define DVB_VCT_PID                   0x1FFB
+#define DVB_ATSC_STT_PID              0x1FFB
 #define DVB_ATSC_MGT_PID              0x1FFB
 
 /* Tables */
@@ -93,6 +94,9 @@ struct mpegts_mux;
 #define DVB_ATSC_ETT_BASE             0xCC
 #define DVB_ATSC_ETT_MASK             0xFF
 
+#define DVB_ATSC_STT_BASE             0xCD
+#define DVB_ATSC_STT_MASK             0xFF
+
 #define DVB_TELETEXT_BASE             0x2000
 
 /* Descriptors */
index 32288a1a1e3e549546540881d3b716dbf6d2a1eb..105b20681aae72eaec575da533453a980ffb4c2d 100644 (file)
@@ -1718,6 +1718,39 @@ next:
   return dvb_table_end((mpegts_psi_table_t *)mt, st, sect);
 }
 
+/*
+ * ATSC STT processing
+ */
+int
+atsc_stt_callback
+  (mpegts_table_t *mt, const uint8_t *ptr, int len, int tableid)
+{
+  int r, sect, last, ver, extraid;
+  uint32_t systemtime, gps_utc_offset;
+  int is_dst;
+  mpegts_table_state_t  *st  = NULL;
+
+  /* Validate */
+  if (tableid != DVB_ATSC_STT_BASE) return -1;
+
+  /* Extra ID */
+  extraid = ptr[0] << 8 | ptr[1];
+
+  /* Begin */
+  r = dvb_table_begin(mt, ptr, len, tableid, extraid, 7,
+                      &st, &sect, &last, &ver);
+  if (r != 1) return r;
+
+  /* Parse fields */
+  systemtime = ptr[6] << 24 | ptr[7] << 16 | ptr[8] << 8 | ptr[9];
+  gps_utc_offset = ptr[10];
+  is_dst = ptr[11] >> 7;
+
+  tvhdebug("stt", "system_time %d, gps_utc_offset %d, is DST %d",
+      systemtime, gps_utc_offset, is_dst);
+
+  return dvb_table_end(mt, st, sect);
+}
 
 /*
  * DVB BAT processing
@@ -2490,6 +2523,9 @@ psi_tables_atsc_c ( mpegts_mux_t *mm )
   mpegts_table_add(mm, DVB_VCT_C_BASE, DVB_VCT_MASK, atsc_vct_callback,
                    NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
                    DVB_VCT_PID, MPS_WEIGHT_VCT);
+  mpegts_table_add(mm, DVB_ATSC_STT_BASE, DVB_ATSC_STT_MASK, atsc_stt_callback,
+                   NULL, "stt", MT_QUICKREQ | MT_CRC | MT_RECORD,
+                   DVB_ATSC_STT_PID, MPS_WEIGHT_STT);
 }
 
 static void
@@ -2498,6 +2534,9 @@ psi_tables_atsc_t ( mpegts_mux_t *mm )
   mpegts_table_add(mm, DVB_VCT_T_BASE, DVB_VCT_MASK, atsc_vct_callback,
                    NULL, "vct", MT_QUICKREQ | MT_CRC | MT_RECORD,
                    DVB_VCT_PID, MPS_WEIGHT_VCT);
+  mpegts_table_add(mm, DVB_ATSC_STT_BASE, DVB_ATSC_STT_MASK, atsc_stt_callback,
+                   NULL, "stt", MT_QUICKREQ | MT_CRC | MT_RECORD,
+                   DVB_ATSC_STT_PID, MPS_WEIGHT_STT);
 }
 
 void