wrappercamerabinsrc: Rework cropping for zoom and dimension reduction
wrappercamerabinsrc has a videocrop element to be used for zooming and for cropping when input caps is different when used with the GstPhotography interface. The zooming part needs the following elements: capsfilter ! videocrop ! videoscale ! capsfilter The capsfilters should always have the same caps to ensure the zooming is done and preserves dimensions, unless when it is needed to do more cropping due to input dimensions those caps need to be modified accordingly to preserve the output dimensions. This, however, makes it hard to get caps negotiation to work properly as we need to have different caps in the capsfilters to account for the extra cropping needed. It could be simple for fixed caps but it gets tricky with unfixed ones. To solve this, this patch splits the zooming and dimension reduction cropping into 2 separate videocrop elements. The first one does the dimension cropping, which is only needed when the GstPhotography API is used and the source provides a caps that is different than what is requested, while the second is dedicated to zoom crop only. The first part of the pipeline goes from: src ! videoconvert ! capsfilter ! videocrop ! videoscale ! capsfilter to src ! videocrop ! videoconvert ! capsfilter ! videocrop ! videoscale ! capsfilter It might add an extra overhead in the image capture as the image might need to be cropped twice but this can be solved by enabling videocrop to use crop metas so only the later one does the real cropping. It also makes the code a bit simpler.
Showing with 30 additions and 43 deletions