From a2b7998dad02e373db08df4cf41afa27d56393a3 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Tue, 17 Oct 2006 13:44:14 +0000 Subject: [PATCH] sys/v4l2/: dear stefan, framespersecond is not frameperiod, reverting but adding comment Original commit message from CVS: * sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists): * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_set_fps), (gst_v4l2src_get_fps): dear stefan, framespersecond is not frameperiod, reverting but adding comment --- ChangeLog | 8 ++++++++ sys/v4l2/v4l2_calls.c | 10 +++++----- sys/v4l2/v4l2src_calls.c | 14 ++++++++------ 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 16b00f5973..f204f09d0f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-10-17 Stefan Kost + + * sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists): + * sys/v4l2/v4l2src_calls.c: (gst_v4l2src_set_fps), + (gst_v4l2src_get_fps): + dear stefan, framespersecond is not frameperiod, reverting but adding + comment + 2006-10-17 Stefan Kost * sys/v4l2/v4l2_calls.c: (gst_v4l2_fill_lists): diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index baacba0ba6..8b3c02fd79 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -153,8 +153,8 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) GstTunerNorm *norm; /* fill in defaults */ - standard.frameperiod.numerator = 0; - standard.frameperiod.denominator = 1; + standard.frameperiod.numerator = 1; + standard.frameperiod.denominator = 0; standard.index = n; if (ioctl (v4l2object->video_fd, VIDIOC_ENUMSTD, &standard) < 0) { if (errno == EINVAL) @@ -168,14 +168,14 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) } GST_DEBUG_OBJECT (v4l2object->element, " '%s', fps: %d / %d", - standard.name, standard.frameperiod.numerator, - standard.frameperiod.denominator); + standard.name, standard.frameperiod.denominator, + standard.frameperiod.numerator); v4l2norm = g_object_new (GST_TYPE_V4L2_TUNER_NORM, NULL); norm = GST_TUNER_NORM (v4l2norm); norm->label = g_strdup ((const gchar *) standard.name); gst_value_set_fraction (&norm->framerate, - standard.frameperiod.numerator, standard.frameperiod.denominator); + standard.frameperiod.denominator, standard.frameperiod.numerator); v4l2norm->index = standard.id; v4l2object->norms = g_list_append (v4l2object->norms, (gpointer) norm); diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 303e674d83..6e087a3a5c 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -738,14 +738,16 @@ gst_v4l2src_set_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d) if (!(stream.parm.capture.capability & V4L2_CAP_TIMEPERFRAME)) goto no_timeperframe; - stream.parm.capture.timeperframe.numerator = *fps_n; - stream.parm.capture.timeperframe.denominator = *fps_d; + /* Note: V4L2 needs the frame interval, we have the frame rate */ + stream.parm.capture.timeperframe.numerator = *fps_d; + stream.parm.capture.timeperframe.denominator = *fps_n; if (ioctl (v4l2object->video_fd, VIDIOC_S_PARM, &stream) < 0) goto sparm_failed; - *fps_n = stream.parm.capture.timeperframe.numerator; - *fps_d = stream.parm.capture.timeperframe.denominator; + /* Note: V4L2 gives us the frame interval, we need the frame rate */ + *fps_d = stream.parm.capture.timeperframe.numerator; + *fps_n = stream.parm.capture.timeperframe.denominator; GST_LOG_OBJECT (v4l2src, "fps set to %d / %d", *fps_n, *fps_d); @@ -796,8 +798,8 @@ gst_v4l2src_get_fps (GstV4l2Src * v4l2src, guint * fps_n, guint * fps_d) } /* Note: V4L2 gives us the frame interval, we need the frame rate */ - *fps_n = stream.parm.capture.timeperframe.numerator; - *fps_d = stream.parm.capture.timeperframe.denominator; + *fps_d = stream.parm.capture.timeperframe.numerator; + *fps_n = stream.parm.capture.timeperframe.denominator; GST_DEBUG_OBJECT (v4l2src, "frame rate returned by G_PARM: %d/%d fps", *fps_n, *fps_d);