mpegts: Handle ISO 13818 / ITU H.222.0 base extension descriptor

Previously this was hardcoded to the DVB extension descriptors (0x7f), but it
should also be applied for the base specification extension descriptors (0x3f)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7172>
This commit is contained in:
Edward Hervey 2024-08-28 11:07:32 +02:00 committed by Tim-Philipp Müller
parent 0db32b3b3a
commit 6ce1910c5b
5 changed files with 49 additions and 6 deletions

View file

@ -1294,7 +1294,7 @@ and other specifications mentioned in the documentation.</doc>
<type name="guint8" c:type="guint8"/> <type name="guint8" c:type="guint8"/>
</field> </field>
<field name="tag_extension" writable="1"> <field name="tag_extension" writable="1">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gstmpegtsdescriptor.h">the extended type (if @descriptor_tag is 0x7f)</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gstmpegtsdescriptor.h">the extended type (if @tag is 0x7f (for DVB) or 0x3f (for H.222.0))</doc>
<type name="guint8" c:type="guint8"/> <type name="guint8" c:type="guint8"/>
</field> </field>
<field name="length" writable="1"> <field name="length" writable="1">
@ -2497,6 +2497,9 @@ Consult the relevant specifications for more details.</doc>
</member> </member>
<member name="stereoscopic_video_info" value="54" c:identifier="GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO"> <member name="stereoscopic_video_info" value="54" c:identifier="GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO">
</member> </member>
<member name="extension" value="63" c:identifier="GST_MTS_DESC_EXTENSION" version="1.26">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gstmpegtsdescriptor.h">Extension Descriptor.</doc>
</member>
</enumeration> </enumeration>
<record name="DvbMultilingualBouquetNameItem" c:type="GstMpegtsDvbMultilingualBouquetNameItem" glib:type-name="GstMpegtsDvbMultilingualBouquetNameItem" glib:get-type="gst_mpegts_dvb_multilingual_bouquet_name_item_get_type" c:symbol-prefix="dvb_multilingual_bouquet_name_item"> <record name="DvbMultilingualBouquetNameItem" c:type="GstMpegtsDvbMultilingualBouquetNameItem" glib:type-name="GstMpegtsDvbMultilingualBouquetNameItem" glib:get-type="gst_mpegts_dvb_multilingual_bouquet_name_item_get_type" c:symbol-prefix="dvb_multilingual_bouquet_name_item">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h">a multilingual bouquet name entry</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h">a multilingual bouquet name entry</doc>
@ -2602,6 +2605,17 @@ Consult the relevant specifications for more details.</doc>
</array> </array>
</field> </field>
</record> </record>
<enumeration name="ExtendedDescriptorType" version="1.26" c:type="GstMpegtsExtendedDescriptorType">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gstmpegtsdescriptor.h">The type of an extended descriptor
The values correpond to the registered extended descriptor types from the
base ISO 13818 / ITU H.222.0 specifications
Consult the specification for more details</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gstmpegtsdescriptor.h"/>
<member name="mts_desc_ext_jxs_video" value="20" c:identifier="GST_MTS_DESC_EXT_JXS_VIDEO">
</member>
</enumeration>
<record name="ExtendedEventDescriptor" c:type="GstMpegtsExtendedEventDescriptor" glib:type-name="GstMpegtsExtendedEventDescriptor" glib:get-type="gst_mpegts_extended_event_descriptor_get_type" c:symbol-prefix="extended_event_descriptor"> <record name="ExtendedEventDescriptor" c:type="GstMpegtsExtendedEventDescriptor" glib:type-name="GstMpegtsExtendedEventDescriptor" glib:get-type="gst_mpegts_extended_event_descriptor_get_type" c:symbol-prefix="extended_event_descriptor">
<doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h">Extended Event Descriptor (EN 300 468 v.1.13.1)</doc> <doc xml:space="preserve" filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h">Extended Event Descriptor (EN 300 468 v.1.13.1)</doc>
<source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h"/> <source-position filename="../subprojects/gst-plugins-bad/gst-libs/gst/mpegts/gst-dvb-descriptor.h"/>

View file

