The previous commit sets the default configuration to 2 seconds, meaning
that the 0 second default interval no longer happens per default. If
someone explicitly sets the interval to 0 seconds ("auto"), we should
allow them to do that.
0 seconds means "auto" according to the documentation, but this appears
to be broken in many configurations (more than just CRF mode on Apple
Silicon). With some encoders it means that the encoder sets a keyframes
every 31st frame, other times it just doesn't set any keyframes at all
after the first one, only rarely does the "auto" interval actually
appear to work.
Lets just set the default to 2 seconds and be happy. In theory this is
the maximum keyframe interval and encoders are allowed to set more if
they so wish, but they never appear to do so.
8dd20dfd33 introduced an explicit check
for the available macOS SDK, meaning that we can be sure that the macOS
13.1 SDK is available. As such, we do not require ifdef guards for the
availability of functions that are older than 13.1.
Creation of Info.plist files through Xcode is more canonical and
future-proof, as it will automatically pick up changes/updates
introduced by Apple. Non-standard keys can still be added via a
template file, which will then be extended by Xcode with the default
keys.
The format is only checked for 10-bit capable formats, which in this
case applies to HEVC only. When HEVC is disabled, then `format` is
not checked and becomes an unused variable otherwise.
Existing code made use of macros which broke parsing in Xcode and
complicated debugging as crucial code was executed within macros and
not actual source code.
Use of mutable CoreFramework data structures (which were never mutated)
is replaced by use of faster non-mutable variants.
When an allocator needs to be used, `kCFAllocatorDefault` is specified
explicitly.
VideoToolbox session properties are also set in bulk instead of
multiple consecutive calls.
Also simplifies detection of Apple Silicon hosts to make code more
readable.
Copying the encoder list takes a while which blocks the main thread.
Doing the copying asynchronously removes instead of blocking the main
thread improves startup performance by about 60ms.
Both rate control methods only work on hardware encoders and will error
out when selected for software encoders, so we shouldn't show them there
Co-Authored-By: Sebastian Beckmann <beckmann.sebastian@outlook.de>
The session_set_bitrate method already returns an OSStatus to confirm
that everything has been successful. As such, a second check to make
sure that the bitrate has indeed changed is redundant and only adds
unnecessary code.