diff options
author | Edward Hervey <edward@centricular.com> | 2021-07-14 07:54:38 +0200 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2021-07-21 14:33:19 +0000 |
commit | f502ef9053c5de5b6e24d6eb0dee912fe163f763 (patch) | |
tree | 67deaef20625000227e1af7d36a5fc4e1fc93a3e /gst | |
parent | ac483b238455000917f5489574e24d2c20dfc0b4 (diff) | |
download | gstreamer-plugins-bad-f502ef9053c5de5b6e24d6eb0dee912fe163f763.tar.gz |
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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2371>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mxf/mxfmpeg.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/gst/mxf/mxfmpeg.c b/gst/mxf/mxfmpeg.c index 57dd75d07..cb89696cf 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) { |