From 365a9af9c5b57ffe8277762e3555cd4022c99d29 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 19 May 2022 11:30:20 +0300 Subject: [PATCH] qtdemux: Add parsing/dumping of nmhd / metx boxes Part-of: --- subprojects/gst-plugins-good/gst/isomp4/fourcc.h | 2 ++ .../gst-plugins-good/gst/isomp4/qtdemux_dump.c | 30 ++++++++++++++++++++++ .../gst-plugins-good/gst/isomp4/qtdemux_types.c | 2 ++ 3 files changed, 34 insertions(+) diff --git a/subprojects/gst-plugins-good/gst/isomp4/fourcc.h b/subprojects/gst-plugins-good/gst/isomp4/fourcc.h index 70b219b..32fa4c8 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/fourcc.h +++ b/subprojects/gst-plugins-good/gst/isomp4/fourcc.h @@ -418,6 +418,8 @@ G_BEGIN_DECLS #define FOURCC_aavd GST_MAKE_FOURCC('a','a','v','d') #define FOURCC_adrm GST_MAKE_FOURCC('a','d','r','m') +#define FOURCC_metx GST_MAKE_FOURCC('m','e','t','x') + G_END_DECLS #endif /* __FOURCC_H__ */ diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_dump.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_dump.c index e061c46..45296c2 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_dump.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_dump.c @@ -348,6 +348,32 @@ qtdemux_dump_stsd_av01 (GstQTDemux * qtdemux, GstByteReader * data, guint size, return TRUE; } +static gboolean +qtdemux_dump_stsd_metx (GstQTDemux * qtdemux, GstByteReader * data, int depth) +{ + const gchar *content_encoding; + const gchar *namespaces; + const gchar *schema_locations; + + if (gst_byte_reader_get_remaining (data) < 6 + 2) + return FALSE; + + gst_byte_reader_skip_unchecked (data, 6); + GST_LOG_OBJECT (qtdemux, "%*s data reference:%d", depth, "", + GET_UINT16 (data)); + + if (!gst_byte_reader_get_string (data, &content_encoding) || + !gst_byte_reader_get_string (data, &namespaces) || + !gst_byte_reader_get_string (data, &schema_locations)) + return FALSE; + + GST_LOG ("%*s content_encoding: %s", depth, "", content_encoding); + GST_LOG ("%*s namespaces: %s", depth, "", namespaces); + GST_LOG ("%*s schema_locations: %s", depth, "", schema_locations); + + return TRUE; +} + gboolean qtdemux_dump_stsd (GstQTDemux * qtdemux, GstByteReader * data, int depth) { @@ -402,6 +428,10 @@ qtdemux_dump_stsd (GstQTDemux * qtdemux, GstByteReader * data, int depth) if (!qtdemux_dump_stsd_av01 (qtdemux, &sub, size, depth + 1)) return FALSE; break; + case FOURCC_metx: + if (!qtdemux_dump_stsd_metx (qtdemux, &sub, depth + 1)) + return FALSE; + break; default: /* Unknown stsd data, dump the bytes */ if (!qtdemux_dump_unknown (qtdemux, &sub, depth + 1)) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c index a78415a..df9c99a 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux_types.c @@ -54,6 +54,7 @@ static const QtNodeType qt_node_types[] = { {FOURCC_vmhd, "video media information", 0, qtdemux_dump_vmhd}, {FOURCC_smhd, "sound media information", 0}, + {FOURCC_nmhd, "null media information", 0}, {FOURCC_gmhd, "base media information header", QT_FLAG_CONTAINER}, {FOURCC_gmin, "base media info", 0, qtdemux_dump_gmin}, {FOURCC_dinf, "data information", QT_FLAG_CONTAINER}, @@ -230,6 +231,7 @@ static const QtNodeType qt_node_types[] = { {FOURCC_aavd, "AAX encrypted audio", 0}, {FOURCC_adrm, "AAX DRM key data", 0}, {FOURCC_vttc, "VTTCueBox 14496-30", QT_FLAG_CONTAINER}, + {FOURCC_metx, "XML MetaData Sample Entry", 0}, {0, "unknown", 0,}, }; -- 2.7.4