[PATCH] 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> --- libavdevice/v4l2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index cb962b7..1ab6f1c 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -866,6 +866,9 @@ static int v4l2_read_header(AVFormatContext *s1) 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) { 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; - if ((res = v4l2_set_parameters(s1)) < 0) - return res; - st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id); s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height); -- 1.8.4.2
Any feedback? Thanks, -- Federico On Thu, Jan 2, 2014 at 4:25 PM, Federico Simoncelli <federico.simoncelli@gmail.com> wrote:
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> --- libavdevice/v4l2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index cb962b7..1ab6f1c 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -866,6 +866,9 @@ static int v4l2_read_header(AVFormatContext *s1)
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) { 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;
- if ((res = v4l2_set_parameters(s1)) < 0) - return res; - st->codec->pix_fmt = avpriv_fmt_v4l2ff(desired_format, codec_id); s->frame_size = avpicture_get_size(st->codec->pix_fmt, s->width, s->height); -- 1.8.4.2
On Sun, Jan 05, 2014 at 12:33:42PM +0100, Federico Simoncelli wrote:
Any feedback?
looks good, thus applied thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Observe your enemies, for they first find out your faults. -- Antisthenes
Hello, this was probably wrong and has caused https://trac.ffmpeg.org/ticket/3517 . Will investigate. Giorgio Vazzana 2014-01-05 17:17 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Sun, Jan 05, 2014 at 12:33:42PM +0100, Federico Simoncelli wrote:
Any feedback?
looks good, thus applied
thanks
[...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Wed, Oct 22, 2014 at 04:12:31PM +0200, Giorgio Vazzana wrote:
Hello,
this was probably wrong and has caused
i can revert it if you want ?
https://trac.ffmpeg.org/ticket/3517 . Will investigate.
Giorgio Vazzana
2014-01-05 17:17 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Sun, Jan 05, 2014 at 12:33:42PM +0100, Federico Simoncelli wrote:
Any feedback?
looks good, thus applied
thanks
[...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras
Hi, 2014-11-05 21:54 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Wed, Oct 22, 2014 at 04:12:31PM +0200, Giorgio Vazzana wrote:
Hello,
this was probably wrong and has caused
i can revert it if you want ?
I will sent a patch for testing on that ticket later and see if we get some feedback from the OP.
https://trac.ffmpeg.org/ticket/3517 . Will investigate.
Giorgio Vazzana
2014-01-05 17:17 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Sun, Jan 05, 2014 at 12:33:42PM +0100, Federico Simoncelli wrote:
Any feedback?
looks good, thus applied
thanks
[...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
2014-11-06 12:47 GMT+01:00 Giorgio Vazzana <mywing81@gmail.com>:
Hi,
2014-11-05 21:54 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Wed, Oct 22, 2014 at 04:12:31PM +0200, Giorgio Vazzana wrote:
Hello,
this was probably wrong and has caused
i can revert it if you want ?
I will sent a patch for testing on that ticket later and see if we get some feedback from the OP.
Reverting this commit fixes ticket #3517, so Michael I think it's safe to revert. Federico, I could not reproduce the error you reported in the commit message. If that problem is still present on git master (after reverting this commit) please let us know. Giorgio Vazzana
https://trac.ffmpeg.org/ticket/3517 . Will investigate.
Giorgio Vazzana
2014-01-05 17:17 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Sun, Jan 05, 2014 at 12:33:42PM +0100, Federico Simoncelli wrote:
Any feedback?
looks good, thus applied
thanks
[...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Observe your enemies, for they first find out your faults. -- Antisthenes
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
-- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Concerning the gods, I have no means of knowing whether they exist or not or of what sort they may be, because of the obscurity of the subject, and the brevity of human life -- Protagoras
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
On Sat, Nov 08, 2014 at 11:52:13AM +0100, Giorgio Vazzana wrote:
2014-11-06 12:47 GMT+01:00 Giorgio Vazzana <mywing81@gmail.com>:
Hi,
2014-11-05 21:54 GMT+01:00 Michael Niedermayer <michaelni@gmx.at>:
On Wed, Oct 22, 2014 at 04:12:31PM +0200, Giorgio Vazzana wrote:
Hello,
this was probably wrong and has caused
i can revert it if you want ?
I will sent a patch for testing on that ticket later and see if we get some feedback from the OP.
Reverting this commit fixes ticket #3517, so Michael I think it's safe to revert.
Federico, I could not reproduce the error you reported in the commit message. If that problem is still present on git master (after reverting this commit) please let us know.
reverted thanks [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The bravest are surely those who have the clearest vision of what is before them, glory and danger alike, and yet notwithstanding go out to meet it. -- Thucydides
participants (3)
-
Federico Simoncelli -
Giorgio Vazzana -
Michael Niedermayer