Commit Graph

231 Commits

Author SHA1 Message Date
Clément Bœsch 5cae43e718 avdevice/v4l2: use AV_OPT_TYPE_BOOL for use_libv4l2 option 2015-09-12 18:24:49 +02:00
Hendrik Leppkes 87c8812270 Merge commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8'
* commit '01bcc2d5c23fa757d163530abb396fd02f1be7c8':
  lavc: Drop deprecated destruct_packet related functions

Merged-by: Hendrik Leppkes <h.leppkes@gmail.com>
2015-09-05 16:50:09 +02:00
Vittorio Giovara 01bcc2d5c2 lavc: Drop deprecated destruct_packet related functions
Deprecated in 10/2012.
2015-08-28 16:01:16 +02:00
Carl Eugen Hoyos 4c4f14c717 lavd/v4l2: Use AVSTREAM_PARSE_FULL_ONCE when reading a h264 stream.
Reported, debugged and tested by trac user noah.
Fixes ticket #4644.
2015-08-04 14:59:26 +02:00
Michael Niedermayer 495eee0123 Merge commit '40cf1bbacc6220a0aa6bed5c331871d43f9ce370'
* commit '40cf1bbacc6220a0aa6bed5c331871d43f9ce370':
  Deprecate avctx.coded_frame

Conflicts:
	ffmpeg.c
	libavcodec/a64multienc.c
	libavcodec/asvenc.c
	libavcodec/cljrenc.c
	libavcodec/dpxenc.c
	libavcodec/gif.c
	libavcodec/mpegvideo_enc.c
	libavcodec/nvenc.c
	libavcodec/proresenc_kostya.c
	libavcodec/pthread_frame.c
	libavcodec/rawenc.c
	libavcodec/sunrastenc.c
	libavcodec/tiffenc.c
	libavcodec/version.h
	libavcodec/xbmenc.c
	libavcodec/xwdenc.c
	libavdevice/v4l2.c

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-21 01:17:15 +02:00
Vittorio Giovara 40cf1bbacc Deprecate avctx.coded_frame
The rationale is that coded_frame was only used to communicate key_frame,
pict_type and quality to the caller, as well as a few other random fields,
in a non predictable, let alone consistent way.

There was agreement that there was no use case for coded_frame, as it is
a full-sized AVFrame container used for just 2-3 int-sized properties,
which shouldn't even belong into the AVCodecContext in the first place.

The appropriate AVPacket flag can be used instead of key_frame, while
quality is exported with the new AVPacketSideData quality factor.
There is no replacement for the other fields as they were unreliable,
mishandled or just not used at all.

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2015-07-20 15:06:50 +01:00
Michael Niedermayer f8598cefe9 avdevice/v4l2: Fix vertical alignment in list_formats() output
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-16 14:35:36 +02:00
Michael Niedermayer d1d8ee5e91 avdevice/v4l2: Try to fix build on netbsd/openbsd
Found-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-09 00:27:00 +02:00
Giorgio Vazzana 28f20d2ff4 lavd/v4l2: produce a 0 byte packet when a dequeued buffer is flagged with V4L2_BUF_FLAG_ERROR
Fixes ticket #4030.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-08 22:31:09 +02:00
Giorgio Vazzana 23e6cf832f lavd/v4l2: fix typo
This was introduced in cde6e328de

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-08 18:02:28 +02:00
Giorgio Vazzana 00a452a9ad lavd/v4l2: print buffer flags in case of error
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-24 13:25:40 +02:00
Andreas Cadhalpun 482c86f231 fix spelling errors
opttimizations -> optimizations
 grabing        -> grabbing
 many resource  -> many resources
 isnt           -> isn't
 silcense       -> silence

Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-06 21:35:00 +01:00
Michael Niedermayer cde6e328de Merge commit '619d5e7db88941cadb8136f805564e885c6c6434'
* commit '619d5e7db88941cadb8136f805564e885c6c6434':
  v4l2: Use the codec descriptor facility

Conflicts:
	libavdevice/v4l2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-02 20:16:22 +01:00
Luca Barbato 9a26ba9713 v4l2: Add support for h264 2015-03-02 12:07:59 +01:00
Luca Barbato 619d5e7db8 v4l2: Use the codec descriptor facility
The encoder or decoder might be disabled but the format would be
supported for at least remuxing.
2015-03-02 11:27:57 +01:00
Lukasz Marek ea0ac11f1b lavd/v4l2: implement list device callback
Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
2015-01-11 18:58:33 +01:00
Michael Niedermayer eb725235b0 avdevice/v4l2: use av_freep() to avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-12 14:46:46 +01:00
Martin Storsjö b776113e5d v4l2: Unify one instance of reading/storing errno
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-11-11 10:07:20 +02:00
Michael Niedermayer 715ccc2bc4 Merge commit '09f25533a564eab743f258d168697a11122914c4'
* commit '09f25533a564eab743f258d168697a11122914c4':
  v4l2: Preserve errno values

