On Sat, 2022-11-19 at 00:20 -0800, Aman Karmani wrote: > Thank you for your work on this patchset! > > On Sun, Oct 23, 2022 at 8:17 PM Zhao Zhili <quinkbl...@foxmail.com> > wrote: > > From: Zhao Zhili <zhiliz...@tencent.com> > > > > The crop info is optional, but used unconditionally. > > > > Signed-off-by: Zhao Zhili <zhiliz...@tencent.com> > > --- > > libavcodec/mediacodecdec_common.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/libavcodec/mediacodecdec_common.c > > b/libavcodec/mediacodecdec_common.c > > index 2a605e7f5b..c1cbb28488 100644 > > --- a/libavcodec/mediacodecdec_common.c > > +++ b/libavcodec/mediacodecdec_common.c > > @@ -487,6 +487,11 @@ static int > > mediacodec_dec_parse_format(AVCodecContext *avctx, > > MediaCodecDecConte > > AMEDIAFORMAT_GET_INT32(s->crop_left, "crop-left", 0); > > AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0); > > > > + if (s->crop_bottom == 0 || s->crop_right == 0) { > > + s->crop_top = s->crop_left = 0; > > + s->crop_right = s->width - 1; > > + s->crop_bottom = s->height - 1; > > + } > > width = s->crop_right + 1 - s->crop_left; > > height = s->crop_bottom + 1 - s->crop_top; > > I had another approach I have been using for some time. WDYT? > > http://github.com/tmm1/ffmpeg/commit/ebc0ef75d25e712278c34427ef2f7d42f3dcf883
I found the issue when testing NDK mediacodec. There is no 'crop-left', 'crop-right' and so on. However, there is a 'crop' field in AMediaForma t, for example: android._video-scaling: int32(1), crop: Rect(0, 0, 1919, 1079), color- standard: int32(1), ... Unfortunately, it's available only since API level 28: ------------------------------------------------ extern const char* AMEDIAFORMAT_KEY_DISPLAY_CROP __INTRODUCED_IN(28); /** * Available since API level 28. */ bool AMediaFormat_getRect(AMediaFormat*, const char *name, int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) __INTRODUCED_IN(28); ------------------------------------------------- So we need to add a new API in mediacodec_wrapper first, then extract crop info. It's on my TODO list. For your patch, + AMEDIAFORMAT_GET_INT32(width, "crop-width", 0); + AMEDIAFORMAT_GET_INT32(height, "crop-height", 0); I can't find documention about these fields, and they didn't show on Google Pixel 3. What's the device model? We can use it as a fallback, after crop-left/crop-right and crop rect failed. > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".