summaryrefslogtreecommitdiffstats
path: root/gst/mxf/mxfmetadata.c
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2008-12-19 10:06:24 +0000
committerSebastian Dröge <slomo@circular-chaos.org>2008-12-19 10:06:24 +0000
commit083d8c7018484e7da0e50f99c6de7d5ad35dfd6c (patch)
tree8cc0533354a32eb9fdc1ce96b5510e86884b811a /gst/mxf/mxfmetadata.c
parentecc0e9221fcfa3f46459b1f9c954298f93f72779 (diff)
downloadgst-plugins-bad-083d8c7018484e7da0e50f99c6de7d5ad35dfd6c.tar.gz
gst-plugins-bad-083d8c7018484e7da0e50f99c6de7d5ad35dfd6c.tar.bz2
gst-plugins-bad-083d8c7018484e7da0e50f99c6de7d5ad35dfd6c.zip
gst/mxf/: Add mxf_metadata_generic_sound_essence_descriptor_set_caps() to set rate and channels and use this for all ...
Original commit message from CVS: * gst/mxf/mxfaes-bwf.c: (mxf_bwf_create_caps), (mxf_aes3_create_caps): * gst/mxf/mxfalaw.c: (mxf_alaw_create_caps): * gst/mxf/mxfd10.c: (mxf_d10_create_caps): * gst/mxf/mxfdemux.c: * gst/mxf/mxfmetadata.c: (mxf_metadata_source_package_resolve), (mxf_metadata_generic_picture_essence_descriptor_set_caps), (mxf_metadata_generic_sound_essence_descriptor_set_caps): * gst/mxf/mxfmetadata.h: * gst/mxf/mxfmpeg.c: (mxf_mpeg_es_create_caps): Add mxf_metadata_generic_sound_essence_descriptor_set_caps() to set rate and channels and use this for all sound essence. Give some debug output when setting picture essence caps with invalid descriptor values. Fix height calculation from the frame layout a bit more and add a TODO to check if it's really correct now or if it needs more fixing (especially, does the framerate need adjustments?).
Diffstat (limited to 'gst/mxf/mxfmetadata.c')
-rw-r--r--gst/mxf/mxfmetadata.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c
index 9a5a153f..88280d84 100644
--- a/gst/mxf/mxfmetadata.c
+++ b/gst/mxf/mxfmetadata.c
@@ -1301,6 +1301,10 @@ mxf_metadata_source_package_resolve (MXFMetadataBase * m,
}
}
+ /* TODO: Check if there is a EssenceContainerData for this source package
+ * and store this in the source package instance. Without
+ * EssenceContainerData this package must be external */
+
return ret;
}
@@ -2628,8 +2632,12 @@ void mxf_metadata_generic_picture_essence_descriptor_set_caps
g_return_if_fail (MXF_IS_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR (self));
g_return_if_fail (GST_IS_CAPS (caps));
- gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, f->sample_rate.n,
- f->sample_rate.d, NULL);
+ if (f->sample_rate.d == 0) {
+ GST_ERROR ("Invalid framerate");
+ } else {
+ gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, f->sample_rate.n,
+ f->sample_rate.d, NULL);
+ }
width = self->stored_width;
height = self->stored_height;
@@ -2640,17 +2648,22 @@ void mxf_metadata_generic_picture_essence_descriptor_set_caps
*
* See SMPTE 377M E2.2 and E1.2
*/
- if (self->frame_layout != 0)
+ if (self->frame_layout == 1 || self->frame_layout == 2
+ || self->frame_layout == 4)
height *= 2;
- if (width == 0 || height == 0)
+ if (width == 0 || height == 0) {
+ GST_ERROR ("Invalid width/height");
return;
+ }
gst_caps_set_simple (caps, "width", G_TYPE_INT, width, "height", G_TYPE_INT,
height, NULL);
- if (self->aspect_ratio.n == 0 || self->aspect_ratio.d == 0)
+ if (self->aspect_ratio.n == 0 || self->aspect_ratio.d == 0) {
+ GST_ERROR ("Invalid aspect ratio");
return;
+ }
par_n = height * self->aspect_ratio.n;
par_d = width * self->aspect_ratio.d;
@@ -2761,6 +2774,29 @@ static void
mxf_metadata_generic_sound_essence_descriptor_handle_tag;
}
+void mxf_metadata_generic_sound_essence_descriptor_set_caps
+ (MXFMetadataGenericSoundEssenceDescriptor * self, GstCaps * caps)
+{
+ g_return_if_fail (MXF_IS_METADATA_GENERIC_SOUND_ESSENCE_DESCRIPTOR (self));
+ g_return_if_fail (GST_IS_CAPS (caps));
+
+ if (self->audio_sampling_rate.n == 0 || self->audio_sampling_rate.d == 0) {
+ GST_ERROR ("Invalid audio sampling rate");
+ } else {
+ gst_caps_set_simple (caps,
+ "rate", G_TYPE_INT,
+ (gint) ((((gdouble) self->audio_sampling_rate.n) /
+ ((gdouble) self->audio_sampling_rate.d)) + 0.5), NULL);
+ }
+
+ if (self->channel_count == 0) {
+ GST_ERROR ("Invalid number of channels (0)");
+ } else {
+ gst_caps_set_simple (caps, "channels", G_TYPE_INT, self->channel_count,
+ NULL);
+ }
+}
+
G_DEFINE_TYPE (MXFMetadataCDCIPictureEssenceDescriptor,
mxf_metadata_cdci_picture_essence_descriptor,
MXF_TYPE_METADATA_GENERIC_PICTURE_ESSENCE_DESCRIPTOR);