Conflicts:
	libavdevice/v4l2.c

See: 60950adc18
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-10 01:37:08 +01:00
Michael Niedermayer d99653c9e4 Merge commit 'a1a259881fa7b23e2ffc0c2a43d4923fe42d0478'
* commit 'a1a259881fa7b23e2ffc0c2a43d4923fe42d0478':
  v4l2: Use av_strerror

Conflicts:
	libavdevice/v4l2.c

See: 60950adc18
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-10 01:19:24 +01:00
Luca Barbato 09f25533a5 v4l2: Preserve errno values
av_log usually resets it.
2014-11-09 12:59:32 +01:00
Tristan Matthews a1a259881f v4l2: Use av_strerror
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-11-09 12:29:59 +01:00
Michael Niedermayer 6f21fb7932 Revert "v4l2: setting device parameters early"
This reverts commit b1ad931233.

Fixes Ticket #3517

Conflicts:

	libavdevice/v4l2.c

Requested-by: Giorgio Vazzana <mywing81@gmail.com>
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-08 12:43:50 +01:00
Giorgio Vazzana be0356ca05 lavd/v4l2: use pixel format variable names consistently
We now use 'pixelformat' for V4L2_PIX_FMT_* (as they do in v4l2
documentation) and 'pix_fmt' for AVPixelFormat.

No functional change in the code.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-06 15:39:41 +01:00
James Almer 931da6a5e9 lavd/v4l2: don't use avpriv_ prefix for internal functions
No need to keep the old symbols around until a major bump since lavd functions
with the avpriv_ prefix were never exposed.

Signed-off-by: James Almer <jamrial@gmail.com>
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Reviewed-by: Stefano Sabatini <stefasab@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-29 16:12:14 +01:00
Andrey Utkin b608fba672 Use v4l2 input format automatically if filename starts with "/dev/video"
Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2014-10-29 01:59:25 +01:00
Giorgio Vazzana d7e088849e lavd/v4l2: introduce enqueue_buffer()
Additionally, make sure a buffer gets enqueued again (even in error paths) after
it has been succesfully dequeued.

Tested-by: Dmitry Volyntsev <xeioexception@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-06 00:05:59 +02:00
Giorgio Vazzana 0b890425e3 lavd/v4l2: simplify list_formats()
We can avoid passing file descriptor fd explicitely.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 20:25:58 +02:00
Giorgio Vazzana 7865cafec2 lavd/v4l2: simplify list_framesizes()
We can avoid passing file descriptor fd explicitely.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 18:52:34 +02:00
Giorgio Vazzana 55cf7d9713 lavd/v4l2: remove unneeded variable in device_init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 18:43:28 +02:00
Giorgio Vazzana 3da359c140 lavd/v4l2: simplify first_field()
There is no need to pass fd as a second parameter. Additionally remove
unneeded curly braces.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 18:36:04 +02:00
Giorgio Vazzana 39750b7364 lavd/v4l2: Replace s1 with ctx for consistency.
No functional change in the code.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-05 18:10:42 +02:00
Dmitry Volyntsev fe8f4c71e3 libavdevice/v4l2: fix descriptors leak on error paths
Signed-off-by: Dmitry Volytnsev <xeioexception@gmail.com>
Reviewed-by: Benoit Fouet <benoit.fouet@free.fr>
Reviewed-by: Giorgio Vazzana <mywing81@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-04 13:52:44 +02:00
Michael Niedermayer c5f43c8888 avdevice/v4l2: try to fix build for openbsd
Found-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-18 14:03:03 +02:00
Andre Wolokita 44e95a017c lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns ENODATA
As of September 14 2012, v4l_enumstd() will return ENODATA
when a device's std field is set to 0. That is, the device
does not have a standard format. In order to properly
handle this case, v4l2_set_parameters should catch the
ENODATA code and break instead of failing.

Below is the v4l2-core commit describing this change.

