sys/v4l/gstv4lsrc.c: Set FPS correctly, even for webcams and the like.

Original commit message from CVS:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_getcaps):
Set FPS correctly, even for webcams and the like.
* sys/v4l/v4l_calls.c: (gst_v4l_set_chan_norm):
Don error on setting while capturing.
This commit is contained in:
Ronald S. Bultje 2005-01-14 22:39:37 +00:00
parent 9df714d4ca
commit 5a7c2ff712
3 changed files with 21 additions and 19 deletions

View file

@ -1,3 +1,10 @@
2005-01-14 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_getcaps):
Set FPS correctly, even for webcams and the like.
* sys/v4l/v4l_calls.c: (gst_v4l_set_chan_norm):
Don error on setting while capturing.
2005-01-14 Stephane LOEUILLET <stephane.loeuillet@tiscali.fr> 2005-01-14 Stephane LOEUILLET <stephane.loeuillet@tiscali.fr>
* ext/dv/gstdvdec.c: * ext/dv/gstdvdec.c:

View file

@ -826,21 +826,17 @@ gst_v4lsrc_getcaps (GstPad * pad)
} }
fps = gst_v4lsrc_get_fps (v4lsrc); fps = gst_v4lsrc_get_fps (v4lsrc);
/*
FIXME: if we choose a fixed one because we didn't probe, fixated caps don't
work. So comment this out for now.
if (!v4lsrc->fps_list)
fps = gst_v4lsrc_get_fps (v4lsrc);
*/
list = gst_caps_new_empty (); list = gst_caps_new_empty ();
for (item = v4lsrc->colourspaces; item != NULL; item = item->next) { for (item = v4lsrc->colourspaces; item != NULL; item = item->next) {
GstCaps *one; GstCaps *one;
one = gst_v4lsrc_palette_to_caps (GPOINTER_TO_INT (item->data)); one = gst_v4lsrc_palette_to_caps (GPOINTER_TO_INT (item->data));
if (!one) if (!one) {
GST_WARNING_OBJECT (v4lsrc, "Palette %d gave no caps\n", GST_WARNING_OBJECT (v4lsrc, "Palette %d gave no caps\n",
GPOINTER_TO_INT (item->data)); GPOINTER_TO_INT (item->data));
continue;
}
GST_DEBUG_OBJECT (v4lsrc, GST_DEBUG_OBJECT (v4lsrc,
"Device reports w: %d-%d, h: %d-%d, fps: %f for palette %d", "Device reports w: %d-%d, h: %d-%d, fps: %f for palette %d",
vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight, fps, vcap->minwidth, vcap->maxwidth, vcap->minheight, vcap->maxheight, fps,
@ -859,6 +855,7 @@ gst_v4lsrc_getcaps (GstPad * pad)
gst_caps_set_simple (one, "height", G_TYPE_INT, vcap->minheight, NULL); gst_caps_set_simple (one, "height", G_TYPE_INT, vcap->minheight, NULL);
} }
if (v4lsrc->autoprobe_fps) {
if (v4lsrc->fps_list) { if (v4lsrc->fps_list) {
GstStructure *structure = gst_caps_get_structure (one, 0); GstStructure *structure = gst_caps_get_structure (one, 0);
@ -866,13 +863,11 @@ gst_v4lsrc_getcaps (GstPad * pad)
} else { } else {
gst_caps_set_simple (one, "framerate", G_TYPE_DOUBLE, fps, NULL); gst_caps_set_simple (one, "framerate", G_TYPE_DOUBLE, fps, NULL);
} }
/* see higher up why we comment this } else {
else { gst_caps_set_simple (one, "framerate", GST_TYPE_DOUBLE_RANGE,
GstStructure *structure = gst_caps_get_structure (one, 0); (gdouble) 1.0, (gdouble) 100.0, NULL);
gst_structure_set (structure, "framerate", G_TYPE_DOUBLE, fps, NULL);
} }
*/
GST_DEBUG_OBJECT (v4lsrc, "caps: %" GST_PTR_FORMAT, one); GST_DEBUG_OBJECT (v4lsrc, "caps: %" GST_PTR_FORMAT, one);
gst_caps_append (list, one); gst_caps_append (list, one);
} }

View file

@ -395,7 +395,7 @@ gst_v4l_set_chan_norm (GstV4lElement * v4lelement, gint channel, gint norm)
GST_DEBUG_OBJECT (v4lelement, "setting channel = %d, norm = %d (%s)", GST_DEBUG_OBJECT (v4lelement, "setting channel = %d, norm = %d (%s)",
channel, norm, norm_name[norm]); channel, norm, norm_name[norm]);
GST_V4L_CHECK_OPEN (v4lelement); GST_V4L_CHECK_OPEN (v4lelement);
GST_V4L_CHECK_NOT_ACTIVE (v4lelement); //GST_V4L_CHECK_NOT_ACTIVE (v4lelement);
v4lelement->vchan.channel = channel; v4lelement->vchan.channel = channel;
v4lelement->vchan.norm = norm; v4lelement->vchan.norm = norm;