Commit Graph

1466 Commits

Author SHA1 Message Date
Moritz Barsnick 2250dc4044 avdevice/xcbgrab: check return values of xcb query functions
Fixes #7312, segmentation fault on close of X11 server

xcb_query_pointer_reply() and xcb_get_geometry_reply() can return NULL
if e.g. the X server closes or the connection is lost. This needs to
be checked in order to cleanly exit, because the returned pointers are
dereferenced later.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
2020-08-15 15:32:52 -04:00
Mark Thompson 6e951d0cf8 kmsgrab: Add more supported formats
X2RGB10 tested on both Intel Gen9 and AMD Polaris 11.  NV12 tested on
Intel Gen9 only - since it has multiple planes, this requires GetFB2.

Also add some comments to split the list up a bit.
2020-08-09 20:18:49 +01:00
Mark Thompson ff14858a60 kmsgrab: Don't require the user to set framebuffer format
This is provided by GetFB2, but we still need the option for cases where
that isn't available.
2020-08-09 20:18:49 +01:00
Mark Thompson ef934dba2d kmsgrab: Use GetFB2 if available
The most useful feature here is the ability to automatically extract the
framebuffer format and modifiers.  It also makes support for multi-plane
framebuffers possible, though none are added to the format table in this
patch.

This requires libdrm 2.4.101 (from April 2020) to build, so it includes a
configure check to allow compatibility with existing distributions.  Even
with libdrm support, it still won't do anything at runtime if you are
running Linux < 5.7 (before June 2020).
2020-08-09 20:18:48 +01:00
Mark Thompson fa0b064cf2 kmsgrab: Refactor and clean error cases 2020-08-09 20:18:48 +01:00
Limin Wang a54b367c78 avdevice/decklink_dec: export timecode with s12m side data
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-07-15 05:47:14 +08:00
Milos Zivkovic c4e0868243 avdevice/decklink_dec: add support for extracting and outputing klv from vanc
Signed-off-by: Milos Zivkovic <zivkovic@teralogics.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-07-03 00:24:59 +02:00
Thilo Borgmann b737575c76 lavdevice: Add AudioToolbox output device. 2020-06-15 15:09:33 +02:00
Michael Niedermayer c5079bf3bc Bump minor versions after branching 4.3
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-08 22:49:04 +02:00
Michael Niedermayer 0a8a96c251 Bump minor versions to separate 4.3 from master
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2020-06-08 22:49:04 +02:00
David Manouchehri d0705ecb2b avdevice/v4l2enc: Allow writing non-rawvideos to v4l2.
Signed-off-by: David Manouchehri <david.manouchehri@riseup.net>
2020-05-09 15:44:43 +01:00
Martin Storsjö c810a9502c avfoundation: Fix building on iOS
Apparently the changes from 3c9185bf3a
aren't enough; even with that in place, I got errors like this
when trying to build for iOS:

src/libavdevice/avfoundation.m:135:5: error:
      'AVCaptureDeviceTransportControlsPlaybackMode' is unavailable: not
      available on iOS
    AVCaptureDeviceTransportControlsPlaybackMode observed_mode;
    ^
2020-04-30 14:21:47 +02:00
Thilo Borgmann 64b80cb04b lavd/avfoundation.m: Do not use transport controls for screen capture devices. 2020-04-22 16:52:36 +02:00
Thilo Borgmann 3c9185bf3a lavd/avfoundation.m: Remove transport controls for iOS. 2020-04-22 16:52:36 +02:00
Marton Balint 2a118a71cf avdevice/opengl: add support of wrapped avframe codec
Also change the default to that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-16 23:52:12 +02:00
Marton Balint e4ce40d25b avdevice/xv: add support of wrapped avframe codec
Also change the default to that.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-16 23:52:12 +02:00
Marton Balint f04fe8aa4e avdevice/decklink_dec: increase autodetect timeout to 3 sec
1 sec might not be enough for the cards to detect the format...

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-04-04 22:28:05 +02:00
Paul B Mahol d64cbd4fda remove CHAR_MIN/CHAR_MAX usage
It is not needed at all.
2020-03-17 22:46:36 +01:00
Thilo Borgmann 39fbd06314 lavd/avfoundation: Add basic transport control observation for capable devices. 2020-03-16 10:26:03 +01:00
Marton Balint f32f9231dd avdevice/decklink: add support for SDK version 11.5
Fixes ticket #8534.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-26 21:32:56 +01:00
Marton Balint 95324ecf23 avdevice/decklink_dec: fix stopping streams in read_close
The capture_started variable was never set, it is simpler to call the stop
functions unconditionally if the interface is available.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-02-26 21:32:56 +01:00
Nicolas George 26ae9c9f8a lavd/opengl_enc: check strings before parsing them.
Fix a segfault if OpenGL was not initialized before calling
write_header().
2020-02-20 14:37:11 +01:00
Nicolas George fbb36d74ac lavd/opengl_enc: use proper context for logging.
Log as [opengl @ 0xaddress] instead of [opengl outdev @ 0xaddress].
2020-02-20 14:27:11 +01:00
Thilo Borgmann 2ca14d84ee lavd/avfoundation.m: Add an option to drop late frames.
Retains current behaviour by the default value.
2020-02-07 11:09:20 +01:00
Marton Balint e931119a41 avdevice/xcbgrab: check if frame size fits in INT_MAX
Also fixes a possible overflow and sets stream bitrate.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-24 01:17:14 +01:00
Marton Balint b7e94adb4e avdevice/xcbgrab: move some initialization code from pixfmt_from_pixmap_format to create_stream
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-24 01:17:14 +01:00
Carl Eugen Hoyos 96fab29e96 Silence "string-plus-int" warning shown by clang.
libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
2020-01-06 22:38:56 +01:00
Marton Balint 944203270d avdevice/decklink: deprecate the -list_devices option
The user should use ffmpeg -sources decklink or ffmpeg -sinks decklink instead.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint 2b7097ef27 avdevice/decklink_dec: remove -bm_v210 option
Deprecated since Sep 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint 78a233e6e9 avdevice/decklink_dec: remove the @mode syntax
Deprecated since March 28, 2017.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-01-03 18:13:22 +01:00
Marton Balint f1353ce222 avdevice/xcbgrab: capture the full desktop if video_size is not specified
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-30 23:32:27 +01:00
Marton Balint f6845269c6 avdevice/xcbgrab: fix packet timestamps
Since 648b8cca6c and
c991e9cd91 timestamps were not set properly.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-30 21:09:24 +01:00
Marton Balint c991e9cd91 avdevice/xcbgrab: use a buffer pool for shared memory segments
Also by wrapping the SHM buffer in an AVBufferRef we eliminate yet another
possible memcpy improving performance.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-26 00:47:24 +01:00
Marton Balint 648b8cca6c avdevice/xcbgrab: wrap non-shm image replies in a buffer ref
This avoids a memcpy improving performance if SHM is not used.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-06 10:09:49 +01:00
Kusanagi Kouichi 12bbfc4cca avdevice/xcbgrab: Handle reply and error properly
Fix a NULL dereference and leaks.