@ -80,14 +80,14 @@ G_GNUC_INTERNAL gpointer __common_section_checks (GstMpegtsSection *section,
GST_WARNING ("Descriptor is empty (data field == NULL)"); \ GST_WARNING ("Descriptor is empty (data field == NULL)"); \
return retval; \ return retval; \
} \ } \
if (G_UNLIKELY ((desc)->tag != 0x7f) || \ if (G_UNLIKELY (((desc)->tag != 0x7f) && ((desc)->tag != 0x3f)) || \
((desc)->tag_extension != (tagexttype))) { \ ((desc)->tag_extension != (tagexttype))) { \
GST_WARNING ("Wrong descriptor type (Got 0x%02x, expected 0x%02x)", \ GST_WARNING ("Wrong descriptor type (Got 0x%02x, expected 0x%02x)", \
(desc)->tag_extension, tagexttype); \ (desc)->tag_extension, tagexttype); \
return retval; \ return retval; \
} }
#define __common_desc_ext_checks(desc, tagexttype, minlen, retval) \ #define __common_desc_ext_checks(desc, tagexttype, minlen, retval) \
__common_desc_ext_check_base(desc, tagexttype, retval); \ __common_desc_ext_check_base(desc, tagexttype, retval); \
if (G_UNLIKELY ((desc)->length < (minlen))) { \ if (G_UNLIKELY ((desc)->length < (minlen))) { \
GST_WARNING ("Descriptor too small (Got %d, expected at least %d)", \ GST_WARNING ("Descriptor too small (Got %d, expected at least %d)", \
(desc)->length, minlen); \ (desc)->length, minlen); \

View file

@ -794,7 +794,8 @@ gst_mpegts_parse_descriptors (guint8 * buffer, gsize buf_len)
GST_LOG ("descriptor 0x%02x length:%d", desc->tag, desc->length); GST_LOG ("descriptor 0x%02x length:%d", desc->tag, desc->length);
GST_MEMDUMP ("descriptor", desc->data + 2, desc->length); GST_MEMDUMP ("descriptor", desc->data + 2, desc->length);
/* extended descriptors */ /* extended descriptors */
if (G_UNLIKELY (desc->tag == 0x7f)) if (G_UNLIKELY (desc->tag == GST_MTS_DESC_DVB_EXTENSION
|| desc->tag == GST_MTS_DESC_EXTENSION))
desc->tag_extension = *data; desc->tag_extension = *data;
data += desc->length; data += desc->length;

View file

@ -135,9 +135,33 @@ typedef enum {
GST_MTS_DESC_STEREOSCOPIC_PROGRAM_INFO = 0x35, GST_MTS_DESC_STEREOSCOPIC_PROGRAM_INFO = 0x35,
GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO = 0x36, GST_MTS_DESC_STEREOSCOPIC_VIDEO_INFO = 0x36,
/**
* GST_MTS_DESC_EXTENSION:
*
* Extension Descriptor.
*
* Since: 1.26
*/
GST_MTS_DESC_EXTENSION = 0x3f
/* 55-63 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved */ /* 55-63 ITU-T Rec. H.222.0 | ISO/IEC 13818-1 Reserved */
} GstMpegtsDescriptorType; } GstMpegtsDescriptorType;
/**
* GstMpegtsExtendedDescriptorType:
*
* The type of an extended descriptor
*
* The values correpond to the registered extended descriptor types from the
* base ISO 13818 / ITU H.222.0 specifications
*
* Consult the specification for more details
*
* Since: 1.26
*/
typedef enum {
GST_MTS_DESC_EXT_JXS_VIDEO = 0x14,
} GstMpegtsExtendedDescriptorType;
/** /**
* GstMpegtsMiscDescriptorType: * GstMpegtsMiscDescriptorType:
* *
@ -180,7 +204,7 @@ GType gst_mpegts_descriptor_get_type (void);
/** /**
* GstMpegtsDescriptor: * GstMpegtsDescriptor:
* @tag: the type of descriptor * @tag: the type of descriptor
* @tag_extension: the extended type (if @descriptor_tag is 0x7f) * @tag_extension: the extended type (if @tag is 0x7f (for DVB) or 0x3f (for H.222.0))
* @length: the length of the descriptor content (excluding tag/length field) * @length: the length of the descriptor content (excluding tag/length field)
* @data: the full descriptor data (including tag, extension, length). The first * @data: the full descriptor data (including tag, extension, length). The first
* two bytes are the @tag and @length. * two bytes are the @tag and @length.

View file

@ -87,7 +87,11 @@ descriptor_name (GstMpegtsDescriptor * desc)
gint val = desc->tag; gint val = desc->tag;
/* Treat extended descriptors */ /* Treat extended descriptors */
if (val == 0x7f) { if (val == 0x3f) {
en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
(GST_TYPE_MPEGTS_EXTENDED_DESCRIPTOR_TYPE)), desc->tag_extension);
}
if (en == NULL && val == 0x7f) {
en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek en = g_enum_get_value (G_ENUM_CLASS (g_type_class_peek
(GST_TYPE_MPEGTS_DVB_EXTENDED_DESCRIPTOR_TYPE)), (GST_TYPE_MPEGTS_DVB_EXTENDED_DESCRIPTOR_TYPE)),
desc->tag_extension); desc->tag_extension);