From 47816e1155227e55dcb18bddcbd0c05b2a33720e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 15 Jul 2011 12:00:54 +0200 Subject: [PATCH] v4l2: fix error messages --- sys/v4l2/gstv4l2bufferpool.c | 33 ++++++++++++++------------------- sys/v4l2/gstv4l2object.c | 11 ++++++++++- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c index bb2ef99..1d7d4c8 100644 --- a/sys/v4l2/gstv4l2bufferpool.c +++ b/sys/v4l2/gstv4l2bufferpool.c @@ -276,23 +276,20 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool) /* ERRORS */ reqbufs_failed: { - GST_ELEMENT_ERROR (pool, RESOURCE, READ, - (_("Could not get buffers from device '%s'."), - obj->videodev), - ("error requesting %d buffers: %s", num_buffers, g_strerror (errno))); + GST_ERROR_OBJECT (pool, + "error requesting %d buffers: %s", num_buffers, g_strerror (errno)); return FALSE; } no_buffers: { - GST_ELEMENT_ERROR (pool, RESOURCE, READ, - (_("Could not get enough buffers from device '%s'."), - obj->videodev), - ("we received %d from device '%s', we want at least %d", - breq.count, obj->videodev, GST_V4L2_MIN_BUFFERS)); + GST_ERROR_OBJECT (pool, + "we received %d from device '%s', we want at least %d", + breq.count, obj->videodev, GST_V4L2_MIN_BUFFERS); return FALSE; } buffer_new_failed: { + GST_ERROR_OBJECT (pool, "failed to create a buffer"); return FALSE; } } @@ -381,14 +378,14 @@ error: " no buffer was in the outgoing queue. device %s", obj->videodev); break; case EINVAL: - GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, - (_("Failed trying to get video frames from device '%s'."), - obj->videodev), - (_("The buffer type is not supported, or the index is out of bounds," " or no buffers have been allocated yet, or the userptr" " or length are invalid. device %s"), obj->videodev)); + GST_ERROR_OBJECT (pool, + "The buffer type is not supported, or the index is out of bounds, " + "or no buffers have been allocated yet, or the userptr " + "or length are invalid. device %s", obj->videodev); break; case ENOMEM: - GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, - (_("Failed trying to get video frames from device '%s'. Not enough memory."), obj->videodev), (_("insufficient memory to enqueue a user pointer buffer. device %s."), obj->videodev)); + GST_ERROR_OBJECT (pool, + "insufficient memory to enqueue a user pointer buffer"); break; case EIO: GST_INFO_OBJECT (pool, @@ -417,10 +414,8 @@ error: } no_buffers: { - GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, - (_("Failed trying to get video frames from device '%s'."), - obj->videodev), - (_("No free buffers found in the pool at index %d."), vbuffer.index)); + GST_ERROR_OBJECT (pool, "No free buffers found in the pool at index %d.", + vbuffer.index); return GST_FLOW_ERROR; } } diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 215c447..68cf2aa 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2070,7 +2070,8 @@ gst_v4l2_object_setup_pool (GstV4l2Object * v4l2object) 0, 0); gst_buffer_pool_set_config (v4l2object->pool, config); - gst_buffer_pool_set_active (v4l2object->pool, TRUE); + if (!gst_buffer_pool_set_active (v4l2object->pool, TRUE)) + goto activate_failed; } else if (v4l2object->vcap.capabilities & V4L2_CAP_READWRITE) { GST_INFO_OBJECT (v4l2object->element, "capturing buffers via read()"); @@ -2100,6 +2101,14 @@ no_supported_capture_method: "method."), v4l2object->videodev), (NULL)); return FALSE; } +activate_failed: + { + GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, READ, + (_("Could not map buffers from device '%s'"), + v4l2object->videodev), + ("Failed to activate buffer pool: %s", g_strerror (errno))); + return FALSE; + } } -- 2.7.4