diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-21 16:05:48 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-21 16:16:32 +0100 |
commit | 636b535e4ae741bcf5010fead6357c7138468404 (patch) | |
tree | 0b7a0a58d27a5aefc6d9313522bb8d3b602de771 /gst/mxf | |
parent | 8172830d47a91ba81bb61d004cf6c388efcbd198 (diff) | |
download | gst-plugins-bad-636b535e4ae741bcf5010fead6357c7138468404.tar.gz gst-plugins-bad-636b535e4ae741bcf5010fead6357c7138468404.tar.bz2 gst-plugins-bad-636b535e4ae741bcf5010fead6357c7138468404.zip |
mxfdemux: Add helper function to convert MXFraction to gdouble and use it
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/mxfmetadata.c | 4 | ||||
-rw-r--r-- | gst/mxf/mxfparse.c | 6 | ||||
-rw-r--r-- | gst/mxf/mxfparse.h | 1 |
3 files changed, 9 insertions, 2 deletions
diff --git a/gst/mxf/mxfmetadata.c b/gst/mxf/mxfmetadata.c index a300ba34..44acb785 100644 --- a/gst/mxf/mxfmetadata.c +++ b/gst/mxf/mxfmetadata.c @@ -2806,8 +2806,8 @@ void mxf_metadata_generic_sound_essence_descriptor_set_caps } 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); + (gint) (mxf_fraction_to_double (&self->audio_sampling_rate) + + 0.5), NULL); } if (self->channel_count == 0) { diff --git a/gst/mxf/mxfparse.c b/gst/mxf/mxfparse.c index 2611e817..d4d52312 100644 --- a/gst/mxf/mxfparse.c +++ b/gst/mxf/mxfparse.c @@ -417,6 +417,12 @@ mxf_fraction_parse (MXFFraction * fraction, const guint8 * data, guint size) return TRUE; } +gdouble +mxf_fraction_to_double (const MXFFraction * fraction) +{ + return ((gdouble) fraction->n) / ((gdouble) fraction->d); +} + gchar * mxf_utf16_to_utf8 (const guint8 * data, guint size) { diff --git a/gst/mxf/mxfparse.h b/gst/mxf/mxfparse.h index 08e8af89..5a5e630e 100644 --- a/gst/mxf/mxfparse.h +++ b/gst/mxf/mxfparse.h @@ -74,6 +74,7 @@ gboolean mxf_product_version_parse (MXFProductVersion * product_version, const guint8 * data, guint size); gboolean mxf_fraction_parse (MXFFraction *fraction, const guint8 *data, guint size); +gdouble mxf_fraction_to_double (const MXFFraction *fraction); gboolean mxf_timestamp_parse (MXFTimestamp * timestamp, const guint8 * data, guint size); gboolean mxf_timestamp_is_unknown (const MXFTimestamp *a); |