gst/mxf/: Set video dimensions and pixel aspect ratio on the caps.

Original commit message from CVS:
* gst/mxf/mxfmpeg.c: (mxf_mpeg_video_create_caps):
* gst/mxf/mxfparse.c:
(mxf_metadata_generic_picture_essence_descriptor_set_caps):
* gst/mxf/mxfparse.h:
Set video dimensions and pixel aspect ratio on the caps.
This commit is contained in:
Sebastian Dröge 2008-11-25 14:49:34 +00:00
parent 4f365b391e
commit 15afef8652
4 changed files with 58 additions and 10 deletions

View file

@ -1,3 +1,11 @@
2008-11-25 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfmpeg.c: (mxf_mpeg_video_create_caps):
* gst/mxf/mxfparse.c:
(mxf_metadata_generic_picture_essence_descriptor_set_caps):
* gst/mxf/mxfparse.h:
Set video dimensions and pixel aspect ratio on the caps.
2008-11-25 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* gst/mxf/mxfdemux.c: (gst_mxf_demux_reset_metadata),

View file

@ -23,6 +23,7 @@
/* TODO:
* - Handle PES streams
* - Fix TS/PS demuxers to forward timestamps
*/
#ifdef HAVE_CONFIG_H
@ -242,7 +243,9 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
{
MXFMetadataMPEGVideoDescriptor *d = NULL;
MXFMetadataFileDescriptor *f = NULL;
MXFMetadataGenericPictureEssenceDescriptor *p = NULL;
guint i;
GstCaps *caps = NULL;
g_return_val_if_fail (package != NULL, NULL);
g_return_val_if_fail (track != NULL, NULL);
@ -257,12 +260,16 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
MXF_METADATA_MPEG_VIDEO_DESCRIPTOR) {
d = (MXFMetadataMPEGVideoDescriptor *) track->descriptor[i];
f = track->descriptor[i];
p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
break;
} else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR ||
((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR) {
f = track->descriptor[i];
p = (MXFMetadataGenericPictureEssenceDescriptor *) track->descriptor[i];
break;
} else if (((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_CDCI_PICTURE_ESSENCE_DESCRIPTOR
|| ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR
|| ((MXFMetadataGenericDescriptor *) track->descriptor[i])->type ==
MXF_METADATA_FILE_DESCRIPTOR) {
f = track->descriptor[i];
}
@ -278,7 +285,7 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
if (f->essence_container.u[13] == 0x04) {
/* FIXME: get mpeg version somehow */
GST_DEBUG ("Found MPEG ES stream");
return gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, FALSE, NULL);
} else if (f->essence_container.u[13] == 0x07) {
GST_ERROR ("MPEG PES streams not supported yet");
@ -286,11 +293,16 @@ mxf_mpeg_video_create_caps (MXFMetadataGenericPackage * package,
} else if (f->essence_container.u[13] == 0x08) {
/* FIXME: get mpeg version somehow */
GST_DEBUG ("Found MPEG PS stream");
return gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
caps = gst_caps_new_simple ("video/mpeg", "mpegversion", G_TYPE_INT, 1,
"systemstream", G_TYPE_BOOLEAN, TRUE, NULL);
} else if (f->essence_container.u[13] == 0x09) {
GST_DEBUG ("Found MPEG TS stream");
return gst_caps_new_simple ("video/mpegts", NULL);
caps = gst_caps_new_simple ("video/mpegts", NULL);
}
return NULL;
if (p)
mxf_metadata_generic_picture_essence_descriptor_set_caps (p, caps);
return caps;
}

View file

@ -2278,11 +2278,38 @@ void mxf_metadata_generic_picture_essence_descriptor_reset
memset (descriptor, 0, sizeof (MXFMetadataGenericPictureEssenceDescriptor));
}
void mxf_metadata_generic_picture_essence_descriptor_set_caps
(MXFMetadataGenericPictureEssenceDescriptor * descriptor, GstCaps * caps)
{
guint par_n, par_d;
guint width, height;
g_return_if_fail (descriptor != NULL);
g_return_if_fail (GST_IS_CAPS (caps));
width = descriptor->stored_width;
height = descriptor->stored_height;
if (width == 0 || height == 0)
return;
gst_caps_set_simple (caps, "width", G_TYPE_INT, width, "height", G_TYPE_INT,
height, NULL);
if (descriptor->aspect_ratio.n == 0 || descriptor->aspect_ratio.d == 0)
return;
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);
}
gboolean
mxf_metadata_cdci_picture_essence_descriptor_handle_tag
(MXFMetadataGenericDescriptor * d, const MXFPrimerPack * primer,
guint16 tag, const guint8 * tag_data, guint16 tag_size)
{
guint16 tag, const guint8 * tag_data, guint16 tag_size) {
MXFMetadataCDCIPictureEssenceDescriptor *descriptor =
(MXFMetadataCDCIPictureEssenceDescriptor *) d;
gboolean ret = FALSE;

View file

@ -126,6 +126,7 @@ void mxf_metadata_generic_sound_essence_descriptor_reset (MXFMetadataGenericSoun
gboolean mxf_metadata_generic_picture_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);
void mxf_metadata_generic_picture_essence_descriptor_reset (MXFMetadataGenericPictureEssenceDescriptor *descriptor);
void mxf_metadata_generic_picture_essence_descriptor_set_caps (MXFMetadataGenericPictureEssenceDescriptor *descriptor, GstCaps *caps);
gboolean mxf_metadata_cdci_picture_essence_descriptor_handle_tag (MXFMetadataGenericDescriptor *descriptor,
const MXFPrimerPack *primer, guint16 tag, const guint8 *tag_data, guint16 tag_size);