summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Schmidt <thaytan@mad.scientist.com>2005-11-22 20:07:47 +0000
committerJan Schmidt <thaytan@mad.scientist.com>2005-11-22 20:07:47 +0000
commitdad9986cb4646c0090a9c8408c1a1d9e00869ae2 (patch)
tree6ebc973d0760c05eadf9fff29898938f1c54d831
parent842a43f80230c65d024a5859c6b67dc601e7de64 (diff)
Convert to fractional framerates.
Original commit message from CVS: * ext/aalib/gstaasink.c: (gst_aasink_fixate): * gst/debug/gstnavigationtest.c: (gst_navigationtest_handle_src_event): * gst/videofilter/gstvideofilter.c: (gst_videofilter_format_get_structure), (gst_videofilter_setcaps), (gst_videofilter_init): * gst/videofilter/gstvideofilter.h: Convert to fractional framerates.
-rw-r--r--ChangeLog11
-rw-r--r--ext/aalib/gstaasink.c7
-rw-r--r--gst/debug/gstnavigationtest.c10
-rw-r--r--gst/videofilter/gstvideofilter.c11
-rw-r--r--gst/videofilter/gstvideofilter.h2
5 files changed, 33 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index ce435fc6..47c60098 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-11-22 Jan Schmidt <thaytan@mad.scientist.com>
+
+ * ext/aalib/gstaasink.c: (gst_aasink_fixate):
+ * gst/debug/gstnavigationtest.c:
+ (gst_navigationtest_handle_src_event):
+ * gst/videofilter/gstvideofilter.c:
+ (gst_videofilter_format_get_structure), (gst_videofilter_setcaps),
+ (gst_videofilter_init):
+ * gst/videofilter/gstvideofilter.h:
+ Convert to fractional framerates.
+
2005-11-22 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/aalib/gstaasink.c:
diff --git a/ext/aalib/gstaasink.c b/ext/aalib/gstaasink.c
index 4a7b09e0..42ac0233 100644
--- a/ext/aalib/gstaasink.c
+++ b/ext/aalib/gstaasink.c
@@ -236,12 +236,17 @@ static void
gst_aasink_fixate (GstPad * pad, GstCaps * caps)
{
GstStructure *structure;
+ GValue fps = { 0 };
structure = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (structure, "width", 320);
gst_structure_fixate_field_nearest_int (structure, "height", 240);
- gst_structure_fixate_field_nearest_double (structure, "framerate", 30.0);
+
+ g_value_init (&fps, GST_TYPE_FRACTION);
+ gst_value_set_fraction (&fps, 30, 1);
+ gst_structure_fixate_field_nearest_fraction (structure, "framerate", &fps);
+ g_value_unset (&fps);
}
static gboolean
diff --git a/gst/debug/gstnavigationtest.c b/gst/debug/gstnavigationtest.c
index 9b40fc1e..220947a8 100644
--- a/gst/debug/gstnavigationtest.c
+++ b/gst/debug/gstnavigationtest.c
@@ -147,6 +147,12 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
case GST_EVENT_NAVIGATION:
{
const GstStructure *s = gst_event_get_structure (event);
+ gint fps_n, fps_d;
+
+ fps_n = gst_value_get_fraction_numerator (
+ (&GST_VIDEOFILTER (navtest)->framerate));
+ fps_d = gst_value_get_fraction_denominator (
+ (&GST_VIDEOFILTER (navtest)->framerate));
type = gst_structure_get_string (s, "event");
if (g_str_equal (type, "mouse-move")) {
@@ -157,7 +163,7 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
gst_structure_get_double (s, "pointer_x", &click->x);
gst_structure_get_double (s, "pointer_y", &click->y);
- click->images_left = ceil (GST_VIDEOFILTER (navtest)->framerate);
+ click->images_left = (fps_n + fps_d - 1) / fps_d;
/* green */
click->cy = 150;
click->cu = 46;
@@ -168,7 +174,7 @@ gst_navigationtest_handle_src_event (GstPad * pad, GstEvent * event)
gst_structure_get_double (s, "pointer_x", &click->x);
gst_structure_get_double (s, "pointer_y", &click->y);
- click->images_left = ceil (GST_VIDEOFILTER (navtest)->framerate);
+ click->images_left = (fps_n + fps_d - 1) / fps_d;
/* red */
click->cy = 76;
click->cu = 85;
diff --git a/gst/videofilter/gstvideofilter.c b/gst/videofilter/gstvideofilter.c
index 1c206294..89951bb9 100644
--- a/gst/videofilter/gstvideofilter.c
+++ b/gst/videofilter/gstvideofilter.c
@@ -147,7 +147,7 @@ gst_videofilter_format_get_structure (GstVideofilterFormat * format)
gst_structure_set (structure,
"height", GST_TYPE_INT_RANGE, 1, G_MAXINT,
"width", GST_TYPE_INT_RANGE, 1, G_MAXINT,
- "framerate", GST_TYPE_DOUBLE_RANGE, 0.0, G_MAXDOUBLE, NULL);
+ "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
return structure;
}
@@ -221,7 +221,7 @@ gst_videofilter_setcaps (GstPad * pad, GstCaps * caps)
GstVideofilter *videofilter;
GstStructure *structure;
int width, height;
- double framerate;
+ const GValue *framerate;
int ret;
videofilter = GST_VIDEOFILTER (GST_PAD_PARENT (pad));
@@ -234,7 +234,9 @@ gst_videofilter_setcaps (GstPad * pad, GstCaps * caps)
ret = gst_structure_get_int (structure, "width", &width);
ret &= gst_structure_get_int (structure, "height", &height);
- ret &= gst_structure_get_double (structure, "framerate", &framerate);
+
+ framerate = gst_structure_get_value (structure, "framerate");
+ ret &= (framerate != NULL && GST_VALUE_HOLDS_FRACTION (framerate));
if (!ret)
return FALSE;
@@ -256,7 +258,7 @@ gst_videofilter_setcaps (GstPad * pad, GstCaps * caps)
videofilter->to_height = height;
videofilter->from_width = width;
videofilter->from_height = height;
- videofilter->framerate = framerate;
+ g_value_copy (framerate, &videofilter->framerate);
gst_videofilter_setup (videofilter);
@@ -288,6 +290,7 @@ gst_videofilter_init (GTypeInstance * instance, gpointer g_class)
gst_pad_set_getcaps_function (videofilter->srcpad, gst_videofilter_getcaps);
videofilter->inited = FALSE;
+ g_value_init (&videofilter->framerate, GST_TYPE_FRACTION);
}
static GstFlowReturn
diff --git a/gst/videofilter/gstvideofilter.h b/gst/videofilter/gstvideofilter.h
index 83d07e32..9923a2a7 100644
--- a/gst/videofilter/gstvideofilter.h
+++ b/gst/videofilter/gstvideofilter.h
@@ -75,7 +75,7 @@ struct _GstVideofilter {
/* private */
gint from_buf_size;
gint to_buf_size;
- gdouble framerate;
+ GValue framerate;
GstBuffer *in_buf;
GstBuffer *out_buf;