mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
Implement size autodetection if one of the width and height
AVFormatParameters for grab_read_header() is non-positive. Originally committed as revision 16199 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
parent
406c580854
commit
7bbacf9a0c
@ -78,10 +78,6 @@ static int grab_read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
int j;
|
int j;
|
||||||
int vformat_num = FF_ARRAY_ELEMS(video_formats);
|
int vformat_num = FF_ARRAY_ELEMS(video_formats);
|
||||||
|
|
||||||
if (ap->width <= 0 || ap->height <= 0) {
|
|
||||||
av_log(s1, AV_LOG_ERROR, "Wrong size (%dx%d)\n", ap->width, ap->height);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
if (ap->time_base.den <= 0) {
|
if (ap->time_base.den <= 0) {
|
||||||
av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
|
av_log(s1, AV_LOG_ERROR, "Wrong time base (%d)\n", ap->time_base.den);
|
||||||
return -1;
|
return -1;
|
||||||
@ -107,6 +103,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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user