Commit Graph

1702 Commits

Author SHA1 Message Date
Andreas Rheinhardt 88af0962ef avdevice/lavfi: Avoid calling av_buffersink_get_* multiple times
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:59:34 +01:00
Andreas Rheinhardt 83ae589359 avdevice/lavfi: Use dedicated pointer to access st->codecpar
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:58:58 +01:00
Andreas Rheinhardt 84f037edc2 avdevice/lavfi: Don't unnecessarily write '\0' to AVBPrint
An AVBPrint's internal string is always already zero-terminated;
writing another '\0' is unnecessary as long as one treats
the string only as a C-string.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:58:43 +01:00
Andreas Rheinhardt 531d289cfd avdevice/lavfi: Properly free an AVDictionary
It is not documented that freeing the last (and only) entry of
an AVDictionary frees the dictionary.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 10:46:01 +01:00
Andreas Rheinhardt 05c924a86d avdevice/lavfi: Cleanup generically on read_header failure
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 10:38:11 +01:00
Andreas Rheinhardt 645f705d6a av(codec|device): Don't cast pointers to int
C99/C11 6.3.2.3 5: "Any pointer type may be converted to an integer
type. [...] If the result cannot be represented in the integer type,
the behavior is undefined." So stop casting pointers to int; use
uintptr_t instead.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-11-21 00:35:30 +01:00
Anton Khirnov db932241ee */version.h: define FF_API macros unconditionally
There is no reason to wrap them in #ifndef guards, they should only be
defined here and nowhere else. The define guards just add the
possibility to accidentally use the same FF_API name in different
libraries.
2021-11-15 16:24:58 +01:00
James Almer b664df3ff4 avdevice/dshow: fix a unused variable warning
Unused if DSHOWDEBUG is not set since commit
d9a9b4c877.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-13 11:38:01 -03:00
James Almer 47451d9267 avdevice/dshow: fix print format for some variables
WAVEFORMATEX.nChannels and WAVEFORMATEX.wBitsPerSample are of type WORD, aka
unsigned short.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-11-13 11:38:01 -03:00
Brad Isbell 9d4989f2e1 avdevice/dshow: Fix missing PCM sample size option when it is used as the lone option for DirectShow audio capture
Signed-off-by: Brad Isbell <brad@audiopump.co>
Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-05 22:58:43 +01:00
Brad Isbell d9a9b4c877 avdevice/dshow: Use WAVEFORMATEX from AM_MEDIA_TYPE for describing device capabilities. (Fixes #9420)
Signed-off-by: Brad Isbell <brad@audiopump.co>
Reviewed-by: Roger Pack <rogerdpack2@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-11-05 22:58:42 +01:00
Andreas Rheinhardt 99b4acd3fa avdevice/caca: Don't free AVOpt-enabled string manually
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-09 14:18:12 +02:00
Andreas Rheinhardt 395803c78f avdevice/caca: Make deinit function out of write_trailer
Fixes memleaks in case the trailer is never written.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-09 14:18:12 +02:00
Andreas Rheinhardt 9b17273c77 avdevice/xv: Increase array size
av_image_copy() expects an array of four pointers according to its
declaration; although it currently only touches pointers that
are actually in use (depending upon the pixel format) this might
change at any time (as has already happened for the linesizes
in d7bc52bf45).

This fixes ticket #9264 as well as a warning from GCC 11.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-10-09 13:24:38 +02:00
Chengfeng Ye 54d201ae20 libavdevice/avfoundation.m: fix potential unreleased lock issue
The problem here is that the lock ctx->frame_lock will become
an unreleased lock if the program returns at patched lines.

Bug tracker link: https://trac.ffmpeg.org/ticket/9386\#ticket

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
2021-09-17 15:31:40 +02:00
Chengfeng Ye 9bbdfbfb32 libavdevice/avfoundation.m: fix protential unreleased lock issue
The problem here is that the lock ctx->frame_lock will
become an unreleased lock if the program returns at
line 697, line 735 and line744.

Bug tracker link: https://trac.ffmpeg.org/ticket/9385\#ticket

Signed-off-by: Chengfeng Ye <cyeaa@connect.ust.hk>
2021-09-17 15:31:32 +02:00
Limin Wang 694ec84ae9 avdevice/decklink: support for more duplex mode for Decklink 8K Pro
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-08-16 10:00:39 +08:00
Limin Wang 13460af456 avdevice/decklink: add level_a configuration option
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-08-16 10:00:39 +08:00
Limin Wang 5f3df7afa6 avdevice/decklink: add sqd configuration option
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-08-16 10:00:39 +08:00
Limin Wang b923bfc679 avdevice/decklink: add link configuration option
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
2021-08-16 10:00:39 +08:00
Yun Zhang a27853a730 lavd/lavfi.c: Set time_base for 608 cc to container time_base.
Suggested-By: ffmpeg@fb.com
2021-08-02 14:00:52 +02:00
Andreas Rheinhardt fd101c9c3b avformat/internal: Move ff_read_line_to_bprint_overwrite to avio_internal.h
It only uses an AVIOContext and an AVBPrint.

When doing so, it turned out that several non-users of
ff_read_line_to_bprint_overwrite() and ff_bprint_to_codecpar_extradata()
relied on libavformat/internal.h to include bprint.h or avstring.h
for them. In order to avoid a repeat of this and in order to reduce
unnecessary dependencies, a forward declaration of struct AVBPrint is
used instead of including bprint.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-29 22:02:05 +02:00
Andreas Rheinhardt 25c8507818 Remove/replace some unnecessary avcodec.h inclusions
Also remove other unnecessary headers and include headers directly while
at it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:29:46 +02:00
Andreas Rheinhardt 2934a4b9a5 Remove unnecessary avassert.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 15:02:30 +02:00
Andreas Rheinhardt 4608f7cc6a Remove unnecessary mem.h inclusions
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 14:47:57 +02:00
Andreas Rheinhardt 1be3d8a0cb avcodec/avcodec: Stop including channel_layout.h in avcodec.h
Also include channel_layout.h directly wherever used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-07-22 11:14:31 +02:00
Steven Liu b67263e0e8 avdevice/avfoundation: remove first_audio_pts and first_pts
Because these two member of AVFContext not be used.

Signed-off-by: Steven Liu <liuqi05@kuaishou.com>
2021-07-19 14:10:06 +02:00
James Almer 39affa5f8e avdevice/libcdio: fix AVStream.cur_dts usage
It should not be accessed from outside of libavformat.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-06-09 13:55:25 -03:00
James Almer b9c5fdf602 avformat: move AVStream.{parser,need_parsing} to AVStreamInternal
Those are private fields, no reason to have them exposed in a public
header.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-05-07 09:27:21 -03:00
Andreas Rheinhardt d92f38c179 avdevice: Constify all devices
This is possible now that the next-API is gone.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 11:48:05 -03:00
Anton Khirnov 85ba17f36d Bump major versions of all libraries.
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-04-27 11:48:05 -03:00
Andreas Rheinhardt 8b3e6ce5f4 avdevice/avdevice: Constify av_*_device_next API
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt d7e0d428fa avdevice/avdevice: Constify avdevice_list_input_sources/output_sinks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt 626535f6a1 avcodec/codec, allcodecs: Constify the AVCodec API
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:14 -03:00
Andreas Rheinhardt ef6a9e5e31 avutil/buffer: Switch AVBuffer API to size_t
Announced in 14040a1d91.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:13 -03:00
Andreas Rheinhardt 11bc790893 avcodec: Remove deprecated AVCodecContext.coded_frame
Deprecated in 40cf1bbacc.
(The currently disabled filter vf_mcdeint and vf_uspp were users of
this field; they have not been changed, so that whoever wants to fix
them can see the state of these filters when they were disabled.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:12 -03:00
Andreas Rheinhardt 56450a0ee4 avformat: Constify the API wrt AV(In|Out)putFormat
Also constify AVProbeData.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-04-27 10:43:08 -03:00
He Yang 707f9c9f47 libavdevice/gdigrab: fix capture of windows with non-ASCII titles
Properly convert the UTF-8 input string to Windows wchar, and
utilize the wchar version of FindWindow.

Signed-off-by: He Yang <1160386205@qq.com>
2021-04-13 19:34:33 +03:00
Michael Niedermayer c361fa9e21 Bump minor versions after release branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 01:02:11 +01:00
Michael Niedermayer c67d2a2875 Bump Versions before release/4.4 branch
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2021-03-20 01:01:12 +01:00
Andreas Rheinhardt a46d781905 avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
These are auxiliary side-data functions, so they should have been
switched to size_t in d79e0fe65c,
but this has been forgotten.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2021-03-19 03:12:24 +01:00
James Almer 54cb30ce64 avdevice/xcbgrab: stop using av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:19:36 -03:00
James Almer 6b3a563b10 avdevice/decklink_dec: stop using av_init_packet()
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 15:19:36 -03:00
James Almer d422b2ed87 avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
The next pointer is kept at the end for backwards compatability until the
major bump, when it should ideally be moved at the front.

Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-17 14:12:17 -03:00
sgerwk 07de796b5d avdevice/xcbgrab: Add option for grabbing a window
The option allows to select a specific window instead of the whole
screen.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
2021-03-14 18:16:18 -04:00
Marton Balint b2d0826513 avdevice/pulse_audio_dec: do not read undersized frames
Keep on reading fragments until we got fragment_size amount of data, otherwise
we might get frames with 1-2 samples only if pa_stream_peek is called slightly
less frequently than sample rate.

Note that fragments might contain a lot less data than fragment_size, so
reading multiple fragments to get fragment_size amount of data is intentional.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-12 23:55:30 +01:00
Marton Balint 7f059a250b avdevice/pulse_audio_dec: only set adjust latency flag if fragment_size is not set
Otherwise fragment_size is ignored.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-12 23:55:30 +01:00
Marton Balint 104aa921c9 avdevice/pulse_audio_dec: query actual fragment size
Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-12 23:55:30 +01:00
Marton Balint 1a90cf4410 avdevice/alsa_dec: make sure we have enough data in non-blocking mode
Otherwise we might return 1-2 samples per packet if av_read_frame() call rate is
only sligthly less than the stream sample rate.

Signed-off-by: Marton Balint <cus@passwd.hu>
2021-03-12 23:55:30 +01:00
James Almer 9e2e6f935b avdevice/decklink: add missing include for buffer_size_t
Should fix compilation broken in f7abb53cb4.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-11 17:39:09 -03:00
James Almer f7abb53cb4 avdevice: use the buffer_size_t typedef where required
Signed-off-by: James Almer <jamrial@gmail.com>
2021-03-10 20:26:36 -03:00
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
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
Takayuki 'January June' Suwa f9a061a31c avdevice/alsa: fix indefinite stop on closing PCM capture
Fixes: https://bugs.archlinux.org/task/58619

Found-by: Elias (Bleuzen) https://bugs.archlinux.org/user/26956
Signed-off-by: Nicolas George <george@nsup.org>
2019-04-23 14:01:23 -08:00
Marton Balint 63c2c83f6e avdevice/decklink_common: add support for DeckLink SDK 11
Fixes ticket #7789.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-04-15 22:22:31 +02:00
Marton Balint f3e22e3201 avdevice/decklink_common: properly check DoesSupportVideoMode result when trying VANC flag
Signed-off-by: Marton Balint <cus@passwd.hu>
2019-04-15 22:22:31 +02:00
Marton Balint e036b8dcf4 avdevice/decklink_dec: set configs before listing formats
Format list can be input and profile dependant.

Signed-off-by: Marton Balint <cus@passwd.hu>
2019-04-15 22:22:31 +02:00
Don C. Bigler 2be7c388db avdevice/opengl_enc: fix build error using msvc compiler 2019-04-10 12:41:58 +02:00
Octavio Alvarez f4f40cbb57 lavd/x11grab: fix vertical repositioning
There is a calculation error in xcbgrab_reposition() that breaks
vertical repositioning on follow_mouse. It made the bottom
reposition occur when moving the mouse lower than N pixels after
the capture bottom edge, instead of before.

This commit fixes the calculation to match the documentation.

follow_mouse: centered or number of pixels. The documentation says:

When it is specified with "centered", the grabbing region follows
the mouse pointer and keeps the pointer at the center of region;
otherwise, the region follows only when the mouse pointer reaches
within PIXELS (greater than zero) to the edge of region.
2019-04-06 15:20:36 +02:00
Carl Eugen Hoyos 5fceac1cdb lavd/v4l2: Fix the type of the probe function. 2019-03-23 23:42:09 +01:00
Carl Eugen Hoyos e704070f61 lavd/v4l2-common: Add an entry for Z16. 2019-03-22 12:30:47 +01:00
Carl Eugen Hoyos 4b32f8b3eb lavd: Remove libndi_newtek 2019-03-20 10:42:10 +00:00
Dilshod Mukhtarov 1100862a94 libavdevice/gdigrab: fix HIDPI support for mouse positioning
Mouse position was not calculated properly in area or window mode

Signed-off-by: Dilshod Mukhtarov <dilshodm@gmail.com>
2019-01-30 21:55:22 +01:00
Dilshod Mukhtarov d7c9ddd0c4 libavdevice/gdigrab: fix HIDPI support for window capture
In Windows if using scaling other than 100% then the grabbed window was not captured fully (cropped)

Signed-off-by: Dilshod Mukhtarov <dilshodm@gmail.com>
2019-01-30 21:55:11 +01:00
Carl Eugen Hoyos 70c68e654d lavd/iec61883: Fix the include path for poll.h. 2019-01-16 00:13:49 +01:00
Oliver Collyer bf96937a96 avdevice/dshow: Fixed some minor memory leaks
Signed-off-by: James Almer <jamrial@gmail.com>
2019-01-03 13:15:45 -03:00
Carl Eugen Hoyos 73251678c8 lavd/v4l2: Use "int request" as second parameter for ioctl() on Android.
Fixes build with new Android toolchain.
2018-12-11 00:49:22 +01:00
Marton Balint c047901012 avdevice/decklink_enc: add support for setting genlock timing offset
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-12-02 00:57:10 +01:00
Michael Niedermayer 517573a670 Bump minor version for master after 4.1 branchpoint
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-02 00:53:07 +01:00
Michael Niedermayer 780d5e30a0 Bump minor versions for branching 4.1
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-11-02 00:15:32 +01:00
Anton Platov 295fd12d17 avdevice/libndi_newtek_dec: add extra_ips option to libndi_newtek allowing use remote network sources
Signed-off-by: Anton Platov <anton@platov.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-11-01 18:46:05 +01:00
BIGLER Don (Framatome) cb74c33106 avdevice/decklink_dec: fix codec_tag of RGBA formats
Fixes ticket #7505.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-11-01 18:46:05 +01:00
Dave Rice 110b4a4918 avdevice/sdl2: add option to set window position
Allows arrangement of multiple windows such as:
ffmpeg -re -f lavfi -i mandelbrot -f sdl -window_x 1 -window_y 1 mandelbrot -vf waveform,format=yuv420p -f sdl -window_x 641 -window_y 1 waveform -vf vectorscope,format=yuv420p -f sdl -window_x 1 -window_y 481 vectorscop

Some changes by Marton Balint:
- allow negative position (partially or fully out-of-screen positions seem to
  be sanitized automatically by SDL (or my WM?), so no special handling is
  needed)
- only show window after the position is set
- do not use resizable and borderless flags at the same time, that caused
  issues in ffplay
- add docs

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-23 19:42:32 +02:00
Devin Heitmueller 9e21ba3dc3 avdevice/decklink: Fix compile breakage on OSX
Make the function static, or else Clang complains with:

error: no previous prototype for function 'decklink_get_attr_string' [-Werror,-Wmissing-prototypes]

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-10-20 01:57:08 +02:00
Karthick Jeyapal c0ee4e0ac2 avdevice/decklink_dec: add option to align capture start time
This option is useful for maintaining input synchronization across N
different hardware devices deployed for 'N-way' redundancy.
The system time of different hardware devices should be synchronized
with protocols such as NTP or PTP, before using this option.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-30 21:09:12 +02:00
Marton Balint db6b4b56b3 avdevice/decklink: add support for selecting devices based on their unique ID
Also bump the API version requirement to 10.9.5, because on olders versions
there were some reports of crashes using the undocumented, yet available
BMDDeckLinkDeviceHandle.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-23 18:55:29 +02:00
Carl Eugen Hoyos 076558a9f4 Cosmetics: Reindent after last commit. 2018-09-19 18:14:40 +02:00
Carl Eugen Hoyos 1ba32a3c46 lavd/dshow: Interpret negative height as bottom-down frame.
Fixes ticket #7436.
2018-09-19 18:13:46 +02:00
Paul B Mahol 6a467d432f avdevice/pulse_audio_dec: set channel map
This fixes opening devices with >6 channels.
2018-09-14 22:12:54 +02:00
Rick Kern a259501e5a lavd/avfoundation: Fix skewed video output
Fixes ticket #5654.
The linesize can be greater than the minimum required. This copies the
frame taking linesize into account.

Signed-off-by: Rick Kern <kernrj@gmail.com>
2018-09-14 00:27:44 +02:00
Devin Heitmueller 8732dfa995 avdevice/decklink: Add support for EIA-708 output over SDI
Hook in libklvanc and use it for output of EIA-708 captions over
SDI.  The bulk of this patch is just general support for ancillary
data for the Decklink SDI module - the real work for construction
of the EIA-708 CDP and VANC line construction is done by libklvanc.

Libklvanc can be found at: https://github.com/stoth68000/libklvanc

Updated to reflect feedback from Marton Balint <cus@passwd.hu>,
Carl Eugen Hoyos <ceffmpeg@gmail.com>, Aaron Levinson
<alevinsn_dev@levland.net>, and Moritz Barsnick <barsnick@gmx.net>

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-09 22:42:26 +02:00
Marton Balint bd3c27fd7a avdevice/decklink_enc: add support for setting duplex mode
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-09-09 21:21:42 +02:00
Gyan Doshi d0b48a9604 avdevice/decklink_enc: print preroll and buffer size
Helpful in diagnosing latency issues.
2018-08-24 10:15:32 +05:30
Lou Logan 98e18910a3 avdevice/v4l2enc: add video4linux2 name alias
Makes the v4l2 outdev name consistent with the v4l2 indev name.

Signed-off-by: Lou Logan <lou@lrcd.com>
2018-06-18 16:26:23 -08:00
Jon Morley 0946c0ec17 avdevice/decklink_dec: capture timecode to metadata when requested
If the user provides a valid timecode_format look for timecode of that
format in the capture and if found store it on the video avstream's
metadata.

Slightly modified by Marton Balint to capture per-frame timecode as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-13 00:15:06 +02:00
Jon Morley fb480a1f1e avdevice/decklink_common: Move DECKLINK_* string functions into header
This allows other decklink source access to these cross-platform
convenience functions.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-13 00:09:48 +02:00
Marton Balint ba8a1d1618 avdevice/decklink_dec: use std::atomic for decklink_input_callback refcounting
Also remove the callback from the context, and add proper error handling.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-13 00:09:48 +02:00
Marton Balint 643123b29d avdevice/decklink_dec: use a custom memory allocator
The default memory allocator is limited in the max number of frames available,
and therefore caused frame drops if the frames were not freed fast enough.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-06-13 00:09:48 +02:00
Martin Vignali 411f7141a3 avdevice/sdl2 : add option to define if the window quit action is available 2018-05-19 14:55:15 +02:00
Martin Vignali 644130bcaa avdevice/sdl2output : fix setting window_size 2018-05-19 14:55:11 +02:00
Anton Leontiev 9481802539 lavd/v4l2: Add ARGB and XRGB packed pixel formats
Formats ARGB32, XRGB32, ABGR32, and XBGR32 were added to V4L2 instead
of ill-defined deprecated RGB32/BGR32 pixel formats.

When pixel format is not specified explicitly FFmpeg tries formats in
order in which they are stored in the table. Therefore formats are
sorted as follows: BGR is preferred over RGB and XBGR is preferred
over ARGB, because it could give better performance by ignoring alpha
component.
2018-05-10 22:40:57 +02:00
Marton Balint 649087fa83 avdevice/decklink_dec: unref packets on avpacket_queue_put error
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 22:44:58 +02:00
Marton Balint 75d1529c6e avdevice/decklink_dec: do not copy video data
Create a buffer from the data instead and use the buffer destructor to free the
DeckLink frame. This avoids a memcpy of the frame data.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-30 22:44:58 +02:00
Michael Niedermayer 13b77af2f0 avdevice/android_camera: Fix AVClass.version
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-19 23:44:33 +02:00
James Almer 5079e96bcc avdevice/iec61883: free the private context at the end
Fixes part of ticket #7146.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-18 22:45:09 -03:00
James Almer b8629654c6 avdevice/iec61883: return reference counted packets
Fixes part of ticket #7146, dealing with leaks of packet data since
commit 87c8812270.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-18 22:45:09 -03:00
Marton Balint 768c0774d8 avdevice/decklink_commmon: enhance error messages when iterator creation fails
Show a more useful error message which specifies the required driver version
for the build, and use the correct context in the error message for WIN32.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-04-18 22:20:17 +02:00
Carl Eugen Hoyos 9d6c168764 lavd/vfwcap: Pass pointers to int instead of long to av_parse_video_size().
Fixes the following warnings:
libavdevice/vfwcap.c:331:35: warning: passing argument 1 of 'av_parse_video_size' from incompatible pointer type
libavdevice/vfwcap.c:331:59: warning: passing argument 2 of 'av_parse_video_size' from incompatible pointer type

Reported-by: Reino Wijnsma
2018-04-18 20:26:44 +02:00
Michael Niedermayer 3c1ecb057d Bump minor versions after release/4.0 branching
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Michael Niedermayer 7e3a070d9a Bump minor versions for branching release/4.0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-16 12:35:12 +02:00
Josh de Kock 92fe0bf1e8 lavfi,lavd: add gitignore for generated static component lists
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-05 22:08:53 +01:00
James Almer 38fa61b947 avdevice/decklink_dec: use av_packet_make_refcounted to ensure packets are ref counted
Partially reverts commit e91f0c4f8b, simplifying code.

Signed-off-by: James Almer <jamrial@gmail.com>
2018-04-02 00:36:24 -03:00
Josh de Kock 89029bd2c7 lav*,tests: remove several register_all calls
avdevice_register_all() is still required to register devices into
lavf (this is required due to lavd being somewhat of a hack).

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 03:26:22 +01:00
Josh de Kock 42d26145e9 lavf: move avpriv function definition to internal.h
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-04-02 02:16:14 +01:00
Josh de Kock 65452bcd64 lavd: remove linked lists
Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-03-31 23:26:31 +01:00
Josh de Kock d8ae40611b Revert "lavd: add new API for iterating input and output devices"
This reverts commit 0fd475704e.

Revert "lavd: fix iterating of input and output devices"

This reverts commit ce1d77a5e7.

Signed-off-by: Josh de Kock <josh@itanimul.li>
2018-03-31 23:26:31 +01:00
Jun Zhao ac6e27d74f kmsgrab: add category for kmsgrab
Makes kmsgrab visible in "ffmpeg -devices".

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
Signed-off-by: Mark Thompson <sw@jkqxz.net>
2018-03-26 22:39:12 +01:00
Marton Balint 87455b78cc avdevice/decklink: fix leak when listing devices and there is no memory
Fixes Coverity CID 1419523.

Signed-off-by: Marton Balint <cus@passwd.hu>
2018-03-24 20:55:46 +01:00
Felix Matouschek ce1d77a5e7 lavd: fix iterating of input and output devices
In the previous implementation the first input or output device
was skipped when device_next was called with prev = NULL

Signed-off-by: Felix Matouschek <felix@matouschek.org>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
2018-03-18 17:45:20 +01:00
Felix Matouschek 5ac3a309fd avdevice: add android_camera indev
This commit adds an indev for Android devices on API level 24+ which
uses the Android NDK Camera2 API to capture video from builtin cameras

Signed-off-by: Felix Matouschek <felix@matouschek.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-22 00:29:27 +01:00
Michael Niedermayer 75027066d8 avdevice/decklink_dec: Fix ;;
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-02-15 13:48:52 +01:00
Ray Tiley c837cd3d4d avdevice/decklink_dec: extract NTSC VANC
This changes how NTSC VANC is extracted from the buffer. In NTSC the vanc data
is interleaved between luma and chroma, and not just the luma as in high
definition resolutions.

In my testing this allows a decklink card encoding valid NTSC closed
captions to pass the caption data to the x264 encoder.

Updated with reviews from Devin Heitmueller and Marton Balint.

Signed-off-by: Ray Tiley <raytiley@gmail.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-02-13 00:13:21 +01:00
James Almer 36c85d6e77 api: add missing version bumps and APIChanges entries
avcodec bump missed in 7e8eba2d87
avformat bump missed in ff46124b0d and
0694d87024
avdevice bump missed in 0fd475704e

Signed-off-by: James Almer <jamrial@gmail.com>
2018-02-06 23:43:01 -03:00
Josh de Kock 0fd475704e lavd: add new API for iterating input and output devices
This also adds an avpriv function to register devices in
libavformat
2018-02-06 18:57:42 +00:00
Marton Balint 4bb0409820 avdevice: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Devin Heitmueller b5b4868504 avdevice/decklink: Fix compilation of module on OSX
Clang applies the missing-prototypes warning on C++ files, whereas
gcc only applies it to C.  As a result, the decklink_common.cpp file
fails to build because of missing prototypes in DecklinkDispatch.cpp
(which is #included by decklink_common.cpp).

We don't want to change the actual Blackmagic SDK sources, so
suppress the warning just for that one #include.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-20 18:38:29 +01:00
Devin Heitmueller 5409f065f2 avdevice/decklink: Suppress warning about misuse of struct instead of class
When building with Clang, the following warning is shown:

warning: struct 'IDeckLinkVideoFrame' was previously declared as a
class [-Wmismatched-tags]

The function incorrectly casts IDeckLinkVideoFrame as a struct
instead of a class pointer.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-20 18:38:29 +01:00