add rate parameter
authorDavid Schleef <ds@schleef.org>
Wed, 23 Oct 2002 06:03:03 +0000 (06:03 +0000)
committerDavid Schleef <ds@schleef.org>
Wed, 23 Oct 2002 06:03:03 +0000 (06:03 +0000)
Original commit message from CVS:
add rate parameter

gst/videotestsrc/gstvideotestsrc.c
gst/videotestsrc/gstvideotestsrc.h

index 74033f66a6d317a9b10f6d620f877c14e5ee588b..cc0094d2c39026786f6e4bdeefa90c3ae4c192ab 100644 (file)
@@ -72,6 +72,7 @@ enum
   ARG_WIDTH,
   ARG_HEIGHT,
   ARG_FOURCC,
+  ARG_RATE,
   /* FILL ME */
 };
 
@@ -145,6 +146,9 @@ gst_videotestsrc_class_init (GstVideotestsrcClass * klass)
   g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_FOURCC,
                                   g_param_spec_string ("fourcc", "fourcc", "fourcc",
                                                        NULL, G_PARAM_READWRITE));
+  g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_RATE,
+          g_param_spec_int ("rate", "Rate", "Frame rate",
+               0, 100, 30, G_PARAM_READWRITE));
 
   parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
 
@@ -280,8 +284,9 @@ gst_videotestsrc_init (GstVideotestsrc * videotestsrc)
   videotestsrc->width = 640;
   videotestsrc->height = 480;
 
+  videotestsrc->rate = 30;
   videotestsrc->timestamp = 0;
-  videotestsrc->interval = GST_SECOND / 1;
+  videotestsrc->interval = GST_SECOND / videotestsrc->rate;
 
   videotestsrc->pool = NULL;
 }
@@ -351,6 +356,10 @@ gst_videotestsrc_set_property (GObject * object, guint prop_id, const GValue * v
        printf ("forcing FOURCC to 0x%08x\n", src->forced_format);
       }
       break;
+    case ARG_RATE:
+      src->rate = g_value_get_int (value);
+      src->interval = GST_SECOND/src->rate;
+      break;
     default:
       break;
   }
@@ -376,6 +385,9 @@ gst_videotestsrc_get_property (GObject * object, guint prop_id, GValue * value,
       /* FIXME */
       /* g_value_set_int (value, src->forced_format); */
       break;
+    case ARG_RATE:
+      g_value_set_int (value, src->rate);
+      break;
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
index 5f20d74e7abe1b476d8bd8f90e9ab86845e17318..4e8acd73af15abad6a5855a86fb39a460e97be19 100644 (file)
@@ -68,6 +68,7 @@ struct _GstVideotestsrc {
   gint64 timestamp;
   gint64 interval;
   gint bpp;
+  int rate;
 
   GstBufferPool *pool;