v4l2: remove pointless empty lines

pull/2/head
Stefano Sabatini 14 years ago
parent af344a69f3
commit 72c60f3ecd
  1. 14
      libavdevice/v4l2.c

@ -117,7 +117,6 @@ static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
if (fd < 0) { if (fd < 0) {
av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n", av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n",
ctx->filename, strerror(errno)); ctx->filename, strerror(errno));
return AVERROR(errno); return AVERROR(errno);
} }
@ -133,13 +132,11 @@ static int device_open(AVFormatContext *ctx, uint32_t *capabilities)
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n",
strerror(errno)); strerror(errno));
close(fd); close(fd);
return AVERROR(err); return AVERROR(err);
} }
if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) { if ((cap.capabilities & V4L2_CAP_VIDEO_CAPTURE) == 0) {
av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n"); av_log(ctx, AV_LOG_ERROR, "Not a video capture device\n");
close(fd); close(fd);
return AVERROR(ENODEV); return AVERROR(ENODEV);
} }
*capabilities = cap.capabilities; *capabilities = cap.capabilities;
@ -251,27 +248,23 @@ static int mmap_init(AVFormatContext *ctx)
} else { } else {
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_REQBUFS)\n"); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_REQBUFS)\n");
} }
return AVERROR(errno); return AVERROR(errno);
} }
if (req.count < 2) { if (req.count < 2) {
av_log(ctx, AV_LOG_ERROR, "Insufficient buffer memory\n"); av_log(ctx, AV_LOG_ERROR, "Insufficient buffer memory\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
s->buffers = req.count; s->buffers = req.count;
s->buf_start = av_malloc(sizeof(void *) * s->buffers); s->buf_start = av_malloc(sizeof(void *) * s->buffers);
if (s->buf_start == NULL) { if (s->buf_start == NULL) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n"); av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer pointers\n");
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
s->buf_len = av_malloc(sizeof(unsigned int) * s->buffers); s->buf_len = av_malloc(sizeof(unsigned int) * s->buffers);
if (s->buf_len == NULL) { if (s->buf_len == NULL) {
av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n"); av_log(ctx, AV_LOG_ERROR, "Cannot allocate buffer sizes\n");
av_free(s->buf_start); av_free(s->buf_start);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
@ -285,7 +278,6 @@ static int mmap_init(AVFormatContext *ctx)
res = ioctl(s->fd, VIDIOC_QUERYBUF, &buf); res = ioctl(s->fd, VIDIOC_QUERYBUF, &buf);
if (res < 0) { if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYBUF)\n"); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYBUF)\n");
return AVERROR(errno); return AVERROR(errno);
} }
@ -299,7 +291,6 @@ static int mmap_init(AVFormatContext *ctx)
PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, buf.m.offset); PROT_READ | PROT_WRITE, MAP_SHARED, s->fd, buf.m.offset);
if (s->buf_start[i] == MAP_FAILED) { if (s->buf_start[i] == MAP_FAILED) {
av_log(ctx, AV_LOG_ERROR, "mmap: %s\n", strerror(errno)); av_log(ctx, AV_LOG_ERROR, "mmap: %s\n", strerror(errno));
return AVERROR(errno); return AVERROR(errno);
} }
} }
@ -353,7 +344,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
if (res < 0) { if (res < 0) {
if (errno == EAGAIN) { if (errno == EAGAIN) {
pkt->size = 0; pkt->size = 0;
return AVERROR(EAGAIN); return AVERROR(EAGAIN);
} }
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_DQBUF): %s\n", strerror(errno)); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_DQBUF): %s\n", strerror(errno));
@ -363,7 +353,6 @@ static int mmap_read_frame(AVFormatContext *ctx, AVPacket *pkt)
assert (buf.index < s->buffers); assert (buf.index < s->buffers);
if (s->frame_size > 0 && buf.bytesused != s->frame_size) { if (s->frame_size > 0 && buf.bytesused != s->frame_size) {
av_log(ctx, AV_LOG_ERROR, "The v4l2 frame is %d bytes, but %d bytes are expected\n", buf.bytesused, s->frame_size); av_log(ctx, AV_LOG_ERROR, "The v4l2 frame is %d bytes, but %d bytes are expected\n", buf.bytesused, s->frame_size);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@ -411,7 +400,6 @@ static int mmap_start(AVFormatContext *ctx)
res = ioctl(s->fd, VIDIOC_QBUF, &buf); res = ioctl(s->fd, VIDIOC_QBUF, &buf);
if (res < 0) { if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno)); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QBUF): %s\n", strerror(errno));
return AVERROR(errno); return AVERROR(errno);
} }
} }
@ -420,7 +408,6 @@ static int mmap_start(AVFormatContext *ctx)
res = ioctl(s->fd, VIDIOC_STREAMON, &type); res = ioctl(s->fd, VIDIOC_STREAMON, &type);
if (res < 0) { if (res < 0) {
av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n", strerror(errno)); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_STREAMON): %s\n", strerror(errno));
return AVERROR(errno); return AVERROR(errno);
} }
@ -654,7 +641,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
} }
if (res < 0) { if (res < 0) {
close(s->fd); close(s->fd);
res = AVERROR(EIO); res = AVERROR(EIO);
goto out; goto out;
} }

Loading…
Cancel
Save