mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
Merge pull request #8356 from Kwiboo/ffmpeg-v4l2-request-6.0.1
ffmpeg: update v4l2-request patch
This commit is contained in:
commit
db968f95d7
@ -121,6 +121,8 @@ pre_configure_target() {
|
||||
|
||||
if [ "${FFMPEG_TESTING}" = "yes" ]; then
|
||||
PKG_FFMPEG_TESTING="--enable-encoder=wrapped_avframe --enable-muxer=null"
|
||||
PKG_FFMPEG_TESTING+=" --enable-encoder=rawvideo --enable-muxer=rawvideo"
|
||||
PKG_FFMPEG_TESTING+=" --enable-muxer=image2 --enable-muxer=md5 --enable-muxer=framemd5"
|
||||
if [ "${PROJECT}" = "RPi" ]; then
|
||||
PKG_FFMPEG_TESTING+=" --enable-vout-drm --enable-outdev=vout_drm"
|
||||
fi
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,115 +0,0 @@
|
||||
From d748cee3aa69b12056fc53c2c48bb866c110f53f Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@gmail.com>
|
||||
Date: Mon, 9 Oct 2023 22:19:18 +0200
|
||||
Subject: [PATCH] v4l2 request api: add new codecs
|
||||
|
||||
---
|
||||
libavcodec/v4l2_request.c | 43 ++++++++++++++++++++++++++++++++++-----
|
||||
1 file changed, 38 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/libavcodec/v4l2_request.c b/libavcodec/v4l2_request.c
|
||||
index 8777834c539f..ceca298956f7 100644
|
||||
--- a/libavcodec/v4l2_request.c
|
||||
+++ b/libavcodec/v4l2_request.c
|
||||
@@ -38,6 +38,14 @@
|
||||
#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0')
|
||||
#endif
|
||||
|
||||
+#ifndef V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT
|
||||
+#define V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT fourcc_code('A', 'S', '1', '2')
|
||||
+#endif
|
||||
+
|
||||
+#ifndef V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT
|
||||
+#define V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT fourcc_code('A', 'S', '0', '1')
|
||||
+#endif
|
||||
+
|
||||
uint64_t ff_v4l2_request_get_capture_timestamp(AVFrame *frame)
|
||||
{
|
||||
V4L2RequestDescriptor *req = (V4L2RequestDescriptor*)frame->data[0];
|
||||
@@ -190,6 +198,9 @@ static int v4l2_request_dequeue_buffer(V4L2RequestContext *ctx, V4L2RequestBuffe
|
||||
}
|
||||
|
||||
const uint32_t v4l2_request_capture_pixelformats[] = {
|
||||
+ V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT,
|
||||
+ V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT,
|
||||
+ V4L2_PIX_FMT_P010,
|
||||
V4L2_PIX_FMT_NV12,
|
||||
#ifdef DRM_FORMAT_MOD_ALLWINNER_TILED
|
||||
V4L2_PIX_FMT_SUNXI_TILED_NV12,
|
||||
@@ -210,6 +221,10 @@ static int v4l2_request_set_drm_descriptor(V4L2RequestDescriptor *req, struct v4
|
||||
uint32_t pixelformat = V4L2_TYPE_IS_MULTIPLANAR(format->type) ? format->fmt.pix_mp.pixelformat : format->fmt.pix.pixelformat;
|
||||
|
||||
switch (pixelformat) {
|
||||
+ case V4L2_PIX_FMT_P010:
|
||||
+ layer->format = DRM_FORMAT_P010;
|
||||
+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
+ break;
|
||||
case V4L2_PIX_FMT_NV12:
|
||||
layer->format = DRM_FORMAT_NV12;
|
||||
desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
@@ -236,6 +251,18 @@ static int v4l2_request_set_drm_descriptor(V4L2RequestDescriptor *req, struct v4
|
||||
desc->objects[0].format_modifier = DRM_FORMAT_MOD_LINEAR;
|
||||
break;
|
||||
#endif
|
||||
+ case V4L2_PIX_FMT_YUV420_10_AFBC_16X16_SPLIT:
|
||||
+ layer->format = DRM_FORMAT_YUV420_10BIT;
|
||||
+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
+ AFBC_FORMAT_MOD_SPARSE |
|
||||
+ AFBC_FORMAT_MOD_SPLIT);
|
||||
+ break;
|
||||
+ case V4L2_PIX_FMT_YUV420_8_AFBC_16X16_SPLIT:
|
||||
+ layer->format = DRM_FORMAT_YUV420_8BIT;
|
||||
+ desc->objects[0].format_modifier = DRM_FORMAT_MOD_ARM_AFBC(AFBC_FORMAT_MOD_BLOCK_SIZE_16x16 |
|
||||
+ AFBC_FORMAT_MOD_SPARSE |
|
||||
+ AFBC_FORMAT_MOD_SPLIT);
|
||||
+ break;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
@@ -245,15 +272,18 @@ static int v4l2_request_set_drm_descriptor(V4L2RequestDescriptor *req, struct v4
|
||||
desc->objects[0].size = req->capture.size;
|
||||
|
||||
desc->nb_layers = 1;
|
||||
- layer->nb_planes = 2;
|
||||
+ layer->nb_planes = 1;
|
||||
|
||||
layer->planes[0].object_index = 0;
|
||||
layer->planes[0].offset = 0;
|
||||
layer->planes[0].pitch = V4L2_TYPE_IS_MULTIPLANAR(format->type) ? format->fmt.pix_mp.plane_fmt[0].bytesperline : format->fmt.pix.bytesperline;
|
||||
|
||||
- layer->planes[1].object_index = 0;
|
||||
- layer->planes[1].offset = layer->planes[0].pitch * (V4L2_TYPE_IS_MULTIPLANAR(format->type) ? format->fmt.pix_mp.height : format->fmt.pix.height);
|
||||
- layer->planes[1].pitch = layer->planes[0].pitch;
|
||||
+ if (desc->objects[0].format_modifier == DRM_FORMAT_MOD_LINEAR) {
|
||||
+ layer->nb_planes = 2;
|
||||
+ layer->planes[1].object_index = 0;
|
||||
+ layer->planes[1].offset = layer->planes[0].pitch * (V4L2_TYPE_IS_MULTIPLANAR(format->type) ? format->fmt.pix_mp.height : format->fmt.pix.height);
|
||||
+ layer->planes[1].pitch = layer->planes[0].pitch;
|
||||
+ }
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1019,16 +1049,19 @@ int ff_v4l2_request_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_c
|
||||
{
|
||||
V4L2RequestContext *ctx = avctx->internal->hwaccel_priv_data;
|
||||
AVHWFramesContext *hwfc = (AVHWFramesContext*)hw_frames_ctx->data;
|
||||
+ uint32_t pixelformat;
|
||||
|
||||
hwfc->format = AV_PIX_FMT_DRM_PRIME;
|
||||
- hwfc->sw_format = AV_PIX_FMT_NV12;
|
||||
if (V4L2_TYPE_IS_MULTIPLANAR(ctx->format.type)) {
|
||||
hwfc->width = ctx->format.fmt.pix_mp.width;
|
||||
hwfc->height = ctx->format.fmt.pix_mp.height;
|
||||
+ pixelformat = ctx->format.fmt.pix_mp.pixelformat;
|
||||
} else {
|
||||
hwfc->width = ctx->format.fmt.pix.width;
|
||||
hwfc->height = ctx->format.fmt.pix.height;
|
||||
+ pixelformat = ctx->format.fmt.pix.pixelformat;
|
||||
}
|
||||
+ hwfc->sw_format = pixelformat == V4L2_PIX_FMT_P010 ? AV_PIX_FMT_P010LE : AV_PIX_FMT_NV12;
|
||||
|
||||
hwfc->pool = av_buffer_pool_init2(sizeof(V4L2RequestDescriptor), avctx, v4l2_request_frame_alloc, v4l2_request_pool_free);
|
||||
if (!hwfc->pool)
|
||||
--
|
||||
2.42.0
|
||||
|
Loading…
x
Reference in New Issue
Block a user