1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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
This commit is contained in:
Stefano Sabatini 2008-12-26 10:12:57 +00:00
parent f233d34821
commit 7274a48035

View File

@ -103,14 +103,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto fail; 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) { if (ioctl(video_fd, VIDIOCGCAP, &s->video_cap) < 0) {
av_log(s1, AV_LOG_ERROR, "VIDIOCGCAP: %s\n", strerror(errno)); av_log(s1, AV_LOG_ERROR, "VIDIOCGCAP: %s\n", strerror(errno));
goto fail; goto fail;
@ -121,6 +113,14 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
goto fail; 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_palette = -1;
desired_depth = -1; desired_depth = -1;
for (j = 0; j < vformat_num; j++) { for (j = 0; j < vformat_num; j++) {