From 4fe26740c77ad874b387e506fd4497225a6bf1d8 Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Thu, 4 Jul 2013 07:45:12 +0200 Subject: [PATCH] mpegts: Add registered mpeg-ts stream types These are the values officially registered in the base specification (H.222.0/13818-1). Later on we can add other enums for other variants Note that the enum is not used in the structure fields (such as a pmt stream stream_type field) since it can contain values from other variants. --- docs/libs/gst-plugins-bad-libs-sections.txt | 3 + docs/libs/gst-plugins-bad-libs.types | 1 + gst-libs/gst/mpegts/gstmpegtssection.h | 117 +++++++++++++++++++- tests/examples/mpegts/ts-parser.c | 6 +- 4 files changed, 124 insertions(+), 3 deletions(-) diff --git a/docs/libs/gst-plugins-bad-libs-sections.txt b/docs/libs/gst-plugins-bad-libs-sections.txt index ef24ce7b5f..91ab28d3db 100644 --- a/docs/libs/gst-plugins-bad-libs-sections.txt +++ b/docs/libs/gst-plugins-bad-libs-sections.txt @@ -261,6 +261,7 @@ gst_mpegts_section_get_pat GstMpegTsPMT GstMpegTsPMTStream +GstMpegTsStreamType gst_mpegts_section_get_pmt GstMpegTsBAT @@ -290,6 +291,7 @@ GST_TYPE_MPEG_TS_SECTION_TYPE GST_TYPE_MPEG_TS_SECTION_ATSC_TABLE_ID GST_TYPE_MPEG_TS_SECTION_DVB_TABLE_ID GST_MPEGTS_SECTION +GST_TYPE_MPEG_TS_STREAM_TYPE GST_TYPE_MPEGTS_BAT GST_TYPE_MPEGTS_EIT GST_TYPE_MPEGTS_EIT_EVENT @@ -316,6 +318,7 @@ gst_mpegts_sdt_get_type gst_mpegts_sdt_service_get_type gst_mpegts_section_get_type gst_mpegts_tot_get_type +gst_mpeg_ts_stream_type_get_type
diff --git a/docs/libs/gst-plugins-bad-libs.types b/docs/libs/gst-plugins-bad-libs.types index cfce0561d7..2d78fac23a 100644 --- a/docs/libs/gst-plugins-bad-libs.types +++ b/docs/libs/gst-plugins-bad-libs.types @@ -19,6 +19,7 @@ gst_mpeg_ts_descriptor_type_get_type gst_mpeg_ts_iso639_audio_type_get_type gst_mpeg_ts_running_status_get_type gst_mpeg_ts_dvb_service_type_get_type +gst_mpeg_ts_stream_type_get_type gst_insert_bin_get_type \ No newline at end of file diff --git a/gst-libs/gst/mpegts/gstmpegtssection.h b/gst-libs/gst/mpegts/gstmpegtssection.h index 875ad7df08..766e0c1952 100644 --- a/gst-libs/gst/mpegts/gstmpegtssection.h +++ b/gst-libs/gst/mpegts/gstmpegtssection.h @@ -183,9 +183,124 @@ typedef struct _GstMpegTsPMT GstMpegTsPMT; #define GST_TYPE_MPEGTS_PMT (gst_mpegts_pmt_get_type()) #define GST_TYPE_MPEGTS_PMT_STREAM (gst_mpegts_pmt_stream_get_type()) +/** + * GstMpegTsStreamType: + * @GST_MPEG_TS_STREAM_TYPE_RESERVED_00: ITU-T | ISO/IEC Reserved + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG1: ISO/IEC 11172-2 Video + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG2: Rec. ITU-T H.262 | ISO/IEC 13818-2 + * Video or ISO/IEC 11172-2 constrained parameter video stream + * @GST_MPEG_TS_STREAM_TYPE_AUDIO_MPEG1: ISO/IEC 11172-3 Audio + * @GST_MPEG_TS_STREAM_TYPE_AUDIO_MPEG2: ISO/IEC 13818-3 Audio + * @GST_MPEG_TS_STREAM_TYPE_PRIVATE_SECTIONS: private sections + * @GST_MPEG_TS_STREAM_TYPE_PRIVATE_PES_PACKETS: PES packets containing private data + * @GST_MPEG_TS_STREAM_TYPE_MHEG: ISO/IEC 13522 MHEG + * @GST_MPEG_TS_STREAM_TYPE_DSM_CC: Annex A DSM-CC + * @GST_MPEG_TS_STREAM_TYPE_H_222_1: Rec. ITU-T H.222.1 + * @GST_MPEG_TS_STREAM_TYPE_DSMCC_A: ISO/IEC 13818-6 type A + * @GST_MPEG_TS_STREAM_TYPE_DSMCC_B: ISO/IEC 13818-6 type B + * @GST_MPEG_TS_STREAM_TYPE_DSMCC_C: ISO/IEC 13818-6 type C + * @GST_MPEG_TS_STREAM_TYPE_DSMCC_D: ISO/IEC 13818-6 type D + * @GST_MPEG_TS_STREAM_TYPE_AUXILIARY: auxiliary streams + * @GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_ADTS: ISO/IEC 13818-7 Audio with ADTS + * transport syntax + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG4: ISO/IEC 14496-2 Visual + * @GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_LATM: ISO/IEC 14496-3 Audio with the LATM + * transport syntax as defined in ISO/IEC 14496-3 + * @GST_MPEG_TS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS: ISO/IEC 14496-1 + * SL-packetized stream or FlexMux stream carried in PES packets + * @GST_MPEG_TS_STREAM_TYPE_SL_FLEXMUX_SECTIONS: ISO/IEC 14496-1 SL-packetized + * stream or FlexMux stream carried in ISO/IEC 14496_sections + * @GST_MPEG_TS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD: ISO/IEC 13818-6 Synchronized + * Download Protocol + * @GST_MPEG_TS_STREAM_TYPE_METADATA_PES_PACKETS: Metadata carried in PES packets + * @GST_MPEG_TS_STREAM_TYPE_METADATA_SECTIONS: Metadata carried in metadata_sections + * @GST_MPEG_TS_STREAM_TYPE_METADATA_DATA_CAROUSEL: Metadata carried in ISO/IEC + * 13818-6 Data Carousel + * @GST_MPEG_TS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL: Metadata carried in + * ISO/IEC 13818-6 Object Carousel + * @GST_MPEG_TS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD: Metadata carried in + * ISO/IEC 13818-6 Synchronized Download Protocol + * @GST_MPEG_TS_STREAM_TYPE_MPEG2_IPMP: IPMP stream (defined in ISO/IEC 13818-11, + * MPEG-2 IPMP) + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_H264: AVC video stream conforming to one or + * more profiles defined in Annex A of Rec. ITU-T H.264 | ISO/IEC 14496-10 or + * AVC video sub-bitstream of SVC as defined in 2.1.78 or MVC base view + * sub-bitstream, as defined in 2.1.85, or AVC video sub-bitstream of MVC, as + * defined in 2.1.88 + * @GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_CLEAN: ISO/IEC 14496-3 Audio, without + * using any additional transport syntax, such as DST, ALS and SLS + * @GST_MPEG_TS_STREAM_TYPE_MPEG4_TIMED_TEXT: ISO/IEC 14496-17 Text + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_RVC: Auxiliary video stream as defined in + * ISO/IEC 23002-3 + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM: SVC video sub-bitstream + * of an AVC video stream conforming to one or more profiles defined in Annex G + * of Rec. ITU-T H.264 | ISO/IEC 14496-10 + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM: MVC video sub-bitstream + * of an AVC video stream conforming to one or more profiles defined in Annex H + * of Rec. ITU-T H.264 | ISO/IEC 14496-10 + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_JP2K: Video stream conforming to one or more + * profiles as defined in Rec. ITU-T T.800 | ISO/IEC 15444-1 + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW: Additional view + * Rec. ITU-T H.262 | ISO/IEC 13818-2 video stream for service-compatible + * stereoscopic 3D services + * @GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW: Additional view + * Rec. ITU-T H.264 | ISO/IEC 14496-10 video stream conforming to one or more + * profiles defined in Annex A for service-compatible stereoscopic 3D services + * @GST_MPEG_TS_STREAM_TYPE_IPMP_STREAM: IPMP stream + * + * Type of mpeg-ts stream type. + * + * These values correspond to the base standard registered types. Depending + * on the variant of mpeg-ts being used (Bluray, ATSC, DVB, ...), other + * types might also be used, but will not conflict with these. + * + * Corresponds to table 2-34 of ITU H.222.0 | ISO/IEC 13818-1 + */ +typedef enum { + GST_MPEG_TS_STREAM_TYPE_RESERVED_00 = 0x00, + GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG1 = 0x01, + GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG2 = 0x02, + GST_MPEG_TS_STREAM_TYPE_AUDIO_MPEG1 = 0x03, + GST_MPEG_TS_STREAM_TYPE_AUDIO_MPEG2 = 0x04, + GST_MPEG_TS_STREAM_TYPE_PRIVATE_SECTIONS = 0x05, + GST_MPEG_TS_STREAM_TYPE_PRIVATE_PES_PACKETS = 0x06, + GST_MPEG_TS_STREAM_TYPE_MHEG = 0x07, + GST_MPEG_TS_STREAM_TYPE_DSM_CC = 0x08, + GST_MPEG_TS_STREAM_TYPE_H_222_1 = 0x09, + GST_MPEG_TS_STREAM_TYPE_DSMCC_A = 0x0a, + GST_MPEG_TS_STREAM_TYPE_DSMCC_B = 0x0b, + GST_MPEG_TS_STREAM_TYPE_DSMCC_C = 0x0c, + GST_MPEG_TS_STREAM_TYPE_DSMCC_D = 0x0d, + GST_MPEG_TS_STREAM_TYPE_AUXILIARY = 0x0e, + GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_ADTS = 0x0f, + GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG4 = 0x10, + GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_LATM = 0x11, + GST_MPEG_TS_STREAM_TYPE_SL_FLEXMUX_PES_PACKETS = 0x12, + GST_MPEG_TS_STREAM_TYPE_SL_FLEXMUX_SECTIONS = 0x13, + GST_MPEG_TS_STREAM_TYPE_SYNCHRONIZED_DOWNLOAD = 0x14, + GST_MPEG_TS_STREAM_TYPE_METADATA_PES_PACKETS = 0x15, + GST_MPEG_TS_STREAM_TYPE_METADATA_SECTIONS = 0x16, + GST_MPEG_TS_STREAM_TYPE_METADATA_DATA_CAROUSEL = 0x17, + GST_MPEG_TS_STREAM_TYPE_METADATA_OBJECT_CAROUSEL = 0x18, + GST_MPEG_TS_STREAM_TYPE_METADATA_SYNCHRONIZED_DOWNLOAD = 0x19, + GST_MPEG_TS_STREAM_TYPE_MPEG2_IPMP = 0x1a, + GST_MPEG_TS_STREAM_TYPE_VIDEO_H264 = 0x1b, + GST_MPEG_TS_STREAM_TYPE_AUDIO_AAC_CLEAN = 0x1c, + GST_MPEG_TS_STREAM_TYPE_MPEG4_TIMED_TEXT = 0x1d, + GST_MPEG_TS_STREAM_TYPE_VIDEO_RVC = 0x1e, + GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_SVC_SUB_BITSTREAM = 0x1f, + GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_MVC_SUB_BITSTREAM = 0x20, + GST_MPEG_TS_STREAM_TYPE_VIDEO_JP2K = 0x21, + GST_MPEG_TS_STREAM_TYPE_VIDEO_MPEG2_STEREO_ADDITIONAL_VIEW = 0x22, + GST_MPEG_TS_STREAM_TYPE_VIDEO_H264_STEREO_ADDITIONAL_VIEW = 0x23, + /* 0x24 - 0x7e : Rec. ITU-T H.222.0 | ISO/IEC 13818-1 Reserved */ + GST_MPEG_TS_STREAM_TYPE_IPMP_STREAM = 0x7f + /* 0x80 - 0xff : User Private (or defined in other specs) */ +} GstMpegTsStreamType; + /** * GstMpegTsPMTStream: - * @stream_type: the type of stream + * @stream_type: the type of stream. See #GstMpegTsStreamType * @pid: the PID of the stream * @descriptors: (element-type GstMpegTsDescriptor): the descriptors of the * stream diff --git a/tests/examples/mpegts/ts-parser.c b/tests/examples/mpegts/ts-parser.c index db422b3d8a..19989e1566 100644 --- a/tests/examples/mpegts/ts-parser.c +++ b/tests/examples/mpegts/ts-parser.c @@ -221,8 +221,9 @@ dump_pmt (GstMpegTsSection * section) g_printf (" %d Streams:\n", len); for (i = 0; i < len; i++) { GstMpegTsPMTStream *stream = g_ptr_array_index (pmt->streams, i); - g_printf (" pid:0x%04x , stream_type:0x%02x\n", stream->pid, - stream->stream_type); + g_printf (" pid:0x%04x , stream_type:0x%02x (%s)\n", stream->pid, + stream->stream_type, + enum_name (GST_TYPE_MPEG_TS_STREAM_TYPE, stream->stream_type)); dump_descriptors (stream->descriptors, 9); } } @@ -438,6 +439,7 @@ main (int argc, gchar ** argv) g_type_class_ref (GST_TYPE_MPEG_TS_MISC_DESCRIPTOR_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_ISO639_AUDIO_TYPE); g_type_class_ref (GST_TYPE_MPEG_TS_DVB_SERVICE_TYPE); + g_type_class_ref (GST_TYPE_MPEG_TS_STREAM_TYPE); mainloop = g_main_loop_new (NULL, FALSE);