diff --git a/ChangeLog b/ChangeLog index a766bf0a64..d36aac5b8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2006-11-01 Edgard Lima + + * sys/v4l2/Makefile.am: + * sys/v4l2/gstv4l2object.c: + * sys/v4l2/gstv4l2src.c: + * sys/v4l2/gstv4l2xoverlay.c: + * sys/v4l2/v4l2_calls.c: + * sys/v4l2/v4l2src_calls.c: + Improved comments in ELEMENT_ERROR/WARNING and added "#if 0" to + xoverlay code that is still not implemented. + 2006-11-01 Tim-Philipp Müller * gst/id3demux/id3v2frames.c: (parse_picture_frame): diff --git a/sys/v4l2/Makefile.am b/sys/v4l2/Makefile.am index 82e2ff3324..0def89fb1e 100644 --- a/sys/v4l2/Makefile.am +++ b/sys/v4l2/Makefile.am @@ -1,12 +1,13 @@ plugin_LTLIBRARIES = libgstvideo4linux2.la -if USE_XVIDEO -xv_source = gstv4l2xoverlay.c -xv_libs = $(X_LIBS) $(XVIDEO_LIBS) -else -xv_source = -xv_libs = -endif +# overlay is still not supported in current implementation +# if USE_XVIDEO +#xv_source = gstv4l2xoverlay.c +#xv_libs = $(X_LIBS) $(XVIDEO_LIBS) +#else +#xv_source = +#xv_libs = +#endif libgstvideo4linux2_la_SOURCES = gstv4l2.c \ gstv4l2colorbalance.c \ diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 3ed211df53..32d1a556f5 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -30,7 +30,7 @@ #include "v4l2_calls.h" #include "gstv4l2tuner.h" -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ #include "gstv4l2xoverlay.h" #endif #include "gstv4l2colorbalance.h" @@ -488,7 +488,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object) else return FALSE; -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ gst_v4l2_xoverlay_start (v4l2object); #endif @@ -498,7 +498,7 @@ gst_v4l2_object_start (GstV4l2Object * v4l2object) gboolean gst_v4l2_object_stop (GstV4l2Object * v4l2object) { -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ gst_v4l2_xoverlay_stop (v4l2object); #endif diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index d17852579b..3b28475a2b 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -128,7 +128,7 @@ static const guint32 gst_v4l2_formats[] = { GST_IMPLEMENT_V4L2_PROBE_METHODS (GstV4l2SrcClass, gst_v4l2src); GST_IMPLEMENT_V4L2_COLOR_BALANCE_METHODS (GstV4l2Src, gst_v4l2src); GST_IMPLEMENT_V4L2_TUNER_METHODS (GstV4l2Src, gst_v4l2src); -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ GST_IMPLEMENT_V4L2_XOVERLAY_METHODS (GstV4l2Src, gst_v4l2src); #endif GST_IMPLEMENT_V4L2_VIDORIENT_METHODS (GstV4l2Src, gst_v4l2src); @@ -138,7 +138,7 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type) { GstV4l2Object *v4l2object = GST_V4L2SRC (iface)->v4l2object; -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ g_assert (iface_type == GST_TYPE_TUNER || iface_type == GST_TYPE_X_OVERLAY || iface_type == GST_TYPE_COLOR_BALANCE || @@ -152,7 +152,7 @@ gst_v4l2src_iface_supported (GstImplementsInterface * iface, GType iface_type) if (v4l2object->video_fd == -1) return FALSE; -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ if (iface_type == GST_TYPE_X_OVERLAY && !GST_V4L2_IS_OVERLAY (v4l2object)) return FALSE; #endif @@ -182,7 +182,7 @@ gst_v4l2src_init_interfaces (GType type) NULL, NULL, }; -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ static const GInterfaceInfo v4l2_xoverlay_info = { (GInterfaceInitFunc) gst_v4l2src_xoverlay_interface_init, NULL, @@ -208,7 +208,7 @@ gst_v4l2src_init_interfaces (GType type) g_type_add_interface_static (type, GST_TYPE_IMPLEMENTS_INTERFACE, &v4l2iface_info); g_type_add_interface_static (type, GST_TYPE_TUNER, &v4l2_tuner_info); -#ifdef HAVE_XVIDEO +#if 0 /* overlay is still not implemented #ifdef HAVE_XVIDEO */ g_type_add_interface_static (type, GST_TYPE_X_OVERLAY, &v4l2_xoverlay_info); #endif g_type_add_interface_static (type, @@ -762,7 +762,7 @@ static gboolean gst_v4l2src_set_caps (GstBaseSrc * src, GstCaps * caps) { GstV4l2Src *v4l2src; - gint w, h; + gint w = 0, h = 0; GstStructure *structure; struct v4l2_fmtdesc *format; const GValue *framerate; @@ -908,14 +908,16 @@ gst_v4l2src_get_read (GstV4l2Src * v4l2src, GstBuffer ** buf) read_error: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, - (_("Error read()ing %d bytes on device %s."), + (_("Error read()ing %d bytes on device '%s'."), buffersize, v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); gst_buffer_unref (*buf); return GST_FLOW_ERROR; } short_read: { - GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, (NULL), + GST_ELEMENT_ERROR (v4l2src, RESOURCE, SYNC, + (_("Error reading from device '%s'"), + v4l2src->v4l2object->videodev), ("Error read()ing a buffer on device %s: got only %d bytes instead of expected %d.", v4l2src->v4l2object->videodev, amount, buffersize)); gst_buffer_unref (*buf); diff --git a/sys/v4l2/v4l2_calls.c b/sys/v4l2/v4l2_calls.c index 8b3c02fd79..3b89fabf08 100644 --- a/sys/v4l2/v4l2_calls.c +++ b/sys/v4l2/v4l2_calls.c @@ -99,8 +99,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) break; /* end of enumeration */ else { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get %d in channel enumeration for %s."), - n, v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed to query attributes of input %d in device %s"), + n, v4l2object->videodev), + ("Failed to get %d in input enumeration for %s. (%d - %s)", + n, v4l2object->videodev, errno, strerror (errno))); return FALSE; } } @@ -121,7 +123,7 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) vtun.index = input.tuner; if (ioctl (v4l2object->video_fd, VIDIOC_G_TUNER, &vtun) < 0) { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get tuner %d settings on %s."), + (_("Failed to get setting of tuner &d on device '%s'."), input.tuner, v4l2object->videodev), GST_ERROR_SYSTEM); g_object_unref (G_OBJECT (channel)); return FALSE; @@ -161,8 +163,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) break; /* end of enumeration */ else { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get %d in norm enumeration for %s."), - n, v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed to query norm on device '%s'."), + v4l2object->videodev), + ("Failed to get attributes for norm %d on devide '%s'. (%d - %s)", + n, v4l2object->videodev, errno, strerror (errno))); return FALSE; } } @@ -207,8 +211,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) break; } else { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get %d in control enumeration for %s."), - n, v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed getting controls attributes on device '%s."), + v4l2object->videodev), + ("Failed querying control %d on device '%s'. (%d - %s)", + n, v4l2object->videodev, errno, strerror (errno))); return FALSE; } } @@ -276,8 +282,10 @@ gst_v4l2_fill_lists (GstV4l2Object * v4l2object) break; /* end of enumeration */ else { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get %d in menu enumeration for %s"), - n, v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed getting controls attributes on device '%s."), + v4l2object->videodev), + ("Failed to get %d in menu enumeration for %s. (%d - %s)", + n, v4l2object->videodev, errno, strerror (errno))); return FALSE; } } @@ -406,14 +414,14 @@ no_device: not_open: { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, OPEN_READ_WRITE, - (_("Could not open device \"%s\" for reading and writing."), + (_("Could not open device '%s' for reading and writing."), v4l2object->videodev), GST_ERROR_SYSTEM); goto error; } not_capture: { GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, NOT_FOUND, - (_("Device \"%s\" is not a capture device."), + (_("Device '%s' is not a capture device."), v4l2object->videodev), ("Capabilities: 0x%x", v4l2object->vcap.capabilities)); goto error; @@ -508,8 +516,8 @@ gst_v4l2_set_norm (GstV4l2Object * v4l2object, v4l2_std_id norm) std_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to set norm 0x%llx for device %s: %s."), - norm, v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed to set norm for device '%s'."), + v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } } @@ -545,7 +553,7 @@ gst_v4l2_get_frequency (GstV4l2Object * v4l2object, freq_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get current tuner frequency for device %s."), + (_("Failed to get current tuner frequency for device '%s'."), v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -586,7 +594,7 @@ gst_v4l2_set_frequency (GstV4l2Object * v4l2object, freq_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to set current tuner frequency for device %s to %lu."), + (_("Failed to set current tuner frequency for device '%s' to %lu Hz."), v4l2object->videodev, frequency), GST_ERROR_SYSTEM); return FALSE; } @@ -620,7 +628,7 @@ gst_v4l2_signal_strength (GstV4l2Object * v4l2object, tuner_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get signal strength for device %s."), + (_("Failed to get signal strength for device '%s'."), v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -656,7 +664,7 @@ gst_v4l2_get_attribute (GstV4l2Object * v4l2object, ctrl_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get value for control %d on device %s."), + (_("Failed to get value for control %d on device '%s'."), attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -691,7 +699,7 @@ gst_v4l2_set_attribute (GstV4l2Object * v4l2object, ctrl_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to set value %d for control %d on device %s."), + (_("Failed to set value %d for control %d on device '%s'."), value, attribute_num, v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -718,7 +726,7 @@ gst_v4l2_get_input (GstV4l2Object * v4l2object, gint * input) input_failed: { GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, SETTINGS, - (_("Failed to get current input on device %s."), + (_("Failed to get current input on device '%s'."), v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } diff --git a/sys/v4l2/v4l2src_calls.c b/sys/v4l2/v4l2src_calls.c index 6e087a3a5c..4bf1216be1 100644 --- a/sys/v4l2/v4l2src_calls.c +++ b/sys/v4l2/v4l2src_calls.c @@ -92,8 +92,7 @@ gst_v4l2src_fill_format_list (GstV4l2Src * v4l2src) failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, - (_("Failed to get number %d in pixelformat enumeration for %s."), - n, v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed to enumerate possible video formats device '%s' can work with"), v4l2src->v4l2object->videodev), ("Failed to get number %d in pixelformat enumeration for %s. (%d - %s)", n, v4l2src->v4l2object->videodev, errno, strerror (errno))); g_free (format); return FALSE; } @@ -135,7 +134,7 @@ gst_v4l2src_queue_frame (GstV4l2Src * v4l2src, guint i) failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, WRITE, - (_("Could not write to device '%s'."), + (_("Could not exchange data with device '%s'."), v4l2src->v4l2object->videodev), ("Error queueing buffer %u on device %s. system error: %s", i, v4l2src->v4l2object->videodev, g_strerror (errno))); @@ -184,9 +183,9 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src) v4l2src->v4l2object->videodev); break; default: - GST_ELEMENT_WARNING (v4l2src, RESOURCE, FAILED, + GST_WARNING_OBJECT (v4l2src, (_("Grabbing frame got interrupted on %s. No expected reason."), - v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); + v4l2src->v4l2object->videodev)); break; } @@ -208,7 +207,7 @@ gst_v4l2src_grab_frame (GstV4l2Src * v4l2src) einval: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED, - (_("Failed trying to get frames from device %s."), + (_("Failed trying to get video frames from device '%s'."), v4l2src->v4l2object->videodev), (_("The buffer type is not supported, or the index is out of bounds," " or no buffers have been allocated yet, or the userptr" @@ -219,16 +218,13 @@ einval: nomem: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED, - (_("Failed trying to get frames from device %s. Not enough memory."), - v4l2src->v4l2object->videodev), - (_("insufficient memory to enqueue a user pointer buffer. device %s."), - v4l2src->v4l2object->videodev)); + (_("Failed trying to get video frames from device '%s'. Not enough memory."), v4l2src->v4l2object->videodev), (_("insufficient memory to enqueue a user pointer buffer. device %s."), v4l2src->v4l2object->videodev)); return -1; } too_many_trials: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, FAILED, - (_("Failed trying to get frames from device %s."), + (_("Failed trying to get video frames from device '%s'."), v4l2src->v4l2object->videodev), (_("Failed after 100 tries. device %s."), v4l2src->v4l2object->videodev)); @@ -261,8 +257,10 @@ gst_v4l2src_get_capture (GstV4l2Src * v4l2src) fmt_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, - (_("Failed to get pixelformat for device %s."), - v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); + (_("Failed querying in which video format device '%s' is working with"), + v4l2src->v4l2object->videodev), + ("Failed VIDIOC_G_FMT for %s. (%d - %s)", + v4l2src->v4l2object->videodev, errno, strerror (errno))); return FALSE; } } @@ -302,9 +300,8 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, if (*width != v4l2src->format.fmt.pix.width || *height != v4l2src->format.fmt.pix.height) { - DEBUG ("Updating size from %dx%d to %dx%d, format %s", - *width, *height, v4l2src->format.fmt.pix.width, - v4l2src->format.fmt.pix.height, fmt->description); + GST_ELEMENT_WARNING (v4l2src, STREAM, WRONG_TYPE, + (_("The closest size from %dx%d is %dx%d, for video format %s on device '%s'"), *width, *height, v4l2src->format.fmt.pix.width, v4l2src->format.fmt.pix.height, fmt->description, v4l2src->v4l2object->videodev), ("Updating size from %dx%d to %dx%d, format %s", *width, *height, v4l2src->format.fmt.pix.width, v4l2src->format.fmt.pix.height, fmt->description)); } /* update internal info, posted error */ @@ -317,8 +314,13 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, if (*fps_n) { if (gst_v4l2src_set_fps (v4l2src, &new_fps_n, &new_fps_d)) { if (new_fps_n != *fps_n || new_fps_d != *fps_d) { - DEBUG ("Updating framerate from %u/%u to %u%u", - *fps_n, *fps_d, new_fps_n, new_fps_d); + GST_ELEMENT_WARNING (v4l2src, STREAM, WRONG_TYPE, + (_("The closest framerate from %u/%u is %u/%u, on device '%s'"), + *fps_n, *fps_d, new_fps_n, new_fps_d, + v4l2src->v4l2object->videodev), + ("Updating framerate from %u/%u to %u%u", *fps_n, *fps_d, new_fps_n, + new_fps_d)); + *fps_n = new_fps_n; *fps_d = new_fps_d; } @@ -340,17 +342,21 @@ gst_v4l2src_set_capture (GstV4l2Src * v4l2src, fmt_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, - (_("Failed to set pixelformat to %s @ %dx%d for device %s: %s."), - fmt->description, *width, *height, v4l2src->v4l2object->videodev), - GST_ERROR_SYSTEM); + (_("Failed setting the video format for device '%s'"), + v4l2src->v4l2object->videodev), + ("Failed to set pixelformat to %s @ %dx%d for device %s. (%d - %s)", + fmt->description, *width, *height, + v4l2src->v4l2object->videodev, errno, strerror (errno))); return FALSE; } pixfmt_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, SETTINGS, - (_("Failed to set pixelformat to %s @ %dx%d for device %s: %s."), - fmt->description, *width, *height, v4l2src->v4l2object->videodev), - GST_ERROR_SYSTEM); + (_("Failed setting the video format for device '%s'"), + v4l2src->v4l2object->videodev), + ("Failed to set pixelformat to %s @ %dx%d for device %s. (%d - %s)", + fmt->description, *width, *height, + v4l2src->v4l2object->videodev, errno, strerror (errno))); return FALSE; } fail: @@ -468,8 +474,8 @@ reqbufs_failed: GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (_("Could not get buffers from device '%s'."), v4l2src->v4l2object->videodev), - ("error requesting %d buffers. system error: %s", - v4l2src->breq.count, g_strerror (errno))); + ("error requesting %d buffers. (%d - %s)", + v4l2src->breq.count, errno, g_strerror (errno))); return FALSE; } broken_driver: @@ -477,8 +483,8 @@ broken_driver: GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (_("The driver of device '%s' is broken."), v4l2src->v4l2object->videodev), - ("no supported read capability from %s", - v4l2src->v4l2object->videodev)); + ("no supported read capability from %s. (%d - %s)", + v4l2src->v4l2object->videodev, errno, strerror (errno))); return FALSE; } no_buffers: @@ -486,23 +492,28 @@ no_buffers: GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, (_("Could not get enough buffers from device '%s'."), v4l2src->v4l2object->videodev), - ("we received %d, we want at least %d", - v4l2src->breq.count, GST_V4L2_MIN_BUFFERS)); + ("we received %d from device '%s', we want at least %d. (%d - %s))", + v4l2src->breq.count, v4l2src->v4l2object->videodev, + GST_V4L2_MIN_BUFFERS, errno, strerror (errno))); v4l2src->breq.count = buffers; return FALSE; } querybuf_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not get buffer properties of buffer %d."), n), - GST_ERROR_SYSTEM); + (_("Could not get properties of data comming from device '%s'"), + v4l2src->v4l2object->videodev), + ("Failed querying buffer properties. (%d - %s)", + errno, strerror (errno))); gst_v4l2src_capture_deinit (v4l2src); return FALSE; } mmap_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, READ, - (_("Could not mmap video buffer %d."), n), GST_ERROR_SYSTEM); + (_("Could not map memory in device '%s'."), + v4l2src->v4l2object->videodev), + ("mmap failed. (%d - %s)", errno, strerror (errno))); gst_v4l2src_capture_deinit (v4l2src); buffer->start = 0; return FALSE; @@ -545,7 +556,7 @@ gst_v4l2src_capture_start (GstV4l2Src * v4l2src) streamon_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, OPEN_READ, - (_("Error starting streaming capture from device %s."), + (_("Error starting streaming capture from device '%s'."), v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; } @@ -583,7 +594,7 @@ gst_v4l2src_capture_stop (GstV4l2Src * v4l2src) streamoff_failed: { GST_ELEMENT_ERROR (v4l2src, RESOURCE, CLOSE, - (_("Error stopping streaming capture from device %s."), + (_("Error stopping streaming capture from device '%s'."), v4l2src->v4l2object->videodev), GST_ERROR_SYSTEM); return FALSE; }