From fff48b08f6ea7629279797013f9fce2196882523 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Dec 2008 08:50:48 +0000 Subject: gst/mxf/mxfparse.c: Fix setting of the height/width and PAR of video streams. Original commit message from CVS: * gst/mxf/mxfparse.c: (mxf_metadata_generic_picture_essence_descriptor_set_caps): Fix setting of the height/width and PAR of video streams. --- gst/mxf/mxfparse.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'gst/mxf/mxfparse.c') diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index b1a87e04..53726b6b 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -2610,8 +2610,8 @@ void mxf_metadata_generic_picture_essence_descriptor_reset void mxf_metadata_generic_picture_essence_descriptor_set_caps (MXFMetadataGenericPictureEssenceDescriptor * descriptor, GstCaps * caps) { - /*guint par_n, par_d; - guint width, height; */ + guint par_n, par_d; + guint width, height; MXFMetadataFileDescriptor *f = (MXFMetadataFileDescriptor *) descriptor; g_return_if_fail (descriptor != NULL); @@ -2620,13 +2620,18 @@ void mxf_metadata_generic_picture_essence_descriptor_set_caps gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, f->sample_rate.n, f->sample_rate.d, NULL); - return; - -/* FIXME: This sets wrong values for most (all?) files */ -#if 0 width = descriptor->stored_width; height = descriptor->stored_height; + /* If the video is stored as separate fields the + * height is only the height of one field, i.e. + * half the height of the frame. + * + * See SMPTE 377M E2.2 and E1.2 + */ + if (descriptor->frame_layout == 1 || descriptor->frame_layout == 2) + height *= 2; + if (width == 0 || height == 0) return; @@ -2636,12 +2641,11 @@ void mxf_metadata_generic_picture_essence_descriptor_set_caps if (descriptor->aspect_ratio.n == 0 || descriptor->aspect_ratio.d == 0) return; - par_n = height * descriptor->aspect_ratio.d; - par_d = width * descriptor->aspect_ratio.n; + par_n = height * descriptor->aspect_ratio.n; + par_d = width * descriptor->aspect_ratio.d; gst_caps_set_simple (caps, "pixel-aspect-ratio", GST_TYPE_FRACTION, par_n, par_d, NULL); -#endif } gboolean -- cgit v1.2.1