ext/sdl/sdlvideosink.*: Updates for fractional framerates and XOverlay interface...
authorJan Schmidt <thaytan@mad.scientist.com>
Wed, 23 Nov 2005 15:36:08 +0000 (15:36 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Wed, 23 Nov 2005 15:36:08 +0000 (15:36 +0000)
Original commit message from CVS:
* ext/sdl/sdlvideosink.c: (gst_sdlvideosink_base_init),
(gst_sdlvideosink_get_times), (gst_sdlvideosink_init),
(gst_sdlvideosink_setcaps), (gst_sdlvideosink_change_state):
* ext/sdl/sdlvideosink.h:
Updates for fractional framerates and XOverlay interface changes

ChangeLog
ext/sdl/sdlvideosink.c
ext/sdl/sdlvideosink.h

index 263b41a..3f2230d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2005-11-23  Jan Schmidt  <thaytan@mad.scientist.com>
 
+       * ext/sdl/sdlvideosink.c: (gst_sdlvideosink_base_init),
+       (gst_sdlvideosink_get_times), (gst_sdlvideosink_init),
+       (gst_sdlvideosink_setcaps), (gst_sdlvideosink_change_state):
+       * ext/sdl/sdlvideosink.h:
+       Updates for fractional framerates and XOverlay interface changes
+
+2005-11-23  Jan Schmidt  <thaytan@mad.scientist.com>
+
        * gst/qtdemux/qtdemux.c: (gst_qtdemux_loop_header),
        (gst_qtdemux_add_stream), (qtdemux_dump_mvhd),
        (qtdemux_parse_trak):
index 9671a5e..4f99835 100644 (file)
@@ -164,8 +164,7 @@ gst_sdlvideosink_base_init (gpointer g_class)
             "format", GST_TYPE_FOURCC, formats[i],
             "width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
             "height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
-            "framerate", GST_TYPE_DOUBLE_RANGE, (gdouble) 1.0,
-            (gdouble) 100.0, NULL));
+            "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, 100, 1, NULL));
   }
 
   sink_template = gst_pad_template_new ("sink",
@@ -200,8 +199,10 @@ gst_sdlvideosink_get_times (GstBaseSink * basesink, GstBuffer * buffer,
     if (GST_CLOCK_TIME_IS_VALID (duration)) {
       *end = timestamp + duration;
     } else {
-      if (sdlvideosink->framerate > 0) {
-        *end = timestamp + GST_SECOND / sdlvideosink->framerate;
+      if (sdlvideosink->framerate_n > 0) {
+        *end = timestamp +
+            gst_util_uint64_scale_int (GST_SECOND, sdlvideosink->framerate_d,
+            sdlvideosink->framerate_n);
       }
     }
   }
@@ -307,7 +308,8 @@ gst_sdlvideosink_init (GstSDLVideoSink * sdlvideosink)
 
   sdlvideosink->width = -1;
   sdlvideosink->height = -1;
-  sdlvideosink->framerate = 0;
+  sdlvideosink->framerate_n = 0;
+  sdlvideosink->framerate_d = 1;
   sdlvideosink->full_screen = FALSE;
 
   sdlvideosink->overlay = NULL;
@@ -668,14 +670,12 @@ gst_sdlvideosink_setcaps (GstBaseSink * bsink, GstCaps * vscapslist)
       gst_sdlvideosink_get_sdl_from_fourcc (sdlvideosink, sdlvideosink->fourcc);
   gst_structure_get_int (structure, "width", &sdlvideosink->width);
   gst_structure_get_int (structure, "height", &sdlvideosink->height);
-  gst_structure_get_double (structure, "framerate", &sdlvideosink->framerate);
+  gst_structure_get_fraction (structure, "framerate",
+      &sdlvideosink->framerate_n, &sdlvideosink->framerate_d);
 
   if (!sdlvideosink->format || !gst_sdlvideosink_create (sdlvideosink))
     return FALSE;
 
-  gst_x_overlay_got_desired_size (GST_X_OVERLAY (sdlvideosink),
-      sdlvideosink->width, sdlvideosink->height);
-
   return TRUE;
 }
 
@@ -824,7 +824,8 @@ gst_sdlvideosink_change_state (GstElement * element, GstStateChange transition)
 
   switch (transition) {
     case GST_STATE_CHANGE_PAUSED_TO_READY:
-      sdlvideosink->framerate = 0;
+      sdlvideosink->framerate_n = 0;
+      sdlvideosink->framerate_d = 1;
       gst_sdlvideosink_destroy (sdlvideosink);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
index c2d9b60..dc41c0f 100644 (file)
@@ -55,7 +55,8 @@ struct _GstSDLVideoSink {
   gint width, height;   /* the size of the incoming YUV stream */
   unsigned long xwindow_id;
   
-  gdouble framerate;
+  gint framerate_n;
+  gint framerate_d;
 
   gboolean full_screen;
   gboolean init;