diff options
author | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-12-26 10:12:57 +0000 |
---|---|---|
committer | Stefano Sabatini <stefano.sabatini-lala@poste.it> | 2008-12-26 10:12:57 +0000 |
commit | 7274a48035f9b97c2d8bae202ac6688dca81ff10 (patch) | |
tree | 8b61b38bca28d7d26f2b2b36c1c32ee502524841 /libavdevice | |
parent | f233d348212f5a634c91e45f93a7824a813ca050 (diff) | |
download | ffmpeg-7274a48035f9b97c2d8bae202ac6688dca81ff10.tar.gz |
Check that the device is a capture device immediately after opening
the device.
Originally committed as revision 16318 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavdevice')
-rw-r--r-- | libavdevice/v4l.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavdevice/v4l.c b/libavdevice/v4l.c index 2b0ce0c7c7..4a5328ade4 100644 --- a/libavdevice/v4l.c +++ b/libavdevice/v4l.c @@ -103,14 +103,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) goto fail; } - /* no values set, autodetect them */ - if (s->video_win.width <= 0 || s->video_win.height <= 0) { - if (ioctl(video_fd, VIDIOCGWIN, &s->video_win, sizeof(s->video_win)) < 0) { - av_log(s1, AV_LOG_ERROR, "VIDIOCGWIN: %s\n", strerror(errno)); - goto fail; - } - } - if (ioctl(video_fd, VIDIOCGCAP, &s->video_cap) < 0) { av_log(s1, AV_LOG_ERROR, "VIDIOCGCAP: %s\n", strerror(errno)); goto fail; @@ -121,6 +113,14 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap) goto fail; } + /* no values set, autodetect them */ + if (s->video_win.width <= 0 || s->video_win.height <= 0) { + if (ioctl(video_fd, VIDIOCGWIN, &s->video_win, sizeof(s->video_win)) < 0) { + av_log(s1, AV_LOG_ERROR, "VIDIOCGWIN: %s\n", strerror(errno)); + goto fail; + } + } + desired_palette = -1; desired_depth = -1; for (j = 0; j < vformat_num; j++) { |