video/image_writer: tag bits_per_raw_sample when pixfmt changes #16161
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This populates the AVCodecContext->bits_per_raw_sample field value when the pixel format of the screenshot being written doesn't match the pixel format of the original video. For example, if the original video was 10-bit and the screenshot is 16-bit, it populates this field so the encoder can make use of it.
Currently libjxl and png encoders are known to accept this tag and set the corresponding metadata (via BitDepthHeader, or sBIT).
This feature is only enabled if screenshot-sw=yes is enabled, because screenshots from a hardware buffer are always natively at max-depth.
Note: Duplicate of #11247 which was closed because of branch delete shenanigans I renamed the branch and this is a new PR after the comments in that one.