From fff48b08f6ea7629279797013f9fce2196882523 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 4 Dec 2008 08:50:48 +0000 Subject: [PATCH] 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. --- ChangeLog | 6 ++++++ gst/mxf/mxfparse.c | 22 +++++++++++++--------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6902376..660abdb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2008-12-04 Sebastian Dröge + * gst/mxf/mxfparse.c: + (mxf_metadata_generic_picture_essence_descriptor_set_caps): + Fix setting of the height/width and PAR of video streams. + +2008-12-04 Sebastian Dröge + * gst/mxf/Makefile.am: * gst/mxf/mxfd10.c: (mxf_is_d10_essence_track), (mxf_d10_picture_handle_essence_element), diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index b1a87e0..53726b6 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 -- 2.7.4