C2VEA: handle format IMPLEMENTATION_DEFINED on component's end

IMPLEMENTATION_DEFINED is a special format for encoder input frames which is
backed by gralloc.In ChromeOS, IMPLEMENTATION_DEFINED may be backed by
YCBCR_420_888 or RGBX_8888. As for C2AllocationGralloc::map(), any unrecognized
format will be regarded as YCBCR_420_888.

In YUV-backed case, C2AllocationGralloc::map() could map and provide layout
correctly. However in RGB-backed case, map() would fail and the caller will get
an empty layout instance.

ImplDefinedToRGBXMap can provide the layout for RGB-backed
IMPLEMENTATION_DEFINED format case. When the instance is created, it will own
the GraphicBuffer wrapped from input block and lock it, to provide the address,
offset, and rowInc information. The GraphicBuffer will be unlocked and released
under destruction.

Bug: 73059339
Test: android.media.cts.MediaRecorderTest#testSurfaceRecording
Change-Id: Iae8112e9dc8c30d2f0a08ae2a4cc0d7fb9db1c03
(cherry picked from commit 28ae20917491a301ed0122e280ddbb4152151cb2)
4 files changed