Commit Graph

285 Commits

Author SHA1 Message Date
Martin Pulec
43972b36ea fixed CIDs 4167{1,2,3,4,5,7,8} 2023-07-25 09:32:15 +02:00
Martin Pulec
e6fcbec6b4 DeckLink: prepare support for 32 and 64 audio ch.
BMD API starting with 12.0 support 64 channels so enable it when using
eligible SDK.

UG ships currently 11.6 so it won't be enabled by default but user can
ship own version.

+ replaced unneeded checks in display_decklink_reconfigure_audio
  with assert (not needed, this should not happen because the format is
  negotiated with `get_property(AUDIO_FORMAT)`` first)
2023-07-21 16:48:08 +02:00
Martin Pulec
f4086999fe DeckLink sync.: allow "sync" shortcut 2023-07-21 12:31:35 +02:00
Martin Pulec
a1eea8e221 DeckLink sync: aud. discontinuity check removed
As for now, it breaks things when using OPUS, eg on DeckLink 4K Extrme:
```
uv -t testcard:mode=Hi59 -s embedded -A OPUS -d decklink:sync -r embedded
```

Poorly synchronized input, especially when there is a timing jitter,
like sdl_mixer will stop to be played properly, but this isn't actually
purpose of this mode so it isn't perhaps a good idea to complicate the
things by adding some error-prone stuff.
2023-07-21 12:31:35 +02:00
Martin Pulec
542d5c2d55 DeckLink disp synchronized: do not play audio during reconf
Not a big deal but it produces following error on reconfiguration:
```
sender $ uv -t testcard -s embedded -c libavcodec receiver # restart 2x
receiver $ uv -d decklink:synchronized -r embedded 2>&1 | grep error:wq
ScheduleAudioSamples: General access denied error (0x80000009)
``
2023-07-21 12:31:34 +02:00
Martin Pulec
a41bb5ffa9 DeckLink disp: fixed scheduled reconfigure
Callback is removed in reconfigure if already initialized but was set
only in _init.
2023-07-20 15:34:50 +02:00
Martin Pulec
306b26aede DeckLink disp.: report ext stats every 5 sec, not 6
Doesn't matter much, moreover it is only in verbose mode, just to be
consistent.
2023-07-20 09:27:17 +02:00
Martin Pulec
a2d8913569 DeckLink disp.: when resync the stream, reset all audio vals
Keep own copy of original and working (with wraparounds) audio TS in
order not to fight with the video over the shared variable - reconfigure
only if there is a change.
2023-07-19 12:15:15 +02:00
Martin Pulec
18775820e7 DeckLink disp.: frames should be released 2023-07-19 11:26:13 +02:00
Martin Pulec
6780691b4e modernize playback APIs
modernized video display, audio playback and vo postprocess APIs

THe APIs were already recently updated so modernize it by using bool
where the return value is semantically boolean value. Using TRUE/FALSE is
inherently ambiguous because it is not obvious from the prototype if
success is 0 or TRUE (1).
2023-07-18 16:43:37 +02:00
Martin Pulec
baa0c661c1 DeckLink disp.: fixed stream discontinuity detection 2023-07-18 16:43:30 +02:00
Martin Pulec
2748e3687d IDeckLinkVideoOutputCallback haven't virt dtor
IDeckLinkVideoOutputCallback doesn't have a virtual desctructor in
Windows, thus its subclass destructor cannot be marked override.
2023-07-18 14:20:00 +02:00
Martin Pulec
d2b39acab0 video display: returns bool from putf API
Use bool return value from putf - returning int here may be error-prone
because the semantics is unclear (is success 0 or TRUE).
2023-07-18 13:46:54 +02:00
Martin Pulec
e38117214f DeckLink disp.: added synchronized opt (replace)
Replace [no-]low-latency option with synchronized opt - the behavior
of the no-low-latency mode has changed, anyways, so as a benefit it is
more obvious.
2023-07-18 13:30:13 +02:00
Martin Pulec
037e0bc670 DeckLink disp.: do not dyn alloc PlaybackDelegate
make it aggregate directly inside state_decklink

+ moved all scheduled things to the PlaybackDelegate state
2023-07-18 11:20:44 +02:00
Martin Pulec
1e3af5ed78 DeckLink disp. sched aud: no sync on large diff
When the timestamp difference is too large, do not sync at all and
schedule continuously. This has been already there but the difference
wasn't allowed to be more than 2000.
2023-07-18 11:12:11 +02:00
Martin Pulec
3ac4f7cee2 DeckLink disp.: reconfigure audio w. video (schd)
In scheduled mode, we need to restart stream after configuring audio. The
previous implemenation was rather error-prone because if the audio was
configured after video, it didn't work. Now it simplifies the workflow.

This also fixes a potential crash when DisableVideoOutput in reconfigure
was called after deleting the delegate structure.
2023-07-18 11:09:08 +02:00
Martin Pulec
68b8c40955 DeckLink disp.: EnableAudioOutput with corr. type
This fixes E_ACCESSDENIED from ScheduleAudioSamples in some runs.
2023-07-18 11:09:08 +02:00
Martin Pulec
49e1ae4dd1 DeckLink disp.: print ScheduleAudioSamples error 2023-07-18 11:09:08 +02:00
Martin Pulec
4570b8aeab DeckLink disp: resync after missing/extra frame
When there is a missing frame, seq is incremented but the actual time
base may have diverged.

Similarly to dropped frame - one frame is elapsed but the time base
didn't reflect that, because it was dropped.
2023-07-18 11:09:08 +02:00
Martin Pulec
8dcfdf9937 DeckLink disp.: use DeckLink frame internally
Use our DeckLink frame type rather than the IDeckLinkMutableVideoFrame
ancestor because we may use its specifics.
2023-07-18 11:09:08 +02:00
Martin Pulec
426de8d842 DeckLink disp.: fixed audio wrap-around 2023-07-18 11:09:08 +02:00
Martin Pulec
cee1bc3847 DeckLink disp.: properly schedule audio 2023-07-18 11:09:08 +02:00
Martin Pulec
60c7e71357 DeckLink disp.: recreate PlaybackDelegate on reconf
Actually there are now more things that need to be reset, like
scheduled frames for playback so we'd better delete and recreate the
state altogether.
2023-07-18 11:09:08 +02:00
Martin Pulec
670a9c056c DeckLink disp: add PlaybackDelegate::PrintStats
This cancels the need to friending with display_decklink_putf.

+ make some class members private if possible
2023-07-18 11:09:08 +02:00
Martin Pulec
bcf4f52554 DeckLink disp.: queue for sched frames 2023-07-18 11:09:08 +02:00
Martin Pulec
e98bbb4bff DeckLink disp.: fixed clang-tidy warnings 2023-07-18 11:09:07 +02:00
Martin Pulec
a5c2e7559c DeckLink disp.: rewritte scheduled playback
video only, audio support will be readded later

Rewritten scheduled playback - instead of pushing the frames and guessing
the playback time as it has been before, store the frames inside and let
the completition callback pull when needed.
2023-07-18 11:09:07 +02:00
Martin Pulec
817f7c9490 DeckLink disp: frame ref must be atomic 2023-07-18 11:08:59 +02:00
Martin Pulec
85a5853848 DeckLink disp.: cleanup if init fails
missing cleanup (+ returned FALSE instead of nullptr, which is only an
aesthetic issue)
2023-07-18 11:08:20 +02:00
Martin Pulec
8a73e3b740 DeckLink cap/disp: shortcut for common opts
allow 'd[evice]', 'm[ode]', 'c[odec]' option shortcuts
2023-07-18 11:07:34 +02:00
Martin Pulec
708204bef3 DeckLink disp: refactorized
removed multi-device mode

This was perhaps no longer used by anyone and so it needlessly
complicated the code. Also if needed, there is an alternative in use of
aggregate (although more verbose), eg.:
```
uv -d aggregate -d decklink:device=0 -d decklink:device=1 -d \
        decklink:device=2 -d decklink:device=3
```
2023-07-18 11:07:00 +02:00
Martin Pulec
1624d0e624 Deck disp.: audio oveflow details only if verbose
Print overflow details (nr of samples written/dropped/buffered) only in
verbose mode. The point is that those values will differ and if there is
a moment where overflow occurs, it is better to colligate the overflow
messages into one and only to see the details in verbose mode, otherwise
the output could be flooded with the messages.
2023-06-20 16:39:25 +02:00
Martin Pulec
439eab1256 bmd_option: renamed option_write -> device_write
"option" is redundant here, because it is already in type name and using
"device" instead indicates more clearly that it gets written to the
device.
2023-05-17 11:42:05 +02:00
Martin Pulec
72df5c0c79 bmd_option::option_write: mod specific log prefix
When writing option log message, use module specific prefix, eg.
"[DeckLink display] " instead of just "[DeckLink] ".
2023-05-17 11:42:02 +02:00
Martin Pulec
0f37cabf1f DeckLink: allow setting string properties
eg.: bmdDeckLinkConfigDeviceInformationLabel ('dila')
2023-05-10 08:52:03 +02:00
Martin Pulec
29ac7315e0 DeckLink disp.: also allow arbitrary config setting 2023-05-10 08:52:02 +02:00
Martin Pulec
455c8542cb DeckLink cap.: allow arbitrary option
Allow passing of arbitrary option to DeckLink configuration, eg.:

    uv -t decklink:cptm=pdir

via FourCC option name and value (may be also a flag or an int). The
option is passed directly to BMD API.
2023-05-10 08:52:02 +02:00
Martin Pulec
9356dec8ab bmd: small improvements 2023-05-05 09:08:00 +02:00
Martin Pulec
a511c9f24b DeckLink disp.: turn other features into bmd_option 2023-05-05 08:50:15 +02:00
Martin Pulec
9788dcfc98 DeckLink disp.: use bmd_options also for SDI level A/B
Removed unneeded check if device supports 3G-SDI level A option - if it
doesn't, the setting would simply not succeed.
2023-05-05 08:50:15 +02:00
Martin Pulec
215ee42481 DeckLink: use bmd_option for profile_req
+ [disp] the condition `s->profile_req == bmdProfileOneSubDeviceHalfDuplex`
  was probably inverted - there should perhaps be unequality, because if
  not set otherwise, that option is set for quad-link by default
2023-05-05 08:50:15 +02:00
Martin Pulec
7aaf528c0e DeckLink disp.: set link via options
+ when setting the profile automatically, use detected/actual link
  configuration to check quad-link, not use the value set by us (may be
  set in BMD settings)
+ sort conf_name_map alphabetically
2023-05-05 08:50:14 +02:00
Martin Pulec
15483cd577 DeckLink disp.: set LowLatency opt in a usual way
Do not link bmdDeckLinkConfigLowLatencyVideoOutput with `-d decklink:low_latency`
option because these features are not necessarily related - the BMD
feature (according to the docs) is even not honored by recent devices
and doesn't have an impact on our "low_latency" (scheduled/not
scheduled) mode of operating.
2023-05-05 08:50:14 +02:00
Martin Pulec
5e4541c7e3 decklink disp.: no-low-latency fixes + deprecate
This fixes f7cc336ca - actually this change only broke the scheduled
playback, without affecting the low-latency mode (where i is always 0).
On contrary, for scheduled playback, where non-blocking is used by
default, the comparison is with 0 instead of 2 as it used to be, leading
to frequent drops.

This also reverts 00801fa3 - scheduling as currently implemented
produces last frames (actually this is not an issue - our workflow is
different than scheduled playback of steady media, that should actually
schedule next frame in completion callback).

Most importantly, deprecate the scheduled mode - not sure if used but if
someone does, we would perhaps need to know its use-case.
2023-05-05 08:50:14 +02:00
Martin Pulec
d262b21f25 BMD Windows compilation fixes 2023-05-05 08:50:14 +02:00
Martin Pulec
91374fffee DeckLink disp.: handle more opts generically
+ do not set the opts if keep option was selected
2023-05-05 08:50:14 +02:00
Martin Pulec
824efaf6ad DeckLink disp.: use bmd_options 2023-05-04 14:39:21 +02:00
Martin Pulec
399e2af275 DeckLink disp.: be less chatty
eliminate or decrease verbosity of some messages
2023-04-21 17:02:31 +02:00
Martin Pulec
69ef5c14a9 DeckLink: improved unknown option warnings
- use LOG_LEVEL_ERROR also for capture
- since passing unknown options result in exit, do not print that it is
  a warning
2023-04-20 13:19:57 +02:00