>>commit a5338190efc7cfa8c99a6856342a77d21c9a05cf
>>Author: Hans Verkuil <hans.verkuil@cisco.com>
>>Date:   Fri Sep 14 06:45:43 2012 -0300
>>
>>    [media] v4l2-core: tvnorms may be 0 for a given input, handle that case
>>
>>    Currently the core code looks at tvnorms to see whether ENUMSTD
>>    or G_PARM should be enabled. This is not a good check for drivers
>>    that support the STD API on one input and the DV Timings API on another.
>>    In that case tvnorms may be 0.
>>    Instead check whether s_std is present (for ENUMSTD) or whether g_std or
>>    current_norm is present for g_parm.
>>    Also, in the enumstd core function return ENODATA if tvnorms is 0,
>>    because in that case the current input does not support the STD API
>>    and ENUMSTD should return ENODATA for that.
>>
>>    Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
>>    Reviewed-by: Sakari Ailus <sakari.ailus@iki.fi>
>>    Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2014-08-18 09:20:00 +02:00
Michael Niedermayer fb33bff990 Merge commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39'
* commit 'f929ab0569ff31ed5a59b0b0adb7ce09df3fca39':
  cosmetics: Write NULL pointer equality checks more compactly

Conflicts:
	cmdutils.c
	ffmpeg_opt.c
	ffplay.c
	libavcodec/dvbsub.c
	libavcodec/dvdsubdec.c
	libavcodec/dvdsubenc.c
	libavcodec/dxa.c
	libavcodec/libxvid_rc.c
	libavcodec/mpegvideo.c
	libavcodec/mpegvideo_enc.c
	libavcodec/rv10.c
	libavcodec/tiffenc.c
	libavcodec/utils.c
	libavcodec/vc1dec.c
	libavcodec/zmbv.c
	libavdevice/v4l2.c
	libavformat/matroskadec.c
	libavformat/movenc.c
	libavformat/sdp.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:00:50 +02:00
Gabriel Dume f929ab0569 cosmetics: Write NULL pointer equality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 03:18:18 -07:00
Michael Niedermayer 124c94a1c8 avdevice/v4l2: Use av_malloc_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-22 15:08:12 +02:00
Olivier Langlois 0a15067047 lavd: Use av_gettime_relative()
Whenever av_gettime() is used to measure relative period of time,
av_gettime_relative() is prefered as it guarantee monotonic time
on supported platforms.

Since v4l2 is compiled only on Linux where av_gettime_relative()
is monotonic, a small wrapper function av_gettime_monotonic() is used
(should be inlined the compiler) to put emphasis on that fact.

Signed-off-by: Olivier Langlois <olivier@trillion01.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-18 16:10:12 +02:00
Michael Niedermayer 68c3e6025f Fix convertion typos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-04-29 00:09:08 +02:00
Lukasz Marek f607767d93 lavd: add categories to device implementations
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
2014-03-03 23:34:46 +01:00
Michael Niedermayer 0997c2504b avdevice/v4l2: only use average frame rate if set
It might be unset on some platforms with some drivers and some input

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-02 00:15:11 +01:00
Michael Niedermayer 4aa4533ee8 avdevice/v4l2: only use frame period from v4l2 if valid
There is evidence that some drivers do not set a valid value

See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718805
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-02 00:13:01 +01:00
Federico Simoncelli b1ad931233 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>
2014-01-05 14:02:06 +01:00
Derek Buitenhuis 6ef30976e0 timefilter: Handle memory allocation failure
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2013-10-27 19:14:23 +00:00
mrlika ed72542539 lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns EINVAL without a valid match
With some (buggy) drivers, the VIDIOC_G_STD ioctl returns a std_id that cannot
be matched with any of the enumerated v4l2_standard structures (for example
std_id = 0 or std_id = 0xffffff). Do not fail when we reach the end of the
enumeration without a valid match.

Fixes ticket #2370

Note: This commit message has been modified by Giorgio Vazzana, the original
commit message was:

"Fixed regression for mandatory VIDIOC_ENUMSTD support by v4l2"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-17 22:57:31 +02:00
Giorgio Vazzana 7f6ec05f09 lavd/v4l2: Improve debug message
In particular, print the standard supported by the selected input.
Additionally, use PRIx64 everywhere when printing standards.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-08 14:30:52 +02:00
Carl Eugen Hoyos e337c9d564 Read h264 headers from v4l2 to allow stream-copying.
Fixes ticket #2882.
Analyzed and tested by William C Bonner.
2013-09-01 21:27:43 +02:00
Rémi Denis-Courmont 71bf6b41d9 libavdevice: use avpriv_open()
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-08-07 21:16:05 +02:00
Michael Niedermayer 20be5e0a0e Merge commit '7950e519bb094897f957b9a9531cc60ba46cbc91'
* commit '7950e519bb094897f957b9a9531cc60ba46cbc91':
  Disable deprecation warnings for cases where a replacement is available

Conflicts:
	libavcodec/avpacket.c
	libavcodec/pthread.c
	libavcodec/utils.c
	libavdevice/v4l2.c
	libavfilter/avfiltergraph.c
	libavfilter/buffersrc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-08-03 10:08:30 +02:00