Signed-off-by: Kusanagi Kouichi <slash@ac.auone-net.jp>
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-12-03 21:13:00 +01:00
Zhao Zhili 19956d01cc libavdevice/lavfi: check avfilter_graph_dump return value
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-29 19:58:35 +01:00
Gyan Doshi d831edc387 avdevice/decklink: add option to drop frames till timecode is seen
Option wait_for_tc only takes effect if tc_format is set
2019-11-18 10:01:03 +05:30
Andriy Gelman 7b2ce27e56 avdevice/v4l2: Remove av_assert0 when format not supported
Before this commit an av_assert0 would fail if a v4l2 device did not
support a target format.
For example,
./ffmpeg -f v4l2 -codec:v h264 -i /dev/video0 -f mpegts -
would signal an abort if /dev/video0 did not support h264.

The new behaviour is to return an AVERROR(EINVAL) error code. An
av_assert0 has been added to verify this return.

Fixes #6629

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-11-06 20:38:03 +01:00
Jun Zhao 3aeb681f07 libavdevice: Update the class name as uniform style
Update the class name to uniform indev/outdev style.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-08-15 09:29:55 +08:00
Stephan Hilb b761ae072a lavd/v4l2: produce a 0 byte packet when a dequeued buffer's size is unexpected
Behave like we do for V4L2_BUF_FLAG_ERROR, implemented in commit 28f20d2ff4 .

For some devices (probably also related to the V4L driver implementation)
it happens that when invoking the ioctl DQBUF, the returned buffer is not
of the expected size. Here are two examples for such occurrences:

    [video4linux2,v4l2 @ 0x258b440] Dequeued v4l2 buffer contains 609596 bytes, but 614400 were expected. Flags: 0x00000001.
    /dev/video1: Invalid data found when processing input

    [video4linux2,v4l2 @ 0x225f440] Dequeued v4l2 buffer contains 609508 bytes, but 614400 were expected. Flags: 0x00000001.
    /dev/video1: Invalid data found when processing input

For the ffmpeg CLI tool this means it will stop capturing and exit.

The described behaviour was observed at least with one OmniVision USB
web cam and with some stk1160 devices.

If you search the web for the error message, you will find quite a few
instances of this problem. Some of them experienced on other devices.

Probably fixes ticket #4795

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
2019-07-30 12:05:52 +02:00
Michael Niedermayer 80bb65fafa Bump minor versions again on master to keep 4.2 versions separate from master
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-21 18:36:31 +02:00
Michael Niedermayer 22db337a40 Bump minor versions to separate 4.2 from master
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2019-07-21 18:36:18 +02:00
Thilo Borgmann 70a4f46e48 lavd/avfoundation: Set correct default value 0 for option capture_raw_data. 2019-07-08 20:02:41 +02:00
Thilo Borgmann 5c2e0e417a lavd/avfoundation: Reindent after last commit. 2019-07-08 20:02:41 +02:00
Thilo Borgmann 02f65678ba lavd/avfoundation: Support muxed type of devices including raw muxed data capture. 2019-07-08 20:02:41 +02:00
Thilo Borgmann 3a5f9ab814 lavd/avfoundation: Refine some log messages. 2019-07-08 20:02:41 +02:00
Thilo Borgmann 7d4df4b339 lavd/avfoundation: Change binary Options to boolean type. 2019-07-08 20:02:41 +02:00
Thilo Borgmann 48cf952411 lavd/avfoundation: Remove useless index increment. 2019-07-08 20:02:41 +02:00
Jun Zhao 206f72d0f2 libavdevice/gdigrab: fix ffmpeg -devices doesn't show gdigrab
missed the category AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT lead to
ffmpeg -devices doesn't show gdigrab as a input device

FIx #7848

Found-by: dangibson
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2019-05-17 21:51:20 +08:00
Marton Balint 15b8f36be1 avdevice/decklink: fix checking video mode in SDK version 11
Apparently in the new SDK one cannot query if VANC output is supported, so we
will fall back to non-VANC output if enabling the video output with VANC fails.

Fixes ticket #7867.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-05-05 20:07:35 +02:00