From 137044195d67362ad92714e7723f5fd5cfe95004 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 5 May 2025 22:24:33 +0300 Subject: [PATCH] qtdemux: Don't parse fiel box a second time for JPEG-2000 It was already parsed above in general for all video codecs. Just put the number of fields into the JPEG-2000 in the specific field. As a side effect this also actually checks if enough data is available. Part-of: --- .../gst-plugins-good/gst/isomp4/qtdemux.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c index 0eabe8c36d..09bfb92cfd 100644 --- a/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c +++ b/subprojects/gst-plugins-good/gst/isomp4/qtdemux.c @@ -15177,7 +15177,7 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix) case FOURCC_mjp2: { /* see annex I of the jpeg2000 spec */ - GNode *jp2h, *ihdr, *colr, *mjp2, *field, *prefix, *cmap, *cdef; + GNode *jp2h, *ihdr, *colr, *mjp2, *prefix, *cmap, *cdef; const guint8 *data; const gchar *colorspace = NULL; gint ncomp = 0; @@ -15332,17 +15332,15 @@ qtdemux_parse_trak (GstQTDemux * qtdemux, GNode * trak, guint32 * mvhd_matrix) g_free (chan_def); } + /* indicate possible fields in caps */ + if (CUR_STREAM (stream)->interlace_mode != 1) { + gst_caps_set_simple (entry->caps, "fields", G_TYPE_INT, + CUR_STREAM (stream)->interlace_mode, NULL); + } + /* some optional atoms */ - field = qtdemux_tree_get_child_by_type (mjp2, FOURCC_fiel); prefix = qtdemux_tree_get_child_by_type (mjp2, FOURCC_jp2x); - /* indicate possible fields in caps */ - if (field) { - data = (guint8 *) field->data + 8; - if (*data != 1) - gst_caps_set_simple (entry->caps, "fields", G_TYPE_INT, - (gint) * data, NULL); - } /* add codec_data if provided */ if (prefix) { GstBuffer *buf;