Commit Graph

50 Commits

Author SHA1 Message Date
Devin Heitmueller ac4247270c avdevice/decklink_enc: add support for SMPTE 2038 VANC packet output
Support decoding and embedding VANC packets delivered via SMPTE 2038
into the SDI output.  We leverage an intermediate queue because
data packets are announced separately from video but we need to embed
the data into the video frame when it is output.

Note that this patch has some additional abstraction for data
streams in general as opposed to just SMPTE 2038 packets.  This is
because subsequent patches will introduce support for other
data codecs.

Thanks to Marton Balint for review/feedback.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-02 19:57:45 +02:00
Devin Heitmueller e7d800fe89 avdevice/decklink: move queue_size to an argument for ff_decklink_packet_queue_init
The existing queue initialization function would always sets it's
maximum queue size to ctx->queue_size.  But because we are introducing
more queues we may want the sizes to differ between them.

Move the specification of the queue size into an argument, which can
be passed from the caller.

This patch makes no functional change to the behavior.  It is being
made to accommodate Marton Balin's request to split out the queue
size for the new VANC queue being introduced in a later patch.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-07-02 19:57:45 +02:00
Devin Heitmueller 859c34706d avdevice/decklink_common: Convert to using avpriv_packet_list functions
The existing DecklinkQueue implementation was using the PacketList
structure but wasn't using the standard avpriv_packet_list_get and
avpriv_packet_list_put functions.  Convert to using them so we
eliminate the duplicate logic, per Marton Balint's suggestion.

Updated to reflect feedback from Marton Balint provided on 05/11/23.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-05-31 00:21:00 +02:00
Devin Heitmueller 4fd729a1f8 avdevice/decklink: move AVPacketQueue into decklink_common and rename it to DecklinkPacketQueue
Move the AVPacketQueue functionality that is currently only used
for the decklink decode module into decklink_common, so it can
be shared by the decklink encoder (i.e. for VANC insertion when
we receive data packets separate from video).

The threadsafe queue used within the decklink module was named
"AVPacketQueue" which implies that it is part of the public API,
which it is not.

Rename the functions and the name of the queue struct to make
clear it is used exclusively by decklink, per Marton Balint's
suggestion.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2023-05-11 22:46:15 +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
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 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 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 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 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
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 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
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
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
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
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 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
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
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
Karthick J e8e9306b4f avdevice/decklink_dec: autodetect the video input format
When -format_code is not specified autodetection will happen.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-11-22 00:08:35 +01:00
Karthick J aa7b0329ff avdevice/decklink: refactor ff_decklink_set_format function
This is done to enable input format autodetection in decklink_dec.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-11-21 22:55:49 +01:00
Devin Heitmueller 278588cd0b libavdevice/decklink: add support for -sources and -sinks arguments
Add support for enumerating the sources/sinks via the ffmpeg
command line options, as opposed to having to create a real pipeline
and use the "-list_devices" option which does exit() after dumping
out the options.

Note that this patch preserves the existing "-list_devices" option,
but now shares common code for the actual enumeration.

Updated to reflect feedback from Marton Balint <cus@passwd.hu>.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-10-10 20:07:25 +02:00
Devin Heitmueller b6782a192e avdevice/decklink: Fix segfault when running -list_devices on OSX
The string is allocated with CFStringGetCString but was being
deallocated with free(), which would intermittently result in
a segmentation fault.  Use the correct function for freeing the
allocated CFString.

Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-10-04 22:48:23 +02:00
Gildas Fargeas cb8b729180 avdevice/decklink_dec: add support for more pixel formats
The decklink input pixel format can now be specified with the 'raw_format'
option. The -bm_v210 option is now deprecated.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-09-28 21:06:03 +02:00
Aaron Levinson 7f7ee86d5a avdevice/decklink: fix MSVC build issues
Purpose: Made minor changes to get the decklink avdevice code to build
using Visual C++.

Notes: Made changes to configure per Hendrik Leppkes's review of first
and second versions of patch.  Also made slight alterations per Marton
Balint's reviews.

Comments:

-- configure: Added if enabled decklink section and setting
   decklink_indev_extralibs and decklink_outdev_extralibs here for
   both mingw and Windows.  Also eliminated the setting of these
   variables in the mingw section earlier in the file.

-- libavdevice/decklink_common.cpp: Switched the order of the include
   of libavformat/internal.h to workaround build issues with Visual
   C++.  See comment in file for more details.

-- libavdevice/decklink_dec.cpp:
a) Rearranged the include of libavformat/internal.h (for reasons as
   described above).
b) Made slight alteration to an argument for call to av_rescale_q() to
   workaround a compiler error with Visual C++.  This appears to only
   be an issue when building C++ files with Visual C++.  See comment
   in code for more details.

-- libavdevice/decklink_enc.cpp: Rearranged the include of
   libavformat/internal.h (for reasons as described above).

