Commit Graph

1501 Commits

Author SHA1 Message Date
Andreas Rheinhardt 0e645b98c6 Remove double ';'
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-01 06:10:44 +01:00
Marton Balint 2d32aed85c avdevice: use av_gettime_relative() for elapsed time calculations
av_gettime_relative() is using the monotonic clock therefore more suitable for
elapsed time calculations. Packet timestamps are still kept absolute, although
that should be configurable in the future.

Related to ticket #9089.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:41:50 +01:00
Marton Balint 529bf5daf2 avdevice/timefilter: remove obsolete comments from the docs
Also rename the parameters of the function to match with the implementation.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-02-27 21:30:41 +01:00
Andreas Rheinhardt 4f49ca7bbc avdevice/avdevice: Deprecate AVDevice Capabilities API
It has been added in 6db42a2b6b,
yet since then none of the necessary create/free_device_capabilities
functions has been implemented, making this API completely useless.

Because of this one can already simplify
avdevice_capabilities_free/create and can already remove the function
pointers at the next major bump; given that the documentation explicitly
states that av_device_capabilities is not to be used by a user, it's
options can already be removed (save for the sentinel).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-02-14 21:07:57 +01:00
Andriy Gelman 8e0a4d2d4d avdevice/xcbgrab: don't assume xserver endianness
xserver defines the endianness of the grabbed images. Use this information
to set the correct pixel format.

This also fixes format selection in configuration depth=32/bpp=32 with
xserver on a little endian machine. Before the patch, the big endian
layout 0RGB was always selected which is incorrect because BGR0 should
be used. RGB24 was also incorrectly assumed (but this format was removed
in xserver 1.20).

The big-endian settings can be tested using docker+qemu from a little-endian
machine:

$ docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
$ docker run --rm -it -v /tmp:/tmp powerpc64/debian /bin/bash

In docker container
$ apt-get update
$ apt-get install xvfb
$ apt-get install x11-apps

To test AV_PIX_FMT_0RGB32
$ Xvfb :2 -screen 0 720x480x24 &
$ export DISPLAY=:2
$ xclock -geometry 720x480 -bg green #test different colors

On your host machine grab the frames using the following
command. View output to check that colors are rendered correctly
$ ./ffmpeg -y -f x11grab -i :2.0 -codec:v mpeg2video out.mp4

Other pixel formats can be tested by modifying how Xvfb is started in the docker
container:

AV_PIX_FMT_RGB565
$ Xvfb :2 -screen 0 720x480x16

AV_PIX_FMT_RGB555
$ Xvfb :2 -screen 0 720x480x15

AV_PIX_FMT_BGR24 / AV_PIX_FMT_RGB24
This is difficult to test because bpp=24 support was removed in xserver 1.20
https://lists.x.org/archives/xorg-devel/2018-February/056175.html?hmsr=joyk.com&utm_source=joyk.com&utm_medium=referral
However, I was able to run previous version of Xvfb (with some
modifications to force 24bpp) to check that images are rendered correctly.

Reviewed-by: Carl Eugen Hoyos <ceffmpeg@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-02-06 11:42:12 -05:00
James Almer 911ba8417e avdevice/dshow: Add namespace prefix to the remaining global symbols
Signed-off-by: James Almer <jamrial@gmail.com>
2021-01-25 19:31:11 -03:00
Mark Thompson c154aada45 lavd/dshow: Add namespace prefix to global functions 2021-01-21 20:02:23 -03:00
Bas Nieuwenhuizen 4386060164 kmsgrab: Do not require the modifier to stay constant.
As we get a new set of objects each frame anyway, we
do not gain anything by keeping the modifier constant.

This helps with capturing when switching your setup a
bit, e.g. from ingame to desktop or from X11 to wayland.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:08:02 +00:00
Bas Nieuwenhuizen 03f4b203ba kmsgrab: Use invalid modifier if modifiers weren't used.
The kernel defaults to initializing the field to 0 when modifiers
are not used and this happens to be linear. If we end up actually
passing the modifier to a driver, tiling issues happen.

So if the kernel doesn't return a modifier set it explicitly to
INVALID. That way later processing knows there is no explicit
modifier.

Signed-off-by: Mark Thompson <sw@jkqxz.net>
2021-01-13 23:07:36 +00:00
Christopher Degawa eacad3406e avdevice/decklink_dec: mark get_frame_timecode and get_bmd_timecode static
The function is not used anywhere else and is causing mingw-w64 clang
builds to fail with

ffmpeg-git/libavdevice/decklink_dec.cpp:792:5: error: no previous prototype for function 'get_bmd_timecode' [-Werror,-Wmissing-prototypes]
int get_bmd_timecode(AVFormatContext *avctx, AVTimecode *tc, AVRational frame_rate, BMDTimecodeFormat tc_format, IDeckLinkVideoInputFrame *videoFrame)

Signed-off-by: Christopher Degawa <ccom@randomderp.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-01-09 17:37:02 +01:00
Carl Eugen Hoyos b0a882cc93 lavd/decklink_dec: Do not set codec_tags.
Only set the pix_fmt for rawvideo.

Fixes ticket #9005.

