mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
v4l2: setting device parameters early
Setting the v4l2 device parameters may influence video properties such as width, height and pixel format. This patch moves v4l2_set_parameters to be executed before fetching the video properties, avoiding errors such as (pal vs ntsc): The v4l2 frame is 829440 bytes, but 691200 bytes are expected Signed-off-by: Federico Simoncelli <fsimonce@redhat.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
05286b6a9c
commit
b1ad931233
@ -866,6 +866,9 @@ static int v4l2_read_header(AVFormatContext *s1)
|
|||||||
|
|
||||||
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
|
avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
|
||||||
|
|
||||||
|
if ((res = v4l2_set_parameters(s1)) < 0)
|
||||||
|
return res;
|
||||||
|
|
||||||
if (s->pixel_format) {
|
if (s->pixel_format) {
|
||||||
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
|
AVCodec *codec = avcodec_find_decoder_by_name(s->pixel_format);
|
||||||
|
|
||||||
@ -917,9 +920,6 @@ static int v4l2_read_header(AVFormatContext *s1)
|
|||||||
|
|
||||||
s->frame_format = desired_format;
|
s->frame_format = desired_format;
|
||||||
|
|
||||||
if ((res = v4l2_set_parameters(s1)) < 0)
|
|
||||||
return res;
|
|
||||||
|
|
||||||
st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id);
|
st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id);
|
||||||
s->frame_size =
|
s->frame_size =
|
||||||
avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
|
avpicture_get_size(st->codec->pix_fmt, s->width, s->height);
|
||||||
|
Loading…
Reference in New Issue
Block a user