diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-11-10 01:36:39 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-11-10 01:37:08 +0100 |
commit | 715ccc2bc47901e587939cf7b92667f343769b0a (patch) | |
tree | 5923ae33ca240bc4be21a6742551881c0e7b254b | |
parent | d99653c9e444323841030b41e66accd5b36945e7 (diff) | |
parent | 09f25533a564eab743f258d168697a11122914c4 (diff) | |
download | ffmpeg-715ccc2bc47901e587939cf7b92667f343769b0a.tar.gz |
Merge commit '09f25533a564eab743f258d168697a11122914c4'
* commit '09f25533a564eab743f258d168697a11122914c4':
v4l2: Preserve errno values
Conflicts:
libavdevice/v4l2.c
See: 60950adc18fe145a235211e75da68ab07123fcaa
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavdevice/v4l2.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 88454d43db..8695645452 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -108,7 +108,7 @@ static int device_open(AVFormatContext *ctx) struct video_data *s = ctx->priv_data; struct v4l2_capability cap; int fd; - int ret; + int err; int flags = O_RDWR; #define SET_WRAPPERS(prefix) do { \ @@ -146,16 +146,16 @@ static int device_open(AVFormatContext *ctx) fd = v4l2_open(ctx->filename, flags, 0); if (fd < 0) { - ret = AVERROR(errno); + err = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s: %s\n", - ctx->filename, av_err2str(ret)); - return ret; + ctx->filename, av_err2str(err)); + return err; } if (v4l2_ioctl(fd, VIDIOC_QUERYCAP, &cap) < 0) { - ret = AVERROR(errno); + err = AVERROR(errno); av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_QUERYCAP): %s\n", - av_err2str(ret)); + av_err2str(err)); goto fail; } @@ -164,14 +164,14 @@ static int device_open(AVFormatContext *ctx) if (!(cap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { av_log(ctx, AV_LOG_ERROR, "Not a video capture device.\n"); - ret = AVERROR(ENODEV); + err = AVERROR(ENODEV); goto fail; } if (!(cap.capabilities & V4L2_CAP_STREAMING)) { av_log(ctx, AV_LOG_ERROR, "The device does not support the streaming I/O method.\n"); - ret = AVERROR(ENOSYS); + err = AVERROR(ENOSYS); goto fail; } @@ -179,7 +179,7 @@ static int device_open(AVFormatContext *ctx) fail: v4l2_close(fd); - return ret; + return err; } static int device_init(AVFormatContext *ctx, int *width, int *height, @@ -909,7 +909,8 @@ static int v4l2_read_header(AVFormatContext *ctx) "Querying the device for the current frame size\n"); if (v4l2_ioctl(s->fd, VIDIOC_G_FMT, &fmt) < 0) { res = AVERROR(errno); - av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", av_err2str(res)); + av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_G_FMT): %s\n", + av_err2str(res)); goto fail; } |