mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-17 22:06:41 +00:00
v4l2: remove unused code.
This commit is contained in:
parent
148ab7539b
commit
d154743949
1 changed files with 0 additions and 106 deletions
|
@ -2501,112 +2501,6 @@ done:
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static GstFlowReturn
|
||||
gst_v4l2_object_get_mmap (GstV4l2Object * v4l2object, GstBuffer ** buf)
|
||||
{
|
||||
GstFlowReturn res;
|
||||
#define NUM_TRIALS 50
|
||||
GstBufferPool *pool;
|
||||
gint32 trials = NUM_TRIALS;
|
||||
GstBuffer *pool_buffer;
|
||||
gboolean need_copy;
|
||||
|
||||
pool = v4l2object->pool;
|
||||
if (!pool)
|
||||
goto no_buffer_pool;
|
||||
|
||||
GST_DEBUG_OBJECT (v4l2object->element, "grab frame");
|
||||
|
||||
for (;;) {
|
||||
if ((res = gst_v4l2_object_poll (v4l2object)) != GST_FLOW_OK)
|
||||
goto poll_error;
|
||||
|
||||
res = gst_buffer_pool_acquire_buffer (pool, &pool_buffer, NULL);
|
||||
if (res != GST_FLOW_OK)
|
||||
goto no_buffer;
|
||||
|
||||
if (v4l2object->size > 0) {
|
||||
gsize size = gst_buffer_get_size (pool_buffer);
|
||||
|
||||
/* if size does not match what we expected, try again */
|
||||
if (size != v4l2object->size) {
|
||||
GST_ELEMENT_WARNING (v4l2object->element, RESOURCE, READ,
|
||||
(_("Got unexpected frame size of %u instead of %u."),
|
||||
size, v4l2object->size), (NULL));
|
||||
gst_buffer_unref (pool_buffer);
|
||||
goto no_buffer;
|
||||
}
|
||||
}
|
||||
/* when we get here all is fine */
|
||||
break;
|
||||
|
||||
no_buffer:
|
||||
GST_WARNING_OBJECT (v4l2object->element, "trials=%d", trials);
|
||||
|
||||
/* if the sync() got interrupted, we can retry */
|
||||
switch (errno) {
|
||||
case EINVAL:
|
||||
case ENOMEM:
|
||||
/* fatal */
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
case EAGAIN:
|
||||
case EIO:
|
||||
case EINTR:
|
||||
default:
|
||||
/* try again, until too many trials */
|
||||
break;
|
||||
}
|
||||
|
||||
/* check nr. of attempts to capture */
|
||||
if (--trials == -1) {
|
||||
goto too_many_trials;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* if we are handing out the last buffer in the pool, we need to make a
|
||||
* copy and bring the buffer back in the pool. */
|
||||
need_copy = v4l2object->always_copy
|
||||
|| !gst_v4l2_buffer_pool_available_buffers (pool);
|
||||
|
||||
if (G_UNLIKELY (need_copy)) {
|
||||
if (!v4l2object->always_copy) {
|
||||
GST_CAT_LOG_OBJECT (GST_CAT_PERFORMANCE, v4l2object->element,
|
||||
"running out of buffers, making a copy to reuse current one");
|
||||
}
|
||||
*buf = gst_buffer_copy (pool_buffer);
|
||||
/* this will requeue */
|
||||
gst_buffer_unref (pool_buffer);
|
||||
} else {
|
||||
*buf = pool_buffer;
|
||||
}
|
||||
|
||||
return GST_FLOW_OK;
|
||||
|
||||
/* ERRORS */
|
||||
no_buffer_pool:
|
||||
{
|
||||
GST_DEBUG_OBJECT (v4l2object->element, "no buffer pool");
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
poll_error:
|
||||
{
|
||||
return res;
|
||||
}
|
||||
too_many_trials:
|
||||
{
|
||||
GST_ELEMENT_ERROR (v4l2object->element, RESOURCE, FAILED,
|
||||
(_("Failed trying to get video frames from device '%s'."),
|
||||
v4l2object->videodev),
|
||||
(_("Failed after %d tries. device %s. system error: %s"),
|
||||
NUM_TRIALS, v4l2object->videodev, g_strerror (errno)));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
gst_v4l2_object_copy (GstV4l2Object * v4l2object, GstBuffer * dest,
|
||||
GstBuffer * src)
|
||||
|
|
Loading…
Reference in a new issue