Enforce the restart of VideoToolbox when a data / codec error happens.
Usually, it was triggering a fallback (typically on avcodec) every time
an error happened within the played stream, which can happen when
corrupting the input stream.
It was done to protect the decoder against non-playable files for which
the decoder would announce the support but would not be able to decode a
single frame ever. VideoToolbox seems to behave correctly on those files
now so we can make it a default.
Remove the picture flushing workaround since the described behaviour is
obsolete after 34a548cc02, which flushes
the pictures from the video output before flushing the decoder.
It also ensures that we don't call decoder_UpdateVideoFormat which will
update the video output without video context, leading to potential
spurrious failures with OpenGL interop expecting one.
Co-authored-by: Alexandre Janniaux <ajanni@videolabs.io>
We don't need to know it's a pointer and can save 2 characters.
No functional changes. This is simply renaming "dec->p_fmt_in",
"decoder->p_fmt_in", "dec.p_fmt_in" and "packetizer->p_fmt_in"
The kVTVideoDecoderReferenceMissingErr error is not a critical one,
but without it being handled here, it would lead to aborting with
VideoToolbox and falling back to Software.
Reproduced this with a sample provided by zhilizhao(赵志立),
related to !1790.
I assume that before this error code was introduced in macOS 12/iOS 15,
VT did just return the NULL image buffer with a success status code,
leading to the issue seen in !1790.
1. Videotoolbox doesn't handle codec info. It do crop the right
and bottom side if codec_size > output_size
2. There is no API to configure i_x_offset/i_y_offset to videotoolbox
3. It was a bug to let videotoolbox to crop and don't reset
i_x_offset/i_y_offset.
see e967f81f6a.
note, this does **not** affect cat-based module selection items
(of which there are just three in use by the core), since that
mechanism uses subcats not cats.
The config "advanced" flag was unused and has been removed by
6a7a137f7b.
It has been removed from many add_*() macros, but not all. Remove it
from the remaining macros.
- Force BGRA on macbooks not handling HEVC. This was done automatically
before but it will likely change in the future like iOS.
- Also force BGRA for 12 and 16bits since the openGL* implementation
can't handle it.
iOS 14 adds support for 10bits YUV output. Unfortunately, it can only be
rendered with Metal (since the Apple OpenGLES implementation doesn't
expose 16bits textures), so force BGRA output for now (waiting for a
possible MetalAngle integration?).