Reviewed-by: Marton Balint
2020-12-24 12:07:05 +01:00
Anton Khirnov fcf7ef0a81 lavd/caca: do not access deprecated codec context
Use the stream timebase instead.
2020-12-10 09:45:19 +01:00
Limin Wang e6ae498234 avdevice/decklink: remove the duplicated warning message
./ffmpeg -list_devices true -f decklink -i dummy
[Blackmagic DeckLink indev @ 0x2f96d00] The "list_devices" option is deprecated: list available devices
[decklink @ 0x2f96400] The -list_devices option is deprecated and will be removed. Please use ffmpeg -sources decklink instead.
->
[Blackmagic DeckLink indev @ 0x306ed00] The "list_devices" option is deprecated: use ffmpeg -sources decklink instead

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-12-05 09:00:53 +08:00
Marton Balint a6f6726a81 avdevice/decklink: warn about too old decklink API version
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:57 +01:00
Marton Balint acaf6c625b avdevice/decklink_enc: simplify usage of buffercount type
Also remove some leftover declaration of CreateDeckLinkIteratorInstance().

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:57 +01:00
Marton Balint ff373bb4a8 avdevice/decklink_dec: add support for 50/60 fps timecode
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-12-03 18:32:57 +01:00
Limin Wang 01eb05207c avdevice/decklink_dec: fix warning for unused variable
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-23 16:18:57 +08:00
Limin Wang 3d0a7ae460 avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-23 16:18:57 +08:00
Limin Wang ae23a9684d avdevice/decklink: use boolean for list_devices option
For the document(indevs.texi and outdevs.texi) used it as boolean.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-23 16:18:57 +08:00
Limin Wang 09f1d15ae8 avdevice/decklink_dec: map the raw_format instead of hardcode
The patch will change the numerical values for the string constants so bump
micro version.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-11-21 09:14:52 +08:00
Omar Emara 04b37b5d7f avdevice/xcbgrab: Add select_region option
This patch adds a select_region option to the xcbgrab input device.
If set to 1, the user will be prompted to select the grabbing area
graphically by clicking and dragging. A rectangle will be drawn to
mark the grabbing area. A single click with no dragging will select
the whole screen. The option overwrites the video_size, grab_x, and
grab_y options if set by the user.

For testing, just set the select_region option as follows:

ffmpeg -f x11grab -select_region 1 -i :0.0 output.mp4

The drawing happens directly on the root window using standard rubber
banding techniques, so it is very efficient and doesn't depend on any
X extensions or compositors.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Omar Emara <mail@OmarEmara.dev>
2020-11-06 23:25:13 -05:00
James Almer ac36080b2d avdevice/alldevices: stop using deprecated linked list API
Signed-off-by: James Almer <jamrial@gmail.com>
2020-10-19 11:54:45 -03:00
Limin Wang 6c8ff1838d avdevice/lavfi: av_malloc -> av_malloc_array
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-09-21 09:30:55 +08:00
Limin Wang a554adaab8 avdevice/lavfi: unref the frame on failure
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-09-21 09:30:54 +08:00
Limin Wang 7786d795c2 avdevice/lavfi: fix FIXME and check a/v type by codec_type
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2020-09-21 09:30:54 +08:00
Marton Balint 36c582f515 avdevice/decklink_dec: fix build with older SDK
Apparently bmdFormatUnspecified needs SDK 11.0. It is just a fancy way of
checking for zero, so let's do that instead.

Fixes build issue since f1b908d20a.

Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-15 22:07:26 +02:00
Marton Balint 96907e84dd avdevice/decklink_dec: add support for querying RP188 High Frame Rate timecode
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 18:06:54 +02:00
Marton Balint f1b908d20a avdevice/decklink_dec: add support for rgb/yuv pixel format autodetection
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Marton Balint e33c0d8c69 avdevice/decklink_dec: use decklink_ctx->raw_format as bmdPixelFormat
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Marton Balint a9ede0bde4 avdevice/decklink_common.h: remove unsupported decklink version ifdef
Signed-off-by: Marton Balint <cus@passwd.hu>
2020-09-13 17:59:30 +02:00
Andreas Rheinhardt 5c2c35da12 avdevice/lavfi: Remove redundant av_packet_unref()
Since bae8844e35, the AVPacket that is
intended to be used to return the demuxed packet is automatically
unreferenced when the demuxer returns an error. This makes an
av_packet_unref() in the lavfi demuxer redundant.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-06 21:45:41 +02:00
Andreas Rheinhardt 26469aebd3 avdevice/lavfi: Use av_packet_pack_dictionary() to pack dictionary
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-06 21:45:41 +02:00
Andreas Rheinhardt 901251d59b avdevice/lavfi: Don't set pkt->size to the value it already has
av_new_packet() already sets the size. And if the packet is not
allocated by av_new_packet() (which seems to be impossible atm), both
pkt->size as well as size are 0, so setting it again is unnecessary in
this scenario, too.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-01 09:50:05 +02:00
Andreas Rheinhardt ebd485db92 avdevice/lavfi: Don't reimplement av_frame_get_side_data()
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-01 09:50:05 +02:00
Andreas Rheinhardt e4a650b61a avdevice/lavfi: Use av_packet_move_ref() for packet ownership transfer
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2020-09-01 09:50:05 +02:00
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