aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/v4l2.c
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2010-04-25 18:47:40 +0000
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2010-04-25 18:47:40 +0000
commit18225025ffac195974fe668d273f851f71cff002 (patch)
tree593314ff2763f2ce7bd4b2776d02e9c86d8a1752 /libavdevice/v4l2.c
parent4cf1ba0445a2b288f0ca47e36d780dec4d7d4e87 (diff)
downloadffmpeg-18225025ffac195974fe668d273f851f71cff002.tar.gz
Remove unnecessary width and height variables from v4l2_read_header().
Originally committed as revision 22963 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavdevice/v4l2.c')
-rw-r--r--libavdevice/v4l2.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index 9cc6806256..7b166ebd36 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -582,7 +582,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
{
struct video_data *s = s1->priv_data;
AVStream *st;
- int width, height;
int res;
uint32_t desired_format, capabilities;
enum CodecID codec_id;
@@ -592,9 +591,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return -1;
}
- width = ap->width;
- height = ap->height;
-
if(avcodec_check_dimensions(s1, ap->width, ap->height) < 0)
return -1;
@@ -604,8 +600,8 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
- s->width = width;
- s->height = height;
+ s->width = ap->width;
+ s->height = ap->height;
capabilities = 0;
s->fd = device_open(s1, &capabilities);
@@ -614,7 +610,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
}
av_log(s1, AV_LOG_INFO, "[%d]Capabilities: %x\n", s->fd, capabilities);
- desired_format = device_try_init(s1, ap, &width, &height, &codec_id);
+ desired_format = device_try_init(s1, ap, &s->width, &s->height, &codec_id);
if (desired_format == 0) {
av_log(s1, AV_LOG_ERROR, "Cannot find a proper format for "
"codec_id %d, pix_fmt %d.\n", s1->video_codec_id, ap->pix_fmt);
@@ -628,7 +624,7 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
return AVERROR(EIO);
st->codec->pix_fmt = fmt_v4l2ff(desired_format, codec_id);
- s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height);
+ s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
if (capabilities & V4L2_CAP_STREAMING) {
s->io_method = io_mmap;
res = mmap_init(s1);
@@ -648,8 +644,8 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap)
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
st->codec->codec_id = codec_id;
- st->codec->width = width;
- st->codec->height = height;
+ st->codec->width = s->width;
+ st->codec->height = s->height;
st->codec->time_base.den = ap->time_base.den;
st->codec->time_base.num = ap->time_base.num;
st->codec->bit_rate = s->frame_size * 1/av_q2d(st->codec->time_base) * 8;