Rockchip: ffmpeg: Remove patch which has been moved to common patch collection

This commit is contained in:
Jernej Skrabec 2022-01-24 18:30:09 +01:00
parent 504942b470
commit 71e0f68d73

View File

@ -1,66 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Alex Bee <knaerzche@gmail.com>
Date: Sun, 19 Sep 2021 13:10:55 +0200
Subject: [PATCH] v4l2_request: validate supported framesizes
Signed-off-by: Alex Bee <knaerzche@gmail.com>
---
libavcodec/v4l2_request.c | 38 +++++++++++++++++++++++++++++++++++++-
1 file changed, 37 insertions(+), 1 deletion(-)
diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c
index a8f0ee79ee..2fbe166341 100644
--- a/libavcodec/v4l2_request.c
+++ b/libavcodec/v4l2_request.c
@@ -376,6 +376,42 @@ int ff_v4l2_request_decode_frame(AVCodecContext *avctx, AVFrame *frame, struct v
return v4l2_request_queue_decode(avctx, frame, control, count, 1, 1);
}
+static int v4l2_request_try_framesize(AVCodecContext *avctx, uint32_t pixelformat)
+{
+ V4L2RequestContext *ctx = avctx->internal->hwaccel_priv_data;
+ struct v4l2_frmsizeenum frmsize = {
+ .index = 0,
+ .pixel_format = pixelformat,
+ };
+
+ if (ioctl(ctx->video_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) < 0)
+ return 0;
+
+ /*
+ * We only validate min/max framesize for V4L2_FRMSIZE_TYPE_STEPWISE here, since the alignment
+ * which is eventually needed will be done driver-side later in VIDIOC_S_FMT and there is no need
+ * validate step_width/step_height here
+ */
+
+ do {
+
+ if (frmsize.type == V4L2_FRMSIZE_TYPE_DISCRETE && frmsize.discrete.width == avctx->coded_width &&
+ frmsize.discrete.height == avctx->coded_height)
+ return 0;
+ else if ((frmsize.type == V4L2_FRMSIZE_TYPE_STEPWISE || frmsize.type == V4L2_FRMSIZE_TYPE_CONTINUOUS) &&
+ avctx->coded_width >= frmsize.stepwise.min_width && avctx->coded_height >= frmsize.stepwise.min_height &&
+ avctx->coded_width <= frmsize.stepwise.max_width && avctx->coded_height <= frmsize.stepwise.max_height)
+ return 0;
+
+ frmsize.index++;
+
+ } while (ioctl(ctx->video_fd, VIDIOC_ENUM_FRAMESIZES, &frmsize) >= 0);
+
+ av_log(avctx, AV_LOG_INFO, "%s: pixelformat %u not supported for width %u height %u\n", __func__, pixelformat, avctx->coded_width, avctx->coded_height);
+
+ return -1;
+}
+
static int v4l2_request_try_format(AVCodecContext *avctx, enum v4l2_buf_type type, uint32_t pixelformat)
{
V4L2RequestContext *ctx = avctx->internal->hwaccel_priv_data;
@@ -404,7 +440,7 @@ static int v4l2_request_try_format(AVCodecContext *avctx, enum v4l2_buf_type typ
while (ioctl(ctx->video_fd, VIDIOC_ENUM_FMT, &fmtdesc) >= 0) {
if (fmtdesc.pixelformat == pixelformat)
- return 0;
+ return v4l2_request_try_framesize(avctx, pixelformat);
fmtdesc.index++;
}