v4l2: fix error messages

This commit is contained in:
Wim Taymans 2011-07-15 12:00:54 +02:00
parent 549a4ddc8f
commit 47816e1155
2 changed files with 24 additions and 20 deletions

View File

@ -276,23 +276,20 @@ gst_v4l2_buffer_pool_start (GstBufferPool * bpool)
/* ERRORS */ /* ERRORS */
reqbufs_failed: reqbufs_failed:
{ {
GST_ELEMENT_ERROR (pool, RESOURCE, READ, GST_ERROR_OBJECT (pool,
(_("Could not get buffers from device '%s'."), "error requesting %d buffers: %s", num_buffers, g_strerror (errno));
obj->videodev),
("error requesting %d buffers: %s", num_buffers, g_strerror (errno)));
return FALSE; return FALSE;
} }
no_buffers: no_buffers:
{ {
GST_ELEMENT_ERROR (pool, RESOURCE, READ, GST_ERROR_OBJECT (pool,
(_("Could not get enough buffers from device '%s'."), "we received %d from device '%s', we want at least %d",
obj->videodev), breq.count, obj->videodev, GST_V4L2_MIN_BUFFERS);
("we received %d from device '%s', we want at least %d",
breq.count, obj->videodev, GST_V4L2_MIN_BUFFERS));
return FALSE; return FALSE;
} }
buffer_new_failed: buffer_new_failed:
{ {
GST_ERROR_OBJECT (pool, "failed to create a buffer");
return FALSE; return FALSE;
} }
} }
@ -381,14 +378,14 @@ error:
" no buffer was in the outgoing queue. device %s", obj->videodev); " no buffer was in the outgoing queue. device %s", obj->videodev);
break; break;
case EINVAL: case EINVAL:
GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, GST_ERROR_OBJECT (pool,
(_("Failed trying to get video frames from device '%s'."), "The buffer type is not supported, or the index is out of bounds, "
obj->videodev), "or no buffers have been allocated yet, or the userptr "
(_("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)); "or length are invalid. device %s", obj->videodev);
break; break;
case ENOMEM: case ENOMEM:
GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, GST_ERROR_OBJECT (pool,
(_("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)); "insufficient memory to enqueue a user pointer buffer");
break; break;
case EIO: case EIO:
GST_INFO_OBJECT (pool, GST_INFO_OBJECT (pool,
@ -417,10 +414,8 @@ error:
} }
no_buffers: no_buffers:
{ {
GST_ELEMENT_ERROR (pool, RESOURCE, FAILED, GST_ERROR_OBJECT (pool, "No free buffers found in the pool at index %d.",
(_("Failed trying to get video frames from device '%s'."), vbuffer.index);
obj->videodev),
(_("No free buffers found in the pool at index %d."), vbuffer.index));
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
} }
} }

View File

@ -2070,7 +2070,8 @@ gst_v4l2_object_setup_pool (GstV4l2Object * v4l2object)
0, 0); 0, 0);
gst_buffer_pool_set_config (v4l2object->pool, config); 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) { } else if (v4l2object->vcap.capabilities & V4L2_CAP_READWRITE) {
GST_INFO_OBJECT (v4l2object->element, "capturing buffers via read()"); GST_INFO_OBJECT (v4l2object->element, "capturing buffers via read()");
@ -2100,6 +2101,14 @@ no_supported_capture_method:
"method."), v4l2object->videodev), (NULL)); "method."), v4l2object->videodev), (NULL));
return FALSE; 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;
}
} }