From 17ed696faae40a90bfbc1afbe948cd80199ab061 Mon Sep 17 00:00:00 2001 From: Steve Maynard Date: Fri, 27 Sep 2013 14:45:00 +0000 Subject: [PATCH] mpegts: Add SCTE/EISS sections and table types https://bugzilla.gnome.org/show_bug.cgi?id=708688 --- gst-libs/gst/mpegts/Makefile.am | 2 + gst-libs/gst/mpegts/gst-scte-section.h | 100 +++++++++++++++++++++++++ gst-libs/gst/mpegts/gstmpegtssection.h | 3 +- gst-libs/gst/mpegts/mpegts.h | 1 + gst-plugins-bad.spec.in | 1 + gst/mpegtsdemux/gstmpegdesc.h | 1 + gst/mpegtsdemux/mpegtsbase.c | 22 ++++++ 7 files changed, 129 insertions(+), 1 deletion(-) create mode 100644 gst-libs/gst/mpegts/gst-scte-section.h diff --git a/gst-libs/gst/mpegts/Makefile.am b/gst-libs/gst/mpegts/Makefile.am index c89f37e685..14f2b7105d 100644 --- a/gst-libs/gst/mpegts/Makefile.am +++ b/gst-libs/gst/mpegts/Makefile.am @@ -15,6 +15,7 @@ libgstmpegts_@GST_API_VERSION@include_HEADERS = \ gstmpegtssection.h \ gst-atsc-section.h \ gst-dvb-section.h \ + gst-scte-section.h \ gstmpegtsdescriptor.h \ gst-dvb-descriptor.h \ mpegts.h @@ -38,6 +39,7 @@ glib_enum_headers=gstmpegtssection.h \ gstmpegtsdescriptor.h \ gst-atsc-section.h \ gst-dvb-section.h \ + gst-scte-section.h \ gst-dvb-descriptor.h glib_enum_define=GST_MPEGTS diff --git a/gst-libs/gst/mpegts/gst-scte-section.h b/gst-libs/gst/mpegts/gst-scte-section.h new file mode 100644 index 0000000000..344ab14f64 --- /dev/null +++ b/gst-libs/gst/mpegts/gst-scte-section.h @@ -0,0 +1,100 @@ +/* + * gst-scte-section.h - + * Copyright (C) 2013, CableLabs, Louisville, CO 80027 + * + * Authors: + * RUIH Team + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifndef GST_SCTE_SECTION_H +#define GST_SCTE_SECTION_H + +#include +#include +#include + + +/** + * GstMpegTsScteStreamType: + * @GST_MPEG_TS_STREAM_TYPE_SCTE_SUBTITLING: SCTE-27 Subtitling + * @GST_MPEG_TS_STREAM_TYPE_SCTE_ISOCH_DATA: SCTE-19 Isochronous data + * @GST_MPEG_TS_STREAM_TYPE_SCTE_DST_NRT: SCTE-07 Data Service or + * Network Resource Table + * @GST_MPEG_TS_STREAM_TYPE_SCTE_DSMCC_DCB: Type B - DSM-CC Data Carousel + * [IEC 13818-6]) + * @GST_MPEG_TS_STREAM_TYPE_SCTE_SIGNALING: Enhanced Television Application + * Signaling (OC-SP-ETV-AM1.0.1-120614) + * @GST_MPEG_TS_STREAM_TYPE_SCTE_SYNC_DATA: SCTE-07 Synchronous data + * @GST_MPEG_TS_STREAM_TYPE_SCTE_ASYNC_DATA: SCTE-53 Asynchronous data + * + * Type of mpeg-ts streams for SCTE + * + */ +typedef enum { + + /* 0x01 - 0x82 : defined in other specs */ + GST_MPEG_TS_STREAM_TYPE_SCTE_SUBTITLING = 0x82, /* Subtitling data */ + GST_MPEG_TS_STREAM_TYPE_SCTE_ISOCH_DATA = 0x83, /* Isochronous data */ + /* 0x84 - 0x94 : defined in other specs */ + GST_MPEG_TS_STREAM_TYPE_SCTE_DST_NRT = 0x95, /* DST / NRT data */ + /* 0x96 - 0xaf : defined in other specs */ + GST_MPEG_TS_STREAM_TYPE_SCTE_DSMCC_DCB = 0xb0, /* Data Carousel Type B */ + /* 0xb1 - 0xbf : User Private (or defined in other specs) */ + GST_MPEG_TS_STREAM_TYPE_SCTE_SIGNALING = 0xc0, /* EBIF Signaling */ + GST_MPEG_TS_STREAM_TYPE_SCTE_SYNC_DATA = 0xc2, /* Synchronous data */ + GST_MPEG_TS_STREAM_TYPE_SCTE_ASYNC_DATA = 0xc3, /* Asynchronous data */ + /* 0xc4 - 0xff : User Private (or defined in other specs) */ + +} GstMpegTsScteStreamType; + + +/** + * GstMpegTsSectionSCTETableID: + * @GST_MTS_TABLE_ID_SCTE_EAS: SCTE-18 Emergency Alert System + * @GST_MTS_TABLE_ID_SCTE_EBIF: CL-SP-ETV-AM 1.0.1 EBIF message + * @GST_MTS_TABLE_ID_SCTE_EISS: CL-SP-ETV-AM 1.0.1 EBIF Int. Signaling Sect. + * @GST_MTS_TABLE_ID_SCTE_DII: CL-SP-ETV-AM 1.0.1 DSMCC DII message + * @GST_MTS_TABLE_ID_SCTE_DDB: CL-SP-ETV-AM 1.0.1 DSMCC Data Download Block + * @GST_MTS_TABLE_ID_SCTE_SPLICE: SCTE-35 splice information is carried in a + * section stream on a separate PID in the program’s Map Table (PMT) allowing + * Splice Event notifications to remain associated with the program and pass + * through multiplexers. + * + * Values for a #GstMpegTsSection table_id. + * + * These are the registered SCTE table_id variants. + * + * see also: #GstMpegTsSectionTableID + */ +typedef enum { + + /* 0x01 - 0xd7 : defined in other specs */ + GST_MTS_TABLE_ID_SCTE_EAS = 0xd8, /* emergency alert information */ + /* 0xd8 - 0xdf : defined in other specs */ + GST_MTS_TABLE_ID_SCTE_EBIF = 0xE0, /* EBIF message */ + GST_MTS_TABLE_ID_SCTE_RESERVED = 0xE1, + GST_MTS_TABLE_ID_SCTE_EISS = 0xE2, /* EBIF Int. Signaling Sect. */ + GST_MTS_TABLE_ID_SCTE_DII = 0xE3, /* DSMCC DII message */ + GST_MTS_TABLE_ID_SCTE_DDB = 0xE4, /* DSMCC Data Download Block */ + /* 0xe5 - 0xfb : defined in other specs */ + GST_MTS_TABLE_ID_SCTE_SPLICE = 0xfc, /* splice information table */ + +} GstMpegTsSectionSCTETableID; + +#endif /* GST_SCTE_SECTION_H */ + diff --git a/gst-libs/gst/mpegts/gstmpegtssection.h b/gst-libs/gst/mpegts/gstmpegtssection.h index c7b9677d3b..c6a7d58092 100644 --- a/gst-libs/gst/mpegts/gstmpegtssection.h +++ b/gst-libs/gst/mpegts/gstmpegtssection.h @@ -73,7 +73,8 @@ typedef enum { * * These are the registered ITU H.222.0 | ISO/IEC 13818-1 table_id variants. * - * see also #GstMpegTsSectionATSCTableID and #GstMpegTsSectionDVBTableID. + * see also #GstMpegTsSectionATSCTableID, #GstMpegTsSectionDVBTableID, and + * #GstMpegTsSectionSCTETableID */ typedef enum { /* ITU H.222.0 / IEC 13818-1 */ diff --git a/gst-libs/gst/mpegts/mpegts.h b/gst-libs/gst/mpegts/mpegts.h index 95c1d02215..eaabb762a9 100644 --- a/gst-libs/gst/mpegts/mpegts.h +++ b/gst-libs/gst/mpegts/mpegts.h @@ -34,6 +34,7 @@ #include #include #include +#include #include void gst_mpegts_initialize (void); diff --git a/gst-plugins-bad.spec.in b/gst-plugins-bad.spec.in index e79105399e..dc023c71c4 100644 --- a/gst-plugins-bad.spec.in +++ b/gst-plugins-bad.spec.in @@ -325,6 +325,7 @@ make ERROR_CFLAGS='' ERROR_CXXFLAGS='' %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gst-atsc-section.h %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gst-dvb-descriptor.h %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gst-dvb-section.h +%{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gst-scte-section.h %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gstmpegtsdescriptor.h %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/gstmpegtssection.h %{_includedir}/gstreamer-%{majorminor}/gst/mpegts/mpegts.h diff --git a/gst/mpegtsdemux/gstmpegdesc.h b/gst/mpegtsdemux/gstmpegdesc.h index fcb473409a..38fa4b35c1 100644 --- a/gst/mpegtsdemux/gstmpegdesc.h +++ b/gst/mpegtsdemux/gstmpegdesc.h @@ -229,5 +229,6 @@ #define DRF_ID_AC3 0x41432d33 #define DRF_ID_GA94 0x47413934 #define DRF_ID_CUEI 0x43554549 +#define DRF_ID_ETV1 0x45545631 #endif /* __GST_MPEG_DESC_H__ */ diff --git a/gst/mpegtsdemux/mpegtsbase.c b/gst/mpegtsdemux/mpegtsbase.c index fb1742b1ab..c817e228dd 100644 --- a/gst/mpegtsdemux/mpegtsbase.c +++ b/gst/mpegtsdemux/mpegtsbase.c @@ -598,6 +598,18 @@ mpegts_base_deactivate_program (MpegTSBase * base, MpegTSBaseProgram * program) * program */ if (!mpegts_pid_in_active_programs (base, stream->pid)) { switch (stream->stream_type) { + case GST_MPEG_TS_STREAM_TYPE_SCTE_DSMCC_DCB: + case GST_MPEG_TS_STREAM_TYPE_SCTE_SIGNALING: + { + guint32 registration_id = + get_registration_from_descriptors (stream->descriptors); + + /* Not a private section stream */ + if (registration_id != DRF_ID_CUEI + && registration_id != DRF_ID_ETV1) + break; + /* Fall through on purpose - remove this PID from known_psi */ + } case GST_MPEG_TS_STREAM_TYPE_PRIVATE_SECTIONS: case GST_MPEG_TS_STREAM_TYPE_MHEG: case GST_MPEG_TS_STREAM_TYPE_DSM_CC: @@ -664,6 +676,16 @@ mpegts_base_activate_program (MpegTSBase * base, MpegTSBaseProgram * program, GstMpegTsPMTStream *stream = g_ptr_array_index (pmt->streams, i); switch (stream->stream_type) { + case GST_MPEG_TS_STREAM_TYPE_SCTE_DSMCC_DCB: + case GST_MPEG_TS_STREAM_TYPE_SCTE_SIGNALING: + { + guint32 registration_id = + get_registration_from_descriptors (stream->descriptors); + /* Not a private section stream */ + if (registration_id != DRF_ID_CUEI && registration_id != DRF_ID_ETV1) + break; + /* Fall through on purpose - remove this PID from known_psi */ + } case GST_MPEG_TS_STREAM_TYPE_PRIVATE_SECTIONS: case GST_MPEG_TS_STREAM_TYPE_MHEG: case GST_MPEG_TS_STREAM_TYPE_DSM_CC: