From: Edward Hervey Date: Wed, 14 Jul 2021 05:54:38 +0000 (+0200) Subject: mxfmpeg: Fix essence coding detection X-Git-Tag: 1.19.3~507^2~179 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f502ef9053c5de5b6e24d6eb0dee912fe163f763;p=platform%2Fupstream%2Fgstreamer.git mxfmpeg: Fix essence coding detection The picture essence coding matching was wrong. Use the proper "base" MXFUL for video mpeg compression for matching. Also handle the case where some old files would put the essence container label in the essence coding field Part-of: --- diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c index 57dd75d..cb89696 100644 --- a/gst/mxf/mxfmpeg.c +++ b/gst/mxf/mxfmpeg.c @@ -590,6 +590,11 @@ static const guint8 sony_mpeg4_extradata[] = { /* RP224 */ +static const MXFUL video_mpeg_compression = { { + 0x06, 0x0E, 0x2B, 0x34, 0x04, 0x01, 0x01, 0x01, 0x04, 0x01, 0x02, 0x02, + 0x01,} +}; + static const MXFUL sound_essence_compression_ac3 = { { 0x06, 0x0E, 0x2B, 0x34, 0x04, 0x01, 0x01, 0x01, 0x04, 0x02, 0x02, 0x02, 0x03, 0x02, 0x01, 0x00} @@ -634,13 +639,16 @@ mxf_mpeg_es_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags, GstCaps *caps = NULL; const gchar *codec_name = NULL; MXFMPEGEssenceType t, *mdata; + gchar str[48]; *mapping_data = g_malloc (sizeof (MXFMPEGEssenceType)); mdata = (MXFMPEGEssenceType *) * mapping_data; /* SMPTE RP224 */ if (p) { - if (mxf_ul_is_zero (&p->picture_essence_coding)) { + if (mxf_ul_is_zero (&p->picture_essence_coding) || + mxf_ul_is_equal (&p->picture_essence_coding, + &p->parent.essence_container)) { GST_WARNING ("No picture essence coding defined, assuming MPEG2"); caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 2, @@ -649,19 +657,10 @@ mxf_mpeg_es_create_caps (MXFMetadataTimelineTrack * track, GstTagList ** tags, t = MXF_MPEG_ESSENCE_TYPE_VIDEO_MPEG2; memcpy (mdata, &t, sizeof (MXFMPEGEssenceType)); *intra_only = FALSE; - } else if (p->picture_essence_coding.u[0] != 0x06 - || p->picture_essence_coding.u[1] != 0x0e - || p->picture_essence_coding.u[2] != 0x2b - || p->picture_essence_coding.u[3] != 0x34 - || p->picture_essence_coding.u[4] != 0x04 - || p->picture_essence_coding.u[5] != 0x01 - || p->picture_essence_coding.u[6] != 0x01 - || p->picture_essence_coding.u[8] != 0x04 - || p->picture_essence_coding.u[9] != 0x01 - || p->picture_essence_coding.u[10] != 0x02 - || p->picture_essence_coding.u[11] != 0x02 - || p->picture_essence_coding.u[12] != 0x01) { - GST_ERROR ("No MPEG picture essence coding"); + } else if (!mxf_ul_is_subclass (&video_mpeg_compression, + &p->picture_essence_coding)) { + GST_ERROR ("Not MPEG picture essence coding %s", + mxf_ul_to_string (&p->picture_essence_coding, str)); caps = NULL; } else if (p->picture_essence_coding.u[13] >= 0x01 && p->picture_essence_coding.u[13] <= 0x08) {