Draft: [RFC] Subpicture in black bars
This branch is a work in progress version of the SPU in black bars support. It is based on !3990 (merged). There's a version of D3D11 and wingdi that support the feature.
There is a new option "spu-fill"
(on by default for now) which tells the core if the SPUs should be within the source picture boundaries, or can fill the whole display area.
There are 2 variants that need to be handled separately:
- display modules that blend the SPUs
In this case the changes are mostly in the core where the placement of each SPU is modified to take in account the display width. However it seems the display modules are currently adjusting the region location to fit inside the picture area. So they will likely all need to be modified not to do that when filling the window.
- display modules that rely on the core
In this case the blending is done in the core. In this mode the blending is done on a picture that has the whole window size. The chroma of that picture depends if the blending is done before or after the display converter. The actual picture to display over is handled as a SPU picture that will be stretched and blending in the output picture.
In this mode we also need to tell the vd->source size changed every time the window is resized, as the display module will receive a picture with the size of the window. When that happens the display modules should tell which format it expects on the inside. This is currently handled via a call to update_format()
(a.k.a. set_source_format) and reset_pictures()
(a.k.a. get_input_format).
design RFC
It is clear that all display modules will need to be changed to support this. We can make it opt-in for now with a flag and and the feature little by little.
There's a lot of additions in the core to keep track of the video format that is presented to the display module, especially when the blending is done in the core. This code is also used when doing snapshots for all modules. So the blending will take in account the size of the display. This is not what the current snapshot does and it may not what we want at all. If we want to keep the snapshot (which doesn't contain OSD's) within the picture limits, we will need some additional code.
All modules that don't do blending will now need to implement reset_pictures()
. Otherwise that means we need to restart the module each time the window is resized.
I expanded the use of update_format
to be called whenever the source dimensions changed (currently only use when only the chroma changes). I get the new format to use through that call (similar to how it is received during the Open callback). But reset_picture
may just replace that. We could also turn these calls into VOUT_DISPLAY_CHANGE_xxx
calls.
Instead of blending the picture as a SPU, maybe it's possible to resize it and place it with just a filter (swscale) which may simplify the code a bit and allow custom placement.
current limitations
- only D3D11 and windgdi for now
- placement of the picture in CPU blending is not 100% correct
- the SPUs are zoomed when the window gets bigger, their size should remain the same
- fixed position SPU (DVD) is untested (unreliable as long as the source picture is not 100% accurate)
- rotated pictures is untested (CPU blending means we have to do the rotation before blending)
- cropping/aspect ratio changes of the source picture is untested (likely not working)