[bTSstream-devel] add DVB subtitles (very basic)

Christophe Massiot git at videolan.org
Mon Mar 10 12:17:19 CET 2014


bitstream | branch: master | Christophe Massiot <cmassiot at openheadend.tv> | Mon Mar 10 12:17:08 2014 +0100| [c0a424f9fbb674b016395e07962b3b3e2e498e08] | committer: Christophe Massiot

add DVB subtitles (very basic)

> http://git.videolan.org/gitweb.cgi/bitstream.git/?a=commit;h=c0a424f9fbb674b016395e07962b3b3e2e498e08
---

 dvb/ci.h           |    4 +--
 dvb/si/desc_46.h   |    6 ++++
 dvb/si/desc_56.h   |    6 ++++
 dvb/sub.h          |   80 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 mpeg/psi/desc_0a.h |    1 +
 5 files changed, 95 insertions(+), 2 deletions(-)

diff --git a/dvb/ci.h b/dvb/ci.h
index 86e94a7..f7a6868 100644
--- a/dvb/ci.h
+++ b/dvb/ci.h
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * ci.h: ETSI EN 50 221 Common Interface Specification
+ * ci.h: CENELEC EN 50 221 Common Interface Specification
  *****************************************************************************
  * Copyright (C) 2010 VideoLAN
  *
@@ -27,7 +27,7 @@
 
 /*
  * Normative references:
- *  - ETSI EN 50 221 (1997) (Common Interface Specification)
+ *  - CENELEC EN 50 221 (1997) (Common Interface Specification)
  */
 
 #ifndef __BITSTREAM_DVB_CI_H__
diff --git a/dvb/si/desc_46.h b/dvb/si/desc_46.h
index bb50b16..af1f7d6 100644
--- a/dvb/si/desc_46.h
+++ b/dvb/si/desc_46.h
@@ -49,6 +49,12 @@ extern "C"
 #define DESC46_HEADER_SIZE      DESC_HEADER_SIZE
 #define DESC46_LANGUAGE_SIZE    5
 
+#define DESC46_TELETEXTTYPE_INITIAL     1
+#define DESC46_TELETEXTTYPE_SUBTITLE    2
+#define DESC46_TELETEXTTYPE_INFORMATION 3
+#define DESC46_TELETEXTTYPE_SCHEDULE    4
+#define DESC46_TELETEXTTYPE_SUBTITLE_H  5
+
 static inline void desc46_init(uint8_t *p_desc)
 {
     desc_set_tag(p_desc, 0x46);
diff --git a/dvb/si/desc_56.h b/dvb/si/desc_56.h
index ac13ded..bf19b58 100644
--- a/dvb/si/desc_56.h
+++ b/dvb/si/desc_56.h
@@ -48,6 +48,12 @@ extern "C"
 #define DESC56_HEADER_SIZE      DESC46_HEADER_SIZE
 #define DESC56_LANGUAGE_SIZE    DESC46_LANGUAGE_SIZE
 
+#define DESC56_TELETEXTTYPE_INITIAL     DESC46_TELETEXTTYPE_INITIAL
+#define DESC56_TELETEXTTYPE_SUBTITLE    DESC46_TELETEXTTYPE_SUBTITLE
+#define DESC56_TELETEXTTYPE_INFORMATION DESC46_TELETEXTTYPE_INFORMATION
+#define DESC56_TELETEXTTYPE_SCHEDULE    DESC46_TELETEXTTYPE_SCHEDULE
+#define DESC56_TELETEXTTYPE_SUBTITLE_H  DESC46_TELETEXTTYPE_SUBTITLE_H
+
 static inline void desc56_init(uint8_t *p_desc)
 {
     desc_set_tag(p_desc, 0x56);
diff --git a/dvb/sub.h b/dvb/sub.h
new file mode 100644
index 0000000..228dde8
--- /dev/null
+++ b/dvb/sub.h
@@ -0,0 +1,80 @@
+/*****************************************************************************
+ * sub.h: ETSI EN 300 743 Subtitling Systems
+ *****************************************************************************
+ * Copyright (C) 2014 VideoLAN
+ *
+ * Authors: Christophe Massiot <massiot at via.ecp.fr>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject
+ * to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *****************************************************************************/
+
+/*
+ * Normative references:
+ *  - ETSI EN 300 743 V1.5.1 (2014-01) (Subtitling Systems)
+ */
+
+#ifndef __BITSTREAM_DVB_SUB_H__
+#define __BITSTREAM_DVB_SUB_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/*****************************************************************************
+ * PES data field
+ *****************************************************************************/
+#define DVBSUB_HEADER_SIZE      2
+#define DVBSUB_DATA_IDENTIFIER  0x20
+
+/*****************************************************************************
+ * Subtitling segment
+ *****************************************************************************/
+#define DVBSUBS_HEADER_SIZE     6
+#define DVBSUBS_SYNC            0xf
+
+#define DVBSUBS_PAGE_COMPOSITION        0x10
+#define DVBSUBS_REGION_COMPOSITION      0x11
+#define DVBSUBS_CLUT_DEFINITION         0x12
+#define DVBSUBS_OBJECT_DATA             0x13
+#define DVBSUBS_DISPLAY_DEFINITION      0x14
+#define DVBSUBS_DISPARITY_SIGNALLING    0x15
+#define DVBSUBS_END_OF_DISPLAY_SET      0x80
+
+static inline uint8_t dvbsubs_get_type(const uint8_t *p_dvbsubs)
+{
+    return p_dvbsubs[1];
+}
+
+static inline uint16_t dvbsubs_get_page(const uint8_t *p_dvbsubs)
+{
+    return (p_dvbsubs[2] << 8) | p_dvbsubs[3];
+}
+
+static inline uint16_t dvbsubs_get_length(const uint8_t *p_dvbsubs)
+{
+    return (p_dvbsubs[4] << 8) | p_dvbsubs[5];
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/mpeg/psi/desc_0a.h b/mpeg/psi/desc_0a.h
index 75d3005..5552f09 100644
--- a/mpeg/psi/desc_0a.h
+++ b/mpeg/psi/desc_0a.h
@@ -48,6 +48,7 @@ extern "C"
 #define DESC0A_HEADER_SIZE      DESC_HEADER_SIZE
 #define DESC0A_LANGUAGE_SIZE    4
 
+#define DESC0A_TYPE_UNDEFINED   0x0
 #define DESC0A_TYPE_CLEAN       0x1
 #define DESC0A_TYPE_HEARING_IMP 0x2
 #define DESC0A_TYPE_VISUAL_IMP  0x3



More information about the biTStream-devel mailing list