+2004-05-03 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * sys/v4l/gstv4lelement.h:
+ * sys/v4l/gstv4lmjpegsrc.c: (gst_v4lmjpegsrc_class_init):
+ * sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_fps), (gst_v4lsrc_getcaps),
+ (gst_v4lsrc_buffer_free):
+ * sys/v4l/v4l_calls.c: (gst_v4l_get_capabilities):
+ * sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_queue_frame),
+ (gst_v4lsrc_sync_frame), (gst_v4lsrc_grab_frame),
+ (gst_v4lsrc_requeue_frame):
+ move some debugging categories around
+ query for fps index and set accordingly if found
+
2004-05-03 Stephane Loeuillet <stephane.loeuillet@tiscali.fr>
* ext/lame/gstlame.c:
/* the video buffer (mmap()'ed) */
guint8 *buffer;
- /* the video-device's capabilities */
+ /* the video device's capabilities */
struct video_capability vcap;
+ /* the video device's window properties */
+ struct video_window vwin;
+
/* some more info about the current input's capabilities */
struct video_channel vchan;
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_USE_FIXED_FPS,
g_param_spec_boolean ("use_fixed_fps", "Use Fixed FPS",
"Drop/Insert frames to reach a certain FPS (TRUE) "
- "or adapt FPS to suit the number of frabbed frames",
+ "or adapt FPS to suit the number of grabbed frames",
TRUE, G_PARAM_READWRITE));
/* signals */
gst_v4lsrc_get_fps (GstV4lSrc * v4lsrc)
{
gint norm;
+ gint fps_index;
gfloat fps;
+ struct video_window *vwin = &GST_V4LELEMENT (v4lsrc)->vwin;
+
+ /* check if we have vwin window properties giving a framerate,
+ * as is done for webcams
+ * See http://www.smcc.demon.nl/webcam/api.html
+ * which is used for the Philips and qce-ga drivers */
+ fps_index = (vwin->flags >> 16) & 0x3F; /* 6 bit index for framerate */
+ if (fps_index != 0)
+ /* index of 16 corresponds to 15 fps */
+ return fps_index * 15.0 / 16;
if (!v4lsrc->use_fixed_fps && v4lsrc->clock != NULL && v4lsrc->handled > 0) {
/* try to get time from clock master and calculate fps */
return gst_caps_new_any ();
}
+ fps = gst_v4lsrc_get_fps (v4lsrc);
+
list = gst_caps_new_empty ();
for (item = v4lsrc->colourspaces; item != NULL; item = item->next) {
GstCaps *one;
one = gst_v4lsrc_palette_to_caps (GPOINTER_TO_INT (item->data));
if (!one)
g_print ("Palette %d gave no caps\n", GPOINTER_TO_INT (item->data));
- fps = gst_v4lsrc_get_fps (v4lsrc);
GST_DEBUG_OBJECT (v4lsrc,
"Device reports w: %d-%d, h: %d-%d, fps: %f for palette %d",
vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight, fps,
g_free (v4lsrc_private);
GST_BUFFER_PRIVATE (buf) = 0;
- GST_DEBUG_OBJECT (v4lsrc, "freeing buffer %p with refcount %d for frame %d",
+ GST_LOG_OBJECT (v4lsrc, "freeing buffer %p with refcount %d for frame %d",
buf, GST_BUFFER_REFCOUNT_VALUE (buf), num);
if (gst_element_get_state (GST_ELEMENT (v4lsrc)) != GST_STATE_PLAYING)
return; /* we've already cleaned up ourselves */
v4lsrc->use_num_times[num]--;
if (v4lsrc->use_num_times[num] <= 0) {
- GST_DEBUG_OBJECT (v4lsrc, "requeueing frame %d", num);
+ GST_LOG_OBJECT (v4lsrc, "requeueing frame %d", num);
gst_v4lsrc_requeue_frame (v4lsrc, num);
}
}
return FALSE;
}
+ if (ioctl (v4lelement->video_fd, VIDIOCGWIN, &(v4lelement->vwin)) < 0) {
+ GST_ELEMENT_ERROR (v4lelement, RESOURCE, SETTINGS, (NULL),
+ ("error getting window properties %s of from device %s",
+ g_strerror (errno), v4lelement->videodev));
+ return FALSE;
+ }
+
return TRUE;
}
GST_DEBUG_OBJECT (\
GST_ELEMENT(v4lsrc), \
"V4LSRC: " format, ##args)
+#define LOG(format, args...) \
+ GST_LOG_OBJECT (\
+ GST_ELEMENT(v4lsrc), \
+ "V4LSRC: " format, ##args)
+
/* palette names */
static const char *palette_name[] = {
static gboolean
gst_v4lsrc_queue_frame (GstV4lSrc * v4lsrc, gint num)
{
- DEBUG ("queueing frame %d", num);
+ LOG ("queueing frame %d", num);
if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_READY_FOR_QUEUE) {
return FALSE;
static gboolean
gst_v4lsrc_sync_frame (GstV4lSrc * v4lsrc, gint num)
{
- DEBUG ("Syncing on frame %d", num);
+ LOG ("Syncing on frame %d", num);
if (v4lsrc->frame_queue_state[num] != QUEUE_STATE_QUEUED) {
return FALSE;
gboolean
gst_v4lsrc_grab_frame (GstV4lSrc * v4lsrc, gint * num)
{
- DEBUG ("grabbing frame");
+ LOG ("grabbing frame");
GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));
}
v4lsrc->sync_frame = (v4lsrc->sync_frame + 1) % v4lsrc->mbuf.frames;
- GST_DEBUG ("grabbed frame %d", *num);
+ GST_LOG ("grabbed frame %d", *num);
g_mutex_unlock (v4lsrc->mutex_queue_state);
gboolean
gst_v4lsrc_requeue_frame (GstV4lSrc * v4lsrc, gint num)
{
- DEBUG ("requeueing frame %d", num);
+ LOG ("requeueing frame %d", num);
GST_V4L_CHECK_OPEN (GST_V4LELEMENT (v4lsrc));
GST_V4L_CHECK_ACTIVE (GST_V4LELEMENT (v4lsrc));