We have raw streaming data which we are decoding and rendering using MediaCodec native code on Kitkat.
Consider our video resolution is 800 X 480 and the actual video content lies in 800 X 380. The top and bottom height margin each of 50px contains black zones. Need to crop that black zones (100px) when rendering on the surface.
Tried the setRect method to crop the rectangle, but it didn't work.
Example:
int32_t left, top, right, bottom;
if (format->findRect("crop", &left, &top, &right, &bottom))
{
left = 0, top = 100, right = 800, bottom = 380;
format->setRect("crop", left, top, right, bottom);
}
Also, tried setting the crop-left, crop-right, crop-top, crop-bottom specified in Mediacodec while configuring the format, this also failed to crop. Example:
format.setInteger("crop-left", 0);
format.setInteger("crop-top", 100);
format.setInteger("crop-right", 800);
format.setInteger("crop-bottom", 380);
Can you please suggest a method to crop the video so that the cropped video can be rendered on the surface.