Commit f1fa0918 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

v4l2: remove unneeded demux_sys_t.io

parent a1cd839e
......@@ -41,20 +41,11 @@
#include "v4l2.h"
/* TODO: remove this, use callbacks */
typedef enum {
IO_METHOD_READ=1,
IO_METHOD_MMAP,
} io_method;
struct demux_sys_t
{
int fd;
vlc_thread_t thread;
/* Video */
io_method io;
struct buffer_t *bufv;
union
{
......@@ -480,14 +471,12 @@ static int InitVideo (demux_t *demux, int fd)
msg_Err (demux, "cannot start streaming: %m");
return -1;
}
sys->io = IO_METHOD_MMAP;
entry = StreamThread;
}
else if (caps & V4L2_CAP_READWRITE)
{
sys->bufv = NULL;
sys->blocksize = fmt.fmt.pix.sizeimage;
sys->io = IO_METHOD_READ;
entry = ReadThread;
}
else
......@@ -511,30 +500,22 @@ void DemuxClose( vlc_object_t *obj )
vlc_join (sys->thread, NULL);
/* Stop video capture */
switch( sys->io )
{
case IO_METHOD_READ:
/* Nothing to do */
break;
case IO_METHOD_MMAP:
if (sys->bufv != NULL)
{
/* NOTE: Some buggy drivers hang if buffers are not unmapped before
* streamoff */
for (uint32_t i = 0; i < sys->bufc; i++)
{
struct v4l2_buffer buf = {
.type = V4L2_BUF_TYPE_VIDEO_CAPTURE,
.memory = V4L2_MEMORY_MMAP,
};
v4l2_ioctl (fd, VIDIOC_DQBUF, &buf);
v4l2_munmap (sys->bufv[i].start, sys->bufv[i].length);
}
enum v4l2_buf_type buf_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
v4l2_ioctl (fd, VIDIOC_STREAMOFF, &buf_type);
free (sys->bufv);
break;
}
}
ControlsDeinit( obj, sys->controls );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment