[bTSstream-devel] [Git][videolan/bitstream][master] 5 commits: scte/35: add time descriptor

Christophe Massiot (@cmassiot) gitlab at videolan.org
Wed Mar 5 10:51:20 UTC 2025



Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
7365a98c by Arnaud de Turckheim at 2025-03-03T18:13:48+01:00
scte/35: add time descriptor

- - - - -
c8cb5722 by Arnaud de Turckheim at 2025-03-05T11:51:08+01:00
dvb/si/desc_6f: fix typo

- - - - -
62415e8f by Arnaud de Turckheim at 2025-03-05T11:51:08+01:00
dvb/si: add AIT

- - - - -
f2ad50c9 by Arnaud de Turckheim at 2025-03-05T11:51:08+01:00
scte/35: add avail splice descriptor helpers

- - - - -
fc71ca6d by Christophe Massiot at 2025-03-05T11:51:14+01:00
Merge branch 'quarium-time-desc'

- - - - -


1 changed file:

- scte/35.h


Changes:

=====================================
scte/35.h
=====================================
@@ -674,6 +674,7 @@ static inline bool scte35_private_validate(const uint8_t *p_scte35)
 #define SCTE35_SPLICE_DESC_TAG_AVAIL    0x00
 #define SCTE35_SPLICE_DESC_TAG_DTMF     0x01
 #define SCTE35_SPLICE_DESC_TAG_SEG      0x02
+#define SCTE35_SPLICE_DESC_TAG_TIME     0x03
 
 #define scte35_splice_desc_get_tag      desc_get_tag
 #define scte35_splice_desc_set_tag      desc_set_tag
@@ -1405,6 +1406,68 @@ static inline void scte35_seg_desc_set_sub_expected(uint8_t *p_desc,
         p[4] = value;
 }
 
+/*****************************************************************************
+ * Splice Information Table - time descriptor
+ *****************************************************************************/
+#define SCTE35_TIME_DESC_HEADER_SIZE        16
+
+static inline uint64_t scte35_time_desc_get_tai_sec(const uint8_t *p_desc)
+{
+    return ((uint64_t)p_desc[6] << 40) | ((uint64_t)p_desc[7] << 32) |
+        (p_desc[8] << 24) | (p_desc[9] << 16) | (p_desc[10] << 8) | p_desc[11];
+}
+
+static inline void scte35_time_desc_set_tai_sec(uint8_t *p_desc,
+                                                uint64_t tai_sec)
+{
+    p_desc[6] = (tai_sec >> 40) & 0xff;
+    p_desc[7] = (tai_sec >> 32) & 0xff;
+    p_desc[8] = (tai_sec >> 24) & 0xff;
+    p_desc[9] = (tai_sec >> 16) & 0xff;
+    p_desc[10] = (tai_sec >> 8) & 0xff;
+    p_desc[11] = tai_sec & 0xff;
+}
+
+static inline uint32_t scte35_time_desc_get_tai_ns(const uint8_t *p_desc)
+{
+    return ((uint32_t)p_desc[12] << 24) | (p_desc[13] << 16) |
+        (p_desc[14] << 8) | p_desc[15];
+}
+
+static inline void scte35_time_desc_set_tai_ns(uint8_t *p_desc,
+                                               uint32_t tai_ns)
+{
+    p_desc[12] = (tai_ns >> 24) & 0xff;
+    p_desc[13] = (tai_ns >> 16) & 0xff;
+    p_desc[14] = (tai_ns >> 8) & 0xff;
+    p_desc[15] = tai_ns & 0xff;
+}
+
+static inline uint16_t scte35_time_desc_get_utc_off(const uint8_t *p_desc)
+{
+    return ((uint16_t)p_desc[16] << 8) | p_desc[17];
+}
+
+static inline void scte35_time_desc_set_utc_off(uint8_t *p_desc,
+                                               uint16_t utc_off)
+{
+    p_desc[16] = (utc_off >> 8) & 0xff;
+    p_desc[17] = utc_off & 0xff;
+}
+
+static inline void scte35_time_desc_init(uint8_t *p_desc)
+{
+    scte35_splice_desc_set_tag(p_desc, SCTE35_SPLICE_DESC_TAG_TIME);
+    scte35_splice_desc_set_length(p_desc,
+                                  SCTE35_SPLICE_DESC_HEADER_SIZE -
+                                  DESC_HEADER_SIZE +
+                                  SCTE35_TIME_DESC_HEADER_SIZE);
+    scte35_splice_desc_set_identifier(p_desc, SCTE35_SPLICE_DESC_IDENTIFIER);
+    scte35_time_desc_set_tai_sec(p_desc, 0);
+    scte35_time_desc_set_tai_ns(p_desc, 0);
+    scte35_time_desc_set_utc_off(p_desc, 0);
+}
+
 /*****************************************************************************
  * Splice Information Table validation
  *****************************************************************************/



View it on GitLab: https://code.videolan.org/videolan/bitstream/-/compare/2944df2f18e761b78af95e7f33adfacf15097ca8...fc71ca6d9da88e82ada96588ebf2e121cd3ad583

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/-/compare/2944df2f18e761b78af95e7f33adfacf15097ca8...fc71ca6d9da88e82ada96588ebf2e121cd3ad583
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the biTStream-devel mailing list