Commit Graph

91 Commits

Author SHA1 Message Date
Jun Zhao ab3bd5ead0 avdevice/decklink_dec: add explicit specifier
The explicit specifier used with a single argument constructor
to prevent implicit type conversions.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2023-11-21 08:02:29 +08: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 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
James Almer d03b327787 decklink: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:31 -03:00
Andreas Rheinhardt d61240f8c9 avcodec/packet_internal: Add proper PacketList struct
Up until now, we had a PacketList structure which is actually
a PacketListEntry; a proper PacketList did not exist
and all the related functions just passed pointers to pointers
to the head and tail elements around. All these pointers were
actually consecutive elements of their containing structs,
i.e. the users already treated them as if they were a struct.

So add a proper PacketList struct and rename the current PacketList
to PacketListEntry; also make the functions use this structure
instead of the pair of pointers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-01-04 13:16:50 +01: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 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 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
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
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
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 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 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
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 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
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
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
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
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
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
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
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
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
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
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
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
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
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
Marton Balint 4bb0409820 avdevice: migrate to AVFormatContext->url
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-28 23:06:43 +01:00
Vishwanath Dixit fc93eca126 avdevice/decklink: addition of absolute wallclock option for pts source
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-20 18:38:27 +01:00
Vishwanath Dixit 7c27bbd590 avdevice/decklink: addition of copyts option
Signed-off-by: Marton Balint <cus@passwd.hu>
2018-01-20 18:29:56 +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
James Almer bf7ae32a08 avdevice/decklink_dec: make some function static
Reviewed-by: Aaron Levinson <alevinsn_dev@levland.net>
Signed-off-by: James Almer <jamrial@gmail.com>
2017-11-09 15:27:26 -03:00
James Almer 5c819f433e avdevice/decklink_dec: remove extra bracket
Fixes compilation broken in 2245476e5c

Fixes ticket #6791

Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-30 11:47:51 -03:00
James Almer 2245476e5c avdevice: remove usage of deprecated setter and getter functions
Signed-off-by: James Almer <jamrial@gmail.com>
2017-10-29 14:42:48 -03:00
Dave Rice 89cc48551b avdevice/decklink_dec: 32 bit audio support
Signed-off-by: Marton Balint <cus@passwd.hu>
2017-10-18 21:45:24 +02: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
Carl Eugen Hoyos f49c129dd4 lavd/decklink_dec: Do not claim to output transparency information. 2017-10-08 22:58:33 +02:00