summaryrefslogtreecommitdiff
path: root/libavdevice
diff options
context:
space:
mode:
authorGiorgio Vazzana <mywing81@gmail.com>2013-03-09 14:46:00 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-03-09 16:59:13 +0100
commit9222978aed8b186d61ef527ef4ca736aca7ac1dc (patch)
treebf3328b6ae18af098cd84a03354af2d75f9a9c28 /libavdevice
parent0286b425409702a111fe72bc0efe529a5bafc4ed (diff)
lavd/v4l2: simplify code
struct buff_data contains a pointer to struct video_data, so passing the file descriptor again is redundant. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavdevice')
-rw-r--r--libavdevice/v4l2.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index e12ca053fb..2a3f756cc4 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -125,7 +125,6 @@ struct video_data {
struct buff_data {
struct video_data *s;
int index;
- int fd;
};
struct fmt_map {
@@ -483,17 +482,16 @@ static void dummy_release_buffer(AVPacket *pkt)
static void mmap_release_buffer(void *opaque, uint8_t *data)
{
struct v4l2_buffer buf = { 0 };
- int res, fd;
+ int res;
struct buff_data *buf_descriptor = opaque;
struct video_data *s = buf_descriptor->s;
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = V4L2_MEMORY_MMAP;
buf.index = buf_descriptor->index;
- fd = buf_descriptor->fd;
av_free(buf_descriptor);
- if (v4l2_ioctl(fd, VIDIOC_QBUF, &buf) < 0) {
+ if (v4l2_ioctl(s->fd, VIDIOC_QBUF, &buf) < 0) {
res = AVERROR(errno);
av_log(NULL, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n",
av_err2str(res));
@@ -643,7 +641,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
return AVERROR(ENOMEM);
}
- buf_descriptor->fd = s->fd;
buf_descriptor->index = buf.index;
buf_descriptor->s = s;