Signed-off-by: Aaron Levinson <alevinsn@aracnet.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-05-08 22:43:35 +02:00
Aaron Levinson 9e86a61870 avdevice/decklink: remove pthread dependency
Purpose: avdevice/decklink: Removed pthread dependency by replacing
semaphore used in code appropriately.  Doing so makes it easier to
build ffmpeg using Visual C++ on Windows.  This is a contination of
Kyle Schwarz's "avdevice/decklink: Remove pthread dependency" patch
that is available at https://patchwork.ffmpeg.org/patch/2654/ .  This
patch wasn't accepted, and as far as I can tell, there was no
follow-up after it was rejected.

Notes: Used Visual Studio 2015 (with update 3) for this.

Comments:

-- configure: Eliminated pthreads dependency for decklink_indev_deps
   and decklink_outdev_deps and replaced with threads dependency

-- libavdevice/decklink_common.cpp / .h:
a) Eliminated semaphore and replaced with a combination of a mutex,
   condition variable, and a counter (frames_buffer_available_spots).
b) Removed include of pthread.h and semaphore.h and now using
   libavutil/thread.h instead.

-- libavdevice/decklink_dec.cpp: Eliminated include of pthread.h and
   semaphore.h.

-- libavdevice/decklink_enc.cpp:
a) Eliminated include of pthread.h and semaphore.h.
b) Replaced use of semaphore with the equivalent using a combination
   of a mutex, condition variable, and a counter
   (frames_buffer_available_spots).  In theory, libavutil/thread.h and
   the associated code could have been modified instead to add
   cross-platform implementations of the sem_ functions, but an
   inspection of the ffmpeg source base indicates that there are only
   two cases in which semaphores are used (including this one that was
   replaced), so it was deemed to not be worth the effort.

Signed-off-by: Marton Balint <cus@passwd.hu>
2017-04-15 12:26:21 +02:00
Marton Balint 77d2cb8874 avdevice/decklink: deprecate @mode syntax in device name to specify mode
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-03-28 22:00:16 +02:00
Matthias Hunstock b3a2adaac6 avdevice/decklink: new option 'format_code' to set video format by fourCC
Signed-off-by: Matthias Hunstock <atze@fem.tu-ilmenau.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-03-22 02:07:50 +01:00
Matthias Hunstock 607bffbed2 avdevice/decklink: add format_code of display mode to list_format output
Signed-off-by: Matthias Hunstock <atze@fem.tu-ilmenau.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-03-22 02:07:47 +01:00
Marton Balint 48f8ad3290 avdevice/decklink_enc: add support to specify field order
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-02-26 22:47:33 +01:00
Matthias Hunstock d8ee02a071 decklink: enhancement: format selection with AVRational v2
When finding a video mode based on frame size and frame rate,
use AVRational methods instead of simple comparison. Add debug information.

Signed-off-by: Matthias Hunstock <atze@fem.tu-ilmenau.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-05 21:33:43 +02:00
Patrick Felt e9659d1a0b decklink: Remove unneeded spaces in initializers 2016-08-02 22:46:28 -07:00
Michael Niedermayer c0cb53cd1f avdevice/decklink_common: Replace rare spelling of Succesfully by 500 times more common one
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-28 03:07:54 +02:00
Marton Balint b18d6c5800 avdevice/decklink: fix mingw portability
Fixes ticket #5669.

Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-27 02:12:07 +02:00
Marton Balint da89c6e37c avdevice/decklink: add support for audio and video input selection
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:18:02 +02:00
Marton Balint 8f9fa49bd8 avdevice/decklink: add support for setting duplex mode
This patch also makes BlackMagic drivers v10.6.1 a hard requirement.

Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:56 +02:00
Marton Balint 38d75fe906 avdevice/decklink: factorize device finder function
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:45 +02:00
Marton Balint 1fc85d8511 avdevice/decklink: factorize cleanup function to common code
Reviewed-by: Deti Fliegl <deti@fliegl.de>
Signed-off-by: Marton Balint <cus@passwd.hu>
2016-06-26 19:17:37 +02:00
Timothy Gu ce36cb08ed Revert "decklink: Header cleanup"
This reverts commit 61fb70c386.

Reported in #5183 to break the build. Further investigation needed.
2016-01-24 12:42:39 -08:00
Timothy Gu 61fb70c386 decklink: Header cleanup
This commit cleans up the decklink files' header usage so that they pass
checkheaders.
2016-01-24 07:31:16 -08:00
Michael Niedermayer 5ae140c04f avdevice/decklink_common: Use defined(__APPLE__) instead of __APPLE__
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-08 04:52:52 +01:00
Georg Lippitsch 62ea5ae2b5 avdevice/decklink_common: Fix Decklink for Mac
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-08 04:43:54 +01:00
Jonathan Baecker 868cec5874 avdevice/decklink_common: fix COM initialization failure check
Signed-off-by: Jonathan Baecker <jonbae77@gmail.com>
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 18:47:24 +01:00
Jonathan Baecker 5a57f389f4 avdevice/decklink_common: fix heap corruption run time error
Signed-off-by: Jonathan Baecker <jonbae77@gmail.com>
Reviewed-by: Ramiro Polla <ramiro.polla@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-03 00:41:10 +01:00
Deti Fliegl a5e040ee3c avdevice/decklink: move general code of decklink encoder to common file
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-09-22 01:39:50 +02:00