ext/ogg/gstogmparse.c: GST_TYPE_FRACTION contains gints so correctly cast gint64...
authorSebastian Dröge <slomo@circular-chaos.org>
Sun, 20 Apr 2008 11:42:37 +0000 (11:42 +0000)
committerSebastian Dröge <slomo@circular-chaos.org>
Sun, 20 Apr 2008 11:42:37 +0000 (11:42 +0000)
Original commit message from CVS:
* ext/ogg/gstogmparse.c: (gst_ogm_parse_stream_header):
GST_TYPE_FRACTION contains gints so correctly cast gint64 arguments to
vaargs functions to gint. Otherwise the fractions will get 0 set
instead of the correct value on big endian systems. Fixes bug #529018.

ChangeLog
ext/ogg/gstogmparse.c

index a81f799..b6a7fda 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2008-04-20  Sebastian Dröge  <slomo@circular-chaos.org>
 
+       * ext/ogg/gstogmparse.c: (gst_ogm_parse_stream_header):
+       GST_TYPE_FRACTION contains gints so correctly cast gint64 arguments to
+       vaargs functions to gint. Otherwise the fractions will get 0 set
+       instead of the correct value on big endian systems. Fixes bug #529018.
+
+2008-04-20  Sebastian Dröge  <slomo@circular-chaos.org>
+
        * ext/gnomevfs/gstgnomevfssink.c:
        (gst_gnome_vfs_sink_uri_get_protocols):
        * ext/gnomevfs/gstgnomevfssrc.c:
index cdf3c75..b52b466 100644 (file)
@@ -577,6 +577,7 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
     }
     case 'v':{
       guint32 fourcc;
+      gint time_unit;
 
       fourcc = GST_MAKE_FOURCC (ogm->hdr.subtype[0],
           ogm->hdr.subtype[1], ogm->hdr.subtype[2], ogm->hdr.subtype[3]);
@@ -601,10 +602,15 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
           ogm->hdr.samples_per_unit, ogm->hdr.default_len,
           ogm->hdr.buffersize, ogm->hdr.bits_per_sample, caps);
 
+      /* GST_TYPE_FRACTION contains gint */
+      if (ogm->hdr.time_unit > G_MAXINT || ogm->hdr.time_unit < G_MININT)
+        GST_WARNING_OBJECT (ogm, "timeunit is out of range");
+
+      time_unit = (gint) CLAMP (ogm->hdr.time_unit, G_MININT, G_MAXINT);
       gst_caps_set_simple (caps,
           "width", G_TYPE_INT, ogm->hdr.s.video.width,
           "height", G_TYPE_INT, ogm->hdr.s.video.height,
-          "framerate", GST_TYPE_FRACTION, 10000000, ogm->hdr.time_unit, NULL);
+          "framerate", GST_TYPE_FRACTION, 10000000, time_unit, NULL);
       break;
     }
     case 't':{