aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/decklink_enc.cpp
Commit message (Collapse)AuthorAgeFilesLines
* avformat/vapoursynth: Add missing inclusion of frame.hAndreas Rheinhardt2023-09-101-0/+1
| | | | | | | | | Broken in 0c6e5f321bf5c4054e8b98232692465b342b42b4. Also add it to decklink_enc.cpp in order not to rely on an implicit inclusion via libavfilter/ccfifo.h. Reviewed-by: あんこ <mailcrystaldiskinfo@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avdevice/decklink_enc: use 64bit format string for BMD timebase instead of ↵Marton Balint2023-07-091-1/+1
| | | | | | | | | | | | | | | | long long BMDTimeValue is defined as LONGLONG on Windows, but int64_t on Linux/Mac. Fixes format string warnings: libavdevice/decklink_enc.cpp: In function ‘void construct_cc(AVFormatContext*, decklink_ctx*, AVPacket*, klvanc_line_set_s*)’: libavdevice/decklink_enc.cpp:424:48: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 4 has type ‘BMDTimeValue {aka long int}’ [-Wformat=] ctx->bmd_tb_num, ctx->bmd_tb_den); ~~~~~~~~~~~~~~~ ^ libavdevice/decklink_enc.cpp:424:48: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 5 has type ‘BMDTimeValue {aka long int}’ [-Wformat=] Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: add support for SMPTE 2038 VANC packet outputDevin Heitmueller2023-07-021-1/+93
| | | | | | | | | | | | | | | | | 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>
* avfilter/ccfifo: remove unnecessary context allocationsJames Almer2023-05-121-7/+7
| | | | | | | This is not public API, no it has no need for an alloc() and free() functions. The struct can reside on stack. Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/decklink_enc: add support for playout of 608 captions in MOV filesDevin Heitmueller2023-05-111-0/+65
| | | | | | | | | | | | | | | | | Unlike other cases where the closed captions are embedded in the video stream as MPEG-2 userdata or H.264 SEI data, with MOV files the captions are often found on a separate "e608" subtitle track. Add support for playout of such files, leveraging the new ccfifo mechanism to ensure that they are embedded into VANC at the correct rate (since e608 packets often contain batches of multiple 608 pairs). Note this patch includes a new file named libavdevice/ccfifo.c, which allows the ccfifo functionality in libavfilter to be reused even if doing shared builds. This is the same approach used for log2_tab.c. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avdevice/decklink_enc: fix operator precedence in create_s337_payloadMarton Balint2023-04-241-1/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: Add support for compressed AC-3 output over SDIDevin Heitmueller2023-04-081-15/+85
| | | | | | | | | | | | | | | | | | | Extend the decklink output to include support for compressed AC-3, encapsulated using the SMPTE ST 377:2015 standard. This functionality can be exercised by using the "copy" codec when the input audio stream is AC-3. For example: ./ffmpeg -i ~/foo.ts -codec:a copy -f decklink 'UltraStudio Mini Monitor' Note that the default behavior continues to be to do PCM output, which means without specifying the copy codec a stream containing AC-3 will be decoded and downmixed to stereo audio before output. Thanks to Marton Balint for providing feedback. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: Add support for output of Active Format Description (AFD)Devin Heitmueller2023-04-061-2/+88
| | | | | | | | | | | | | | Implement support for including AFD in decklink output when putting out 10-bit VANC data. Updated to reflect feedback in 2018 from Marton Balint <cus@passwd.hu>, Carl Eugen Hoyos <ceffmpeg@gmail.com> and Aaron Levinson <alevinsn_dev@levland.net>. Also includes fixes to set the AR field based on the SAR, as well as now sending the AFD info in both fields for interlaced formats. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: fix unused variable compiler warningsDevin Heitmueller2023-03-081-2/+0
| | | | | | | | Due to refactoring, the ctx/cctx variables are never actually used in ff_decklink_write_packet(), so just remove them. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: fix setting of last_pts to only be set for videoDevin Heitmueller2023-03-081-2/+2
| | | | | | | | | | | | | | The ff_decklink_write_packet() was always caching the last pts received, to be used when calling StopScheduledPlayback(). However because audio and video are on different timebases and the call to StopScheduledPlayback() expects the video timebase, we'll end up sending a weird value to the stop routine if the last packet received contained audio. Move the setting of last_pts to just be for the video stream. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: don't take for granted that first frame to decklink ↵Devin Heitmueller2023-03-081-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | output will be PTS 0 The existing code assumed that the first frame received by the decklink output would always be PTS zero. However if running in other timing modes than the default of CBR, items such as frame dropping at the beginning may result in starting at a non-zero PTS. For example, in our setup because we discard probing data and run with "-vsync 2" the first video frame scheduled to the decklink output will have a PTS around 170. Scheduling frames too far into the future will either fail or cause a backlog of frames scheduled far enough into the future that the entire pipeline will stall. Issue can be reproduced with the following command-line: ./ffmpeg -copyts -i foo.ts -f decklink -vcodec v210 -ac 2 'DeckLink Duo (4)' Keep track of the PTS of the first frame received, so that when we enable start playback we can provide that value to the decklink driver. Thanks to Marton Balint for review and suggestion to use AV_NOPTS_VALUE rather than zero for the initial value. Signed-off-by: Devin Heitmueller <dheitmueller@ltnglobal.com> Signed-off-by: Marton Balint <cus@passwd.hu>
* decklink: convert to new channel layout APIJames Almer2022-03-151-3/+3
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/decklink: add link configuration optionLimin Wang2021-08-161-0/+2
| | | | | Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-271-1/+1
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/decklink: add missing include for buffer_size_tJames Almer2021-03-111-0/+1
| | | | | | | Should fix compilation broken in f7abb53cb427515faac582f114ab97cbbd590280. Reviewed-by: Marton Balint <cus@passwd.hu> Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice: use the buffer_size_t typedef where requiredJames Almer2021-03-101-1/+2
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avdevice/decklink: remove the duplicated warning messageLimin Wang2020-12-051-1/+0
| | | | | | | | | | | ./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>
* avdevice/decklink_enc: simplify usage of buffercount typeMarton Balint2020-12-031-2/+2
| | | | | | Also remove some leftover declaration of CreateDeckLinkIteratorInstance(). Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: deprecate the -list_devices optionMarton Balint2020-01-031-0/+1
| | | | | | The user should use ffmpeg -sources decklink or ffmpeg -sinks decklink instead. Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: fix checking video mode in SDK version 11Marton Balint2019-05-051-2/+5
| | | | | | | | | 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>
* avdevice/decklink: Add support for EIA-708 output over SDIDevin Heitmueller2018-09-091-7/+172
| | | | | | | | | | | | | | | | 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>
* avdevice/decklink_enc: add support for setting duplex modeMarton Balint2018-09-091-0/+1
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: print preroll and buffer sizeGyan Doshi2018-08-241-0/+3
| | | | Helpful in diagnosing latency issues.
* avdevice: migrate to AVFormatContext->urlMarton Balint2018-01-281-2/+2
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: Suppress warning about misuse of struct instead of classDevin Heitmueller2018-01-201-1/+1
| | | | | | | | | | | | | 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>
* avdevice/decklink: refactor ff_decklink_set_format functionKarthick J2017-11-211-0/+4
| | | | | | This is done to enable input format autodetection in decklink_dec. Signed-off-by: Marton Balint <cus@passwd.hu>
* libavdevice/decklink: add support for 10-bit output for Decklink SDIDevin Heitmueller2017-10-101-29/+83
| | | | | | | | | | | | | | | | Can be tested via the following command: ./ffmpeg -i foo.ts -f decklink -vcodec v210 'DeckLink Duo (1)' Note that the 8-bit support works as it did before, and setting the pix_fmt isn't required for 10-bit mode. The code defaults to operating in 8-bit mode when no vcodec is specified, for backward compatibility. 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>
* libavdevice/decklink: add support for -sources and -sinks argumentsDevin Heitmueller2017-10-101-2/+8
| | | | | | | | | | | | | | | 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>
* avdevice/decklink_enc: enable 16 output channelpkviet2017-08-271-2/+2
| | | | | | | | Decklink devices can output 2, 8 or 16 audio channels along video. The code was limited to 2 or 8 channels. The commit enables 16 audio channels (relevant for SDI outputs). Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: fix MSVC build issuesAaron Levinson2017-05-081-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avdevice/decklink: remove pthread dependencyAaron Levinson2017-04-151-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* avdevice/decklink_enc: convert to std::atomicMarton Balint2017-03-281-4/+6
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: convert AVFMT_RAWPICTURE to AV_CODEC_ID_WRAPPED_AVFRAMEMarton Balint2017-02-261-40/+38
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: add support to specify field orderMarton Balint2017-02-261-2/+2
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: convert to codecparMarton Balint2017-02-261-10/+10
| | | | Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink_enc: do not reference this after freeing itMarton Balint2016-12-271-1/+1
| | | | | | Fixes Coverity CID 1396863. Signed-off-by: Marton Balint <cus@passwd.hu>
* decklink: Remove unneeded spaces in initializersPatrick Felt2016-08-021-13/+13
|
* avdevice/decklink: always free decklink resources on errorMarton Balint2016-06-261-6/+6
| | | | | Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: factorize device finder functionMarton Balint2016-06-261-25/+4
| | | | | Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: remove unused itermode iteratorsMarton Balint2016-06-261-8/+0
| | | | | Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Marton Balint <cus@passwd.hu>
* avdevice/decklink: factorize cleanup function to common codeMarton Balint2016-06-261-8/+2
| | | | | Reviewed-by: Deti Fliegl <deti@fliegl.de> Signed-off-by: Marton Balint <cus@passwd.hu>
* Revert "decklink: Header cleanup"Timothy Gu2016-01-241-0/+4
| | | | | | This reverts commit 61fb70c3866b19dccf473ad4e5ede79d117e8e1c. Reported in #5183 to break the build. Further investigation needed.
* decklink: Header cleanupTimothy Gu2016-01-241-4/+0
| | | | | This commit cleans up the decklink files' header usage so that they pass checkheaders.
* avdevice/decklink: move general code of decklink encoder to common fileDeti Fliegl2014-09-221-180/+18
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavd: add decklink output deviceRamiro Polla2014-02-091-0/+588
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>