Merge pull request #9569 from HiassofT/le13-ffmpeg-7.1

ffmpeg: update to 7.1
This commit is contained in:
knaerzche 2024-12-22 22:53:00 +01:00 committed by GitHub
commit abb3db99c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 24678 additions and 41077 deletions

View File

@ -3,8 +3,8 @@
# Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ffmpeg"
PKG_VERSION="6.0.1"
PKG_SHA256="9b16b8731d78e596b4be0d720428ca42df642bb2d78342881ff7f5bc29fc9623"
PKG_VERSION="7.1"
PKG_SHA256="40973d44970dbc83ef302b0609f2e74982be2d85916dd2ee7472d30678a7abe6"
PKG_LICENSE="GPL-3.0-only"
PKG_SITE="https://ffmpeg.org"
PKG_URL="http://ffmpeg.org/releases/ffmpeg-${PKG_VERSION}.tar.xz"
@ -14,9 +14,9 @@ PKG_PATCH_DIRS="libreelec"
case "${PROJECT}" in
Amlogic)
PKG_VERSION="9011d22fed1834cb7bd946349cc8a5eda748eec7"
PKG_FFMPEG_BRANCH="dev/6.0/rpi_import_1"
PKG_SHA256="35b6b84a3e6542a4d96f9a0537c8dbf95176cc07452b0a63339a44b1590bf5f2"
PKG_VERSION="5f39f6c33638de22605b16ec8dc1898135b09bb0"
PKG_FFMPEG_BRANCH="test/7.1/main"
PKG_SHA256="f432ea06ef9414ba26cccb95287f00718e12b5ad27c9079fc0c0cefc4b4a2325"
PKG_URL="https://github.com/jc-kynesim/rpi-ffmpeg/archive/${PKG_VERSION}.tar.gz"
;;
RPi)
@ -175,11 +175,6 @@ configure_target() {
--disable-gray \
--enable-swscale-alpha \
--disable-small \
--enable-dct \
--enable-fft \
--enable-mdct \
--enable-rdft \
--disable-crystalhd \
${PKG_FFMPEG_V4L2} \
${PKG_FFMPEG_VAAPI} \
${PKG_FFMPEG_VDPAU} \

View File

@ -1,4 +1,4 @@
From 2836d9b400c063b4332cdf6bb6f1a3719822eaed Mon Sep 17 00:00:00 2001
From f3b90efacf67fb8e8ed07654a6c3f1bd807002a3 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 10 Apr 2019 13:39:21 -0700
Subject: [PATCH 1/2] libavcodec/libdav1d: add libdav1d_get_format method to
@ -18,10 +18,10 @@ decoding is properly activated.
1 file changed, 11 insertions(+)
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 2488a709c7..48c8658a22 100644
index 546b42e9c622..378231485900 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -64,6 +64,16 @@ static const enum AVPixelFormat pix_fmt_rgb[3] = {
@@ -69,6 +69,16 @@ static const enum AVPixelFormat pix_fmt_rgb[3] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12,
};
@ -38,7 +38,7 @@ index 2488a709c7..48c8658a22 100644
static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl)
{
AVCodecContext *c = opaque;
@@ -424,6 +434,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
@@ -424,6 +434,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
if (res < 0)
goto fail;
@ -47,7 +47,7 @@ index 2488a709c7..48c8658a22 100644
frame->height = p->p.h;
if (c->width != p->p.w || c->height != p->p.h) {
From 19913e020c8760e8a760439a07bcb50273643324 Mon Sep 17 00:00:00 2001
From 74d85efbbd5c9e92e7967d0a0200c41d8ce8a88e Mon Sep 17 00:00:00 2001
From: chewitt <github@chrishewitt.net>
Date: Sun, 11 Aug 2019 07:08:19 +0000
Subject: [PATCH 2/2] add long-term yuv2rgb logging patch
@ -57,10 +57,10 @@ Subject: [PATCH 2/2] add long-term yuv2rgb logging patch
1 file changed, 4 deletions(-)
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 9c3f5e23c6..2a10527365 100644
index 52fe2093e7b1..b04934071542 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -690,10 +690,6 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
@@ -573,10 +573,6 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
if (t)
return t;
@ -68,6 +68,6 @@ index 9c3f5e23c6..2a10527365 100644
- "No accelerated colorspace conversion found from %s to %s.\n",
- av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat));
-
if (c->srcFormat == AV_PIX_FMT_YUV422P) {
switch (c->dstFormat) {
case AV_PIX_FMT_BGR48BE:
case AV_PIX_FMT_BGR48LE:

View File

@ -1,52 +0,0 @@
From 0b541aa54b9573d8eef7401a0cc58c422fe60a9a Mon Sep 17 00:00:00 2001
From: Ross Burton <ross.burton@arm.com>
Date: Thu, 8 Aug 2024 18:04:17 +0100
Subject: [PATCH] libavcodec/arm/mlpdsp_armv5te: fix label format to work with
binutils 2.43
binutils 2.43 has stricter validation for labels[1] and results in errors
when building ffmpeg for armv5:
src/libavcodec/arm/mlpdsp_armv5te.S:232: Error: junk at end of line, first unrecognized character is `0'
Remove the leading zero in the "01" label to resolve this error.
[1] https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=226749d5a6ff0d5c607d6428d6c81e1e7e7a994b
Upstream-Status: Submitted [https://ffmpeg.org//pipermail/ffmpeg-devel/2024-August/332149.html]
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
libavcodec/arm/mlpdsp_armv5te.S | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/arm/mlpdsp_armv5te.S b/libavcodec/arm/mlpdsp_armv5te.S
index 4f9aa48..d315686 100644
--- a/libavcodec/arm/mlpdsp_armv5te.S
+++ b/libavcodec/arm/mlpdsp_armv5te.S
@@ -229,7 +229,7 @@ A .endif
.endif
// Begin loop
-01:
+1:
.if TOTAL_TAPS == 0
// Things simplify a lot in this case
// In fact this could be pipelined further if it's worth it...
@@ -241,7 +241,7 @@ A .endif
str ST0, [PST, #-4]!
str ST0, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
str ST0, [PSAMP], #4 * MAX_CHANNELS
- bne 01b
+ bne 1b
.else
.if \fir_taps & 1
.set LOAD_REG, 1
@@ -333,7 +333,7 @@ T orr AC0, AC0, AC1
str ST3, [PST, #-4]!
str ST2, [PST, #4 * (MAX_BLOCKSIZE + MAX_FIR_ORDER)]
str ST3, [PSAMP], #4 * MAX_CHANNELS
- bne 01b
+ bne 1b
.endif
b 99f

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
From d08054c6eb2bb041e554b9fa24013d521f7ff024 Mon Sep 17 00:00:00 2001
From cf29d984c17f56df0e41f33fb28fe72160cc7869 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Tue, 24 Apr 2018 23:00:23 -0700
Subject: [PATCH 1/8] libavcodec: v4l2m2m: output AVDRMFrameDescriptor
@ -42,7 +42,7 @@ V5:
5 files changed, 213 insertions(+), 12 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 3f5471067a..07662b5fc3 100644
index 23474ee143..0013f54caa 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -21,6 +21,7 @@
@ -53,15 +53,15 @@ index 3f5471067a..07662b5fc3 100644
#include <linux/videodev2.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
@@ -29,6 +30,7 @@
@@ -28,6 +29,7 @@
#include <fcntl.h>
#include <poll.h>
#include "libavcodec/avcodec.h"
#include "libavutil/pixdesc.h"
+#include "libavutil/hwcontext.h"
#include "libavutil/pixdesc.h"
#include "refstruct.h"
#include "v4l2_context.h"
#include "v4l2_buffers.h"
#include "v4l2_m2m.h"
@@ -209,7 +211,79 @@ static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf)
@@ -210,7 +212,79 @@ static enum AVColorTransferCharacteristic v4l2_get_color_trc(V4L2Buffer *buf)
return AVCOL_TRC_UNSPECIFIED;
}
@ -142,7 +142,7 @@ index 3f5471067a..07662b5fc3 100644
{
V4L2Buffer* avbuf = opaque;
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
@@ -233,6 +307,36 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
@@ -234,6 +308,36 @@ static void v4l2_free_buffer(void *opaque, uint8_t *unused)
}
}
@ -179,7 +179,7 @@ index 3f5471067a..07662b5fc3 100644
static int v4l2_buf_increase_ref(V4L2Buffer *in)
{
V4L2m2mContext *s = buf_to_m2mctx(in);
@@ -253,6 +357,24 @@ static int v4l2_buf_increase_ref(V4L2Buffer *in)
@@ -252,6 +356,24 @@ static int v4l2_buf_increase_ref(V4L2Buffer *in)
return 0;
}
@ -204,7 +204,7 @@ index 3f5471067a..07662b5fc3 100644
static int v4l2_buf_to_bufref(V4L2Buffer *in, int plane, AVBufferRef **buf)
{
int ret;
@@ -302,13 +424,24 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
@@ -301,13 +423,24 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
frame->format = avbuf->context->av_pix_fmt;
@ -260,18 +260,18 @@ index 3f5471067a..07662b5fc3 100644
}
diff --git a/libavcodec/v4l2_buffers.h b/libavcodec/v4l2_buffers.h
index 3d2ff1b9a5..b82c990dcc 100644
index e35b161309..b83f22152c 100644
--- a/libavcodec/v4l2_buffers.h
+++ b/libavcodec/v4l2_buffers.h
@@ -30,6 +30,7 @@
@@ -29,6 +29,7 @@
#include <linux/videodev2.h>
#include "libavutil/buffer.h"
#include "libavutil/frame.h"
+#include "libavutil/hwcontext_drm.h"
#include "packet.h"
enum V4L2Buffer_status {
@@ -45,6 +46,9 @@ typedef struct V4L2Buffer {
@@ -44,6 +45,9 @@ typedef struct V4L2Buffer {
/* each buffer needs to have a reference to its context */
struct V4L2Context *context;
@ -279,13 +279,13 @@ index 3d2ff1b9a5..b82c990dcc 100644
+ AVDRMFrameDescriptor drm_frame;
+
/* This object is refcounted per-plane, so we need to keep track
* of how many context-refs we are holding. */
AVBufferRef *context_ref;
* of how many context-refs we are holding.
* This pointer is a RefStruct reference. */
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a40be94690..5bbab77c1e 100644
index be1df3785b..4673d025c5 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -441,22 +441,54 @@ static int v4l2_release_buffers(V4L2Context* ctx)
@@ -446,22 +446,54 @@ static int v4l2_release_buffers(V4L2Context* ctx)
struct v4l2_requestbuffers req = {
.memory = V4L2_MEMORY_MMAP,
.type = ctx->type,
@ -345,7 +345,7 @@ index a40be94690..5bbab77c1e 100644
static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfmt)
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
index 04d86d7b92..4251efcb86 100644
index 4ba33dc335..76ddbf1a26 100644
--- a/libavcodec/v4l2_m2m.h
+++ b/libavcodec/v4l2_m2m.h
@@ -66,6 +66,9 @@ typedef struct V4L2m2mContext {
@ -359,7 +359,7 @@ index 04d86d7b92..4251efcb86 100644
typedef struct V4L2m2mPriv {
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 4944d08511..9a2b922fb1 100644
index aa2d759e1e..b8dc4eb81f 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -23,6 +23,9 @@
@ -410,18 +410,18 @@ index 4944d08511..9a2b922fb1 100644
#define M2MDEC_CLASS(NAME) \
static const AVClass v4l2_m2m_ ## NAME ## _dec_class = { \
.class_name = #NAME "_v4l2m2m_decoder", \
@@ -254,6 +274,9 @@ static const AVOption options[] = {
.p.capabilities = AV_CODEC_CAP_HARDWARE | AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING, \
@@ -255,6 +275,9 @@ static const AVOption options[] = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \
FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
+ .p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \
+ AV_PIX_FMT_NONE}, \
+ .hw_configs = v4l2_m2m_hw_configs, \
.p.wrapper_name = "v4l2m2m", \
}
M2MDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb");
From bb9db9b85e0f1c99a4b6cd9bea2d86ce64af05b5 Mon Sep 17 00:00:00 2001
From b1c53282fe4a9357f5a74feebd5a4c01954930b3 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 16 Aug 2018 21:09:40 -0700
Subject: [PATCH 2/8] libavcodec: v4l2m2m: depends on libdrm
@ -432,10 +432,10 @@ Subject: [PATCH 2/8] libavcodec: v4l2m2m: depends on libdrm
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/configure b/configure
index b6616f00b6..09a824a579 100755
index d77a55b653..9db1921b99 100755
--- a/configure
+++ b/configure
@@ -3549,6 +3549,7 @@ sndio_indev_deps="sndio"
@@ -3746,6 +3746,7 @@ sndio_indev_deps="sndio"
sndio_outdev_deps="sndio"
v4l2_indev_deps_any="linux_videodev2_h sys_videoio_h"
v4l2_indev_suggest="libv4l2"
@ -444,7 +444,7 @@ index b6616f00b6..09a824a579 100755
v4l2_outdev_suggest="libv4l2"
vfwcap_indev_deps="vfw32 vfwcap_defines"
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 07662b5fc3..d41558527c 100644
index 0013f54caa..9069520556 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -21,7 +21,7 @@
@ -457,7 +457,7 @@ index 07662b5fc3..d41558527c 100644
#include <sys/ioctl.h>
#include <sys/mman.h>
From 22928b7f1ae1054f303a50c60f9fc5f5d0c7c08b Mon Sep 17 00:00:00 2001
From 659318a5f802b42be23eb95cebb01cfd46cfac21 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 16 Aug 2018 21:10:13 -0700
Subject: [PATCH 3/8] libavcodec: v4l2m2m: set format_modifier to
@ -468,10 +468,10 @@ Subject: [PATCH 3/8] libavcodec: v4l2m2m: set format_modifier to
1 file changed, 2 insertions(+)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index d41558527c..95c8a1e409 100644
index 9069520556..066bf5b8c3 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -327,10 +327,12 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
@@ -328,10 +328,12 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
/* drm frame */
avbuf->drm_frame.objects[i].size = avbuf->buf.m.planes[i].length;
avbuf->drm_frame.objects[i].fd = expbuf.fd;
@ -485,7 +485,7 @@ index d41558527c..95c8a1e409 100644
}
From 87182c63602793c3310b207400bf77c8f2d0d1d8 Mon Sep 17 00:00:00 2001
From f84379aca3bff34205648e85e0c79fd544a20e39 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 16 Aug 2018 21:10:53 -0700
Subject: [PATCH 4/8] libavcodec: v4l2m2m: only mmap the buffer when it is
@ -496,7 +496,7 @@ Subject: [PATCH 4/8] libavcodec: v4l2m2m: only mmap the buffer when it is
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 95c8a1e409..0a65f32cb2 100644
index 066bf5b8c3..3a65ced497 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -661,14 +661,22 @@ int ff_v4l2_buffer_initialize(V4L2Buffer* avbuf, int index)
@ -529,7 +529,7 @@ index 95c8a1e409..0a65f32cb2 100644
if (avbuf->plane_info[i].mm_addr == MAP_FAILED)
From edc89c1d0214e9fbc3c33ea26efe9a86456931c4 Mon Sep 17 00:00:00 2001
From 6c02dc58f69365fd1f3c5502b481e0fae6987ff7 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Thu, 16 Aug 2018 21:11:38 -0700
Subject: [PATCH 5/8] libavcodec: v4l2m2m: allow using software pixel formats
@ -539,7 +539,7 @@ Subject: [PATCH 5/8] libavcodec: v4l2m2m: allow using software pixel formats
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 9a2b922fb1..11b893cc65 100644
index b8dc4eb81f..28b29c4522 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -217,8 +217,16 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx)
@ -560,16 +560,16 @@ index 9a2b922fb1..11b893cc65 100644
s->avctx = avctx;
ret = ff_v4l2_m2m_codec_init(priv);
@@ -275,6 +283,7 @@ static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = {
.caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | \
FF_CODEC_CAP_SETS_PKT_DTS | FF_CODEC_CAP_INIT_CLEANUP, \
@@ -276,6 +284,7 @@ static const AVCodecHWConfigInternal *v4l2_m2m_hw_configs[] = {
FF_CODEC_CAP_INIT_CLEANUP, \
.p.wrapper_name = "v4l2m2m", \
.p.pix_fmts = (const enum AVPixelFormat[]) { AV_PIX_FMT_DRM_PRIME, \
+ AV_PIX_FMT_NV12, \
AV_PIX_FMT_NONE}, \
.hw_configs = v4l2_m2m_hw_configs, \
.p.wrapper_name = "v4l2m2m", \
}
From 180e12f23b20ff358956fd6cb24db665535cad04 Mon Sep 17 00:00:00 2001
From 45cab2ebdbd00ce6eb683dd838956049e7fe9a3f Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Mon, 24 Sep 2018 13:39:31 -0700
Subject: [PATCH 6/8] libavcodec: v4l2m2m: implement hwcontext
@ -582,10 +582,10 @@ Subject: [PATCH 6/8] libavcodec: v4l2m2m: implement hwcontext
4 files changed, 37 insertions(+)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index 0a65f32cb2..a040d418d9 100644
index 3a65ced497..7285705857 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -434,6 +434,7 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
@@ -433,6 +433,7 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
frame->data[0] = (uint8_t *) v4l2_get_drm_frame(avbuf);
frame->format = AV_PIX_FMT_DRM_PRIME;
@ -635,7 +635,7 @@ index 6f7460c89a..02fbb6eec3 100644
/**
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
index 4251efcb86..1082b9dad2 100644
index 76ddbf1a26..47dfe0905f 100644
--- a/libavcodec/v4l2_m2m.h
+++ b/libavcodec/v4l2_m2m.h
@@ -67,6 +67,8 @@ typedef struct V4L2m2mContext {
@ -648,7 +648,7 @@ index 4251efcb86..1082b9dad2 100644
int output_drm;
} V4L2m2mContext;
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 11b893cc65..6f67aabcbd 100644
index 28b29c4522..a5dc926232 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -35,6 +35,7 @@
@ -677,7 +677,7 @@ index 11b893cc65..6f67aabcbd 100644
ret = ff_v4l2_m2m_codec_init(priv);
if (ret) {
From 8c64981ace0a08bdc7eb445125a70f691ed829cb Mon Sep 17 00:00:00 2001
From 221ed816ded7c3a2b265a7c3e8c06e320ba791fb Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Wed, 6 May 2020 11:12:58 -0700
Subject: [PATCH 7/8] libavcodec: v4l2m2m: add option to specify pixel format
@ -690,10 +690,10 @@ Subject: [PATCH 7/8] libavcodec: v4l2m2m: add option to specify pixel format
3 files changed, 12 insertions(+)
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index 5bbab77c1e..3bd1f37c75 100644
index 4673d025c5..1f1fd6d982 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -517,6 +517,8 @@ static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfm
@@ -522,6 +522,8 @@ static inline int v4l2_try_raw_format(V4L2Context* ctx, enum AVPixelFormat pixfm
static int v4l2_get_raw_format(V4L2Context* ctx, enum AVPixelFormat *p)
{
@ -702,7 +702,7 @@ index 5bbab77c1e..3bd1f37c75 100644
enum AVPixelFormat pixfmt = ctx->av_pix_fmt;
struct v4l2_fmtdesc fdesc;
int ret;
@@ -535,6 +537,13 @@ static int v4l2_get_raw_format(V4L2Context* ctx, enum AVPixelFormat *p)
@@ -540,6 +542,13 @@ static int v4l2_get_raw_format(V4L2Context* ctx, enum AVPixelFormat *p)
if (ret)
return AVERROR(EINVAL);
@ -717,7 +717,7 @@ index 5bbab77c1e..3bd1f37c75 100644
ret = v4l2_try_raw_format(ctx, pixfmt);
if (ret){
diff --git a/libavcodec/v4l2_m2m.h b/libavcodec/v4l2_m2m.h
index 1082b9dad2..943a8923c4 100644
index 47dfe0905f..7b020e2373 100644
--- a/libavcodec/v4l2_m2m.h
+++ b/libavcodec/v4l2_m2m.h
@@ -30,6 +30,7 @@
@ -728,7 +728,7 @@ index 1082b9dad2..943a8923c4 100644
#include "v4l2_context.h"
#define container_of(ptr, type, member) ({ \
@@ -81,6 +82,7 @@ typedef struct V4L2m2mPriv {
@@ -80,6 +81,7 @@ typedef struct V4L2m2mPriv {
int num_output_buffers;
int num_capture_buffers;
@ -737,7 +737,7 @@ index 1082b9dad2..943a8923c4 100644
/**
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 6f67aabcbd..279f26cbe6 100644
index a5dc926232..a8f707ba4e 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -261,6 +261,7 @@ static const AVOption options[] = {
@ -749,7 +749,7 @@ index 6f67aabcbd..279f26cbe6 100644
};
From 807bf8da5fa9f28443b5eee9429fb2478171e8f7 Mon Sep 17 00:00:00 2001
From 0e747a21c508567cd6ea615dba1a0dd85d38c076 Mon Sep 17 00:00:00 2001
From: Lukas Rusak <lorusak@gmail.com>
Date: Mon, 24 Sep 2018 13:39:56 -0700
Subject: [PATCH 8/8] libavcodec: v4l2m2m: implement flush
@ -759,7 +759,7 @@ Subject: [PATCH 8/8] libavcodec: v4l2m2m: implement flush
1 file changed, 36 insertions(+)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index 279f26cbe6..8f1dd4a886 100644
index a8f707ba4e..5f992f0e7f 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -254,6 +254,41 @@ static av_cold int v4l2_decode_close(AVCodecContext *avctx)

View File

@ -1,4 +1,4 @@
From d38cb51a9362250b53aa9c7637b17d90718f5f65 Mon Sep 17 00:00:00 2001
From accf519d251f366afbbbffb67ebac3553a3c7cbb Mon Sep 17 00:00:00 2001
From: Jernej Skrabec <jernej.skrabec@siol.net>
Date: Tue, 3 Dec 2019 21:01:18 +0100
Subject: [PATCH] Add V4L2 m2m deinterlace filter
@ -7,15 +7,15 @@ Signed-off-by: Alex Bee <knaerzche@gmail.com>
---
libavfilter/Makefile | 1 +
libavfilter/allfilters.c | 1 +
libavfilter/vf_deinterlace_v4l2m2m.c | 1009 ++++++++++++++++++++++++++
3 files changed, 1011 insertions(+)
libavfilter/vf_deinterlace_v4l2m2m.c | 1011 ++++++++++++++++++++++++++
3 files changed, 1013 insertions(+)
create mode 100644 libavfilter/vf_deinterlace_v4l2m2m.c
diff --git a/libavfilter/Makefile b/libavfilter/Makefile
index b3d3d981dd..9103e3b395 100644
index 91487afb21..84adb9ba46 100644
--- a/libavfilter/Makefile
+++ b/libavfilter/Makefile
@@ -262,6 +262,7 @@ OBJS-$(CONFIG_DEFLATE_FILTER) += vf_neighbor.o
@@ -272,6 +272,7 @@ OBJS-$(CONFIG_DEFLATE_FILTER) += vf_neighbor.o
OBJS-$(CONFIG_DEFLICKER_FILTER) += vf_deflicker.o
OBJS-$(CONFIG_DEINTERLACE_QSV_FILTER) += vf_vpp_qsv.o
OBJS-$(CONFIG_DEINTERLACE_VAAPI_FILTER) += vf_deinterlace_vaapi.o vaapi_vpp.o
@ -24,10 +24,10 @@ index b3d3d981dd..9103e3b395 100644
OBJS-$(CONFIG_DELOGO_FILTER) += vf_delogo.o
OBJS-$(CONFIG_DENOISE_VAAPI_FILTER) += vf_misc_vaapi.o vaapi_vpp.o
diff --git a/libavfilter/allfilters.c b/libavfilter/allfilters.c
index d7db46c2af..075f065f3c 100644
index 9819f0f95b..c6d93340e6 100644
--- a/libavfilter/allfilters.c
+++ b/libavfilter/allfilters.c
@@ -240,6 +240,7 @@ extern const AVFilter ff_vf_dedot;
@@ -248,6 +248,7 @@ extern const AVFilter ff_vf_dedot;
extern const AVFilter ff_vf_deflate;
extern const AVFilter ff_vf_deflicker;
extern const AVFilter ff_vf_deinterlace_qsv;
@ -37,10 +37,10 @@ index d7db46c2af..075f065f3c 100644
extern const AVFilter ff_vf_delogo;
diff --git a/libavfilter/vf_deinterlace_v4l2m2m.c b/libavfilter/vf_deinterlace_v4l2m2m.c
new file mode 100644
index 0000000000..ff5ed500a9
index 0000000000..bf163279ce
--- /dev/null
+++ b/libavfilter/vf_deinterlace_v4l2m2m.c
@@ -0,0 +1,1009 @@
@@ -0,0 +1,1011 @@
+/*
+ * This file is part of FFmpeg.
+ *
@ -85,13 +85,13 @@ index 0000000000..ff5ed500a9
+#include "libavutil/hwcontext_drm.h"
+#include "libavutil/internal.h"
+#include "libavutil/mathematics.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/pixdesc.h"
+#include "libavutil/time.h"
+
+#include "avfilter.h"
+#include "formats.h"
+#include "internal.h"
+#include "video.h"
+
+typedef struct V4L2Queue V4L2Queue;
@ -178,8 +178,8 @@ index 0000000000..ff5ed500a9
+ case DRM_FORMAT_NV61:
+ return V4L2_PIX_FMT_NV61;
+ default:
+ av_log(NULL, AV_LOG_WARNING, "%s unknown drm format 0x%llx using default v4l2_pix_fmt 0x%x\n",
+ __func__ , drm_format, V4L2_PIX_FMT_NV12);
+ av_log(NULL, AV_LOG_WARNING, "%s unknown drm format %s using default v4l2_pix_fmt %s\n",
+ __func__ , av_fourcc2str(drm_format), av_fourcc2str(V4L2_PIX_FMT_NV12));
+ return V4L2_PIX_FMT_NV12;
+ }
+}
@ -333,12 +333,12 @@ index 0000000000..ff5ed500a9
+ else if (!V4L2_TYPE_IS_OUTPUT(queue->format.type)) {
+ if (V4L2_TYPE_IS_MULTIPLANAR(fmt->type) && fmt->fmt.pix_mp.pixelformat != v4l2_pix_fmt) {
+ ctx->drm_out_format = drm_format_from_v4l2_pix_fmt(fmt->fmt.pix_mp.pixelformat);
+ av_log(NULL, AV_LOG_DEBUG, "%s driver updated v4l2_pixfmt from: %x to %x, so now using %llx as drm output format\n",
+ __func__, v4l2_pix_fmt, fmt->fmt.pix_mp.pixelformat, ctx->drm_out_format);
+ av_log(NULL, AV_LOG_DEBUG, "%s driver updated v4l2_pixfmt from: %s to %s, so now using %s as drm output format\n",
+ __func__, av_fourcc2str(v4l2_pix_fmt), av_fourcc2str(fmt->fmt.pix_mp.pixelformat), av_fourcc2str(ctx->drm_out_format));
+ } else if (fmt->fmt.pix.pixelformat != v4l2_pix_fmt) {
+ ctx->drm_out_format = drm_format_from_v4l2_pix_fmt(fmt->fmt.pix.pixelformat);
+ av_log(NULL, AV_LOG_DEBUG, "%s driver updated v4l2_pixfmt from: %x to %x, so now using %llx as drm output format\n",
+ __func__, v4l2_pix_fmt, fmt->fmt.pix.pixelformat, ctx->drm_out_format);
+ av_log(NULL, AV_LOG_DEBUG, "%s driver updated v4l2_pixfmt from: %s to %s, so now using %s as drm output format\n",
+ __func__, av_fourcc2str(v4l2_pix_fmt), av_fourcc2str(fmt->fmt.pix.pixelformat), av_fourcc2str(ctx->drm_out_format));
+ }
+ }
+
@ -818,7 +818,7 @@ index 0000000000..ff5ed500a9
+ if (err < 0)
+ goto fail_out1;
+
+ output_frame_1->interlaced_frame = 0;
+ output_frame_1->flags &= ~AV_FRAME_FLAG_INTERLACED;
+
+ output_frame_2 = av_frame_alloc();
+ if (!output_frame_2) {
@ -836,7 +836,7 @@ index 0000000000..ff5ed500a9
+ if (err < 0)
+ goto fail_out2;
+
+ output_frame_2->interlaced_frame = 0;
+ output_frame_2->flags &= ~AV_FRAME_FLAG_INTERLACED;
+
+ if (ctx->prev_in_frame && ctx->prev_in_frame->pts != AV_NOPTS_VALUE
+ && input_frame->pts != AV_NOPTS_VALUE) {
@ -874,12 +874,14 @@ index 0000000000..ff5ed500a9
+ AVFilterContext *avctx = outlink->src;
+ DeintV4L2M2MContext *priv = avctx->priv;
+ DeintV4L2M2MContextShared *ctx = priv->shared;
+ FilterLink *fl_inlink = ff_filter_link(inlink);
+ FilterLink *fl_outlink = ff_filter_link(outlink);
+ int ret;
+
+ ctx->height = avctx->inputs[0]->h;
+ ctx->width = avctx->inputs[0]->w;
+
+ outlink->frame_rate = av_mul_q(inlink->frame_rate,
+ fl_outlink->frame_rate = av_mul_q(fl_inlink->frame_rate,
+ (AVRational){ 2, 1 });
+ outlink->time_base = av_mul_q(inlink->time_base,
+ (AVRational){ 1, 2 });
@ -888,12 +890,12 @@ index 0000000000..ff5ed500a9
+ if (ret)
+ return ret;
+
+ if (!inlink->hw_frames_ctx) {
+ if (!fl_inlink->hw_frames_ctx) {
+ av_log(priv, AV_LOG_ERROR, "No hw context provided on input\n");
+ return AVERROR(EINVAL);
+ }
+
+ ctx->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
+ ctx->hw_frames_ctx = av_buffer_ref(fl_inlink->hw_frames_ctx);
+ if (!ctx->hw_frames_ctx)
+ return AVERROR(ENOMEM);
+
@ -920,7 +922,7 @@ index 0000000000..ff5ed500a9
+ int ret;
+
+ av_log(priv, AV_LOG_DEBUG, "input pts: %"PRId64" field :%d interlaced: %d\n",
+ in->pts, in->top_field_first, in->interlaced_frame);
+ in->pts, !!(in->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST), !!(in->flags & AV_FRAME_FLAG_INTERLACED));
+
+ ctx->cur_in_frame = in;
+
@ -931,7 +933,7 @@ index 0000000000..ff5ed500a9
+ ctx->drm_in_format = drm_desc->layers->format;
+ ctx->drm_out_format = drm_desc->layers->format;
+
+ if (in->top_field_first)
+ if (!!(in->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST))
+ ctx->field_order = V4L2_FIELD_INTERLACED_TB;
+ else
+ ctx->field_order = V4L2_FIELD_INTERLACED_BT;

View File

@ -1,62 +0,0 @@
From 162a9ac64b7babb4e831df86f6ed0efdfe84204e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Fri, 12 Jan 2024 15:17:43 +0000
Subject: [PATCH 01/14] vf_bwdif: Add capability to deinterlace NV12
As bwdif takes no account of horizontally adjacent pixels the same
code can be used on planes that have multiple components as is used
on single component planes. Update the filtering code to cope with
multi-component planes and add NV12 to the list of supported formats.
Signed-off-by: John Cox <jc@kynesim.co.uk>
---
libavfilter/vf_bwdif.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/libavfilter/vf_bwdif.c b/libavfilter/vf_bwdif.c
index 9847d38b6a..4d69b3039d 100644
--- a/libavfilter/vf_bwdif.c
+++ b/libavfilter/vf_bwdif.c
@@ -302,19 +302,28 @@ static void filter(AVFilterContext *ctx, AVFrame *dstpic,
YADIFContext *yadif = &bwdif->yadif;
ThreadData td = { .frame = dstpic, .parity = parity, .tff = tff };
int i;
+ int last_plane = -1;
for (i = 0; i < yadif->csp->nb_components; i++) {
int w = dstpic->width;
int h = dstpic->height;
+ const AVComponentDescriptor * const comp = yadif->csp->comp + i;
+
+ // If the last plane was the same as this plane assume we've dealt
+ // with all the pels already
+ if (last_plane == comp->plane)
+ continue;
+ last_plane = comp->plane;
if (i == 1 || i == 2) {
w = AV_CEIL_RSHIFT(w, yadif->csp->log2_chroma_w);
h = AV_CEIL_RSHIFT(h, yadif->csp->log2_chroma_h);
}
- td.w = w;
- td.h = h;
- td.plane = i;
+ // comp step is in bytes but td.w is in pels
+ td.w = w * comp->step / ((comp->depth + 7) / 8);
+ td.h = h;
+ td.plane = comp->plane;
ff_filter_execute(ctx, filter_slice, &td, NULL,
FFMIN((h+3)/4, ff_filter_get_nb_threads(ctx)));
@@ -350,6 +359,7 @@ static const enum AVPixelFormat pix_fmts[] = {
AV_PIX_FMT_YUVA420P9, AV_PIX_FMT_YUVA422P9, AV_PIX_FMT_YUVA444P9,
AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUVA444P10,
AV_PIX_FMT_YUVA420P16, AV_PIX_FMT_YUVA422P16, AV_PIX_FMT_YUVA444P16,
+ AV_PIX_FMT_NV12,
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP9, AV_PIX_FMT_GBRP10,
AV_PIX_FMT_GBRP12, AV_PIX_FMT_GBRP14, AV_PIX_FMT_GBRP16,
AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRAP16,
--
2.34.1

View File

@ -1,65 +0,0 @@
From 4960acb627d736421251500b3e4e0e88d3b12cd1 Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Fri, 12 Jan 2024 16:46:27 +0000
Subject: [PATCH 02/14] v4l2_m2m_dec: Try to accomodate ffmpegs ideas about
default s/w fmts
---
libavcodec/v4l2_m2m_dec.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c
index f67dd23ba1..3883223079 100644
--- a/libavcodec/v4l2_m2m_dec.c
+++ b/libavcodec/v4l2_m2m_dec.c
@@ -1079,7 +1079,6 @@ choose_capture_format(AVCodecContext * const avctx, V4L2m2mContext * const s)
unsigned int fmts_n;
uint32_t *fmts = ff_v4l2_context_enum_drm_formats(&s->capture, &fmts_n);
enum AVPixelFormat *fmts2 = NULL;
- enum AVPixelFormat t;
enum AVPixelFormat gf_pix_fmt;
unsigned int i;
unsigned int n = 0;
@@ -1089,7 +1088,7 @@ choose_capture_format(AVCodecContext * const avctx, V4L2m2mContext * const s)
if (!fmts)
return AVERROR(ENOENT);
- if ((fmts2 = av_malloc(sizeof(*fmts2) * (fmts_n + 2))) == NULL) {
+ if ((fmts2 = av_malloc(sizeof(*fmts2) * (fmts_n + 3))) == NULL) {
rv = AVERROR(ENOMEM);
goto error;
}
@@ -1110,17 +1109,25 @@ choose_capture_format(AVCodecContext * const avctx, V4L2m2mContext * const s)
pref_n = n;
fmts2[n++] = f;
}
- fmts2[n] = AV_PIX_FMT_NONE;
if (n < 2) {
av_log(avctx, AV_LOG_DEBUG, "%s: No usable formats found\n", __func__);
goto error;
}
- // Put preferred s/w format at the end - ff_get_format will put it in sw_pix_fmt
- t = fmts2[n - 1];
- fmts2[n - 1] = fmts2[pref_n];
- fmts2[pref_n] = t;
+ if (n != 2) {
+ // ffmpeg.c really only expects one s/w format. It thinks that the
+ // last format in the list is the s/w format of the h/w format but
+ // also chooses the first non-h/w format as the preferred s/w format.
+ // The only way of reconciling this is to dup our preferred format into
+ // both last & first place :-(
+ const enum AVPixelFormat t = fmts2[pref_n];
+ fmts2[pref_n] = fmts2[1];
+ fmts2[1] = t;
+ fmts2[n++] = t;
+ }
+
+ fmts2[n] = AV_PIX_FMT_NONE;
gf_pix_fmt = ff_get_format(avctx, fmts2);
av_log(avctx, AV_LOG_DEBUG, "avctx requested=%d (%s) %dx%d; get_format requested=%d (%s)\n",
--
2.34.1

View File

@ -1,92 +0,0 @@
From 80f74137438df2cfe911907242ec96593642f64b Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Thu, 18 Jan 2024 15:57:30 +0000
Subject: [PATCH 03/14] v4l2_m2m_dec: Fix cma allocated s/w output
---
libavcodec/v4l2_buffers.c | 33 +++++++++++++++++++++++----------
1 file changed, 23 insertions(+), 10 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index e412636a7a..b3ef74bcd4 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -486,6 +486,11 @@ static void v4l2_free_bufref(void *opaque, uint8_t *data)
// Buffer still attached to context
V4L2m2mContext *s = buf_to_m2mctx(avbuf);
+ if (!s->output_drm && avbuf->dmabuf[0] != NULL) {
+ for (unsigned int i = 0; i != avbuf->num_planes; ++i)
+ dmabuf_read_end(avbuf->dmabuf[i]);
+ }
+
ff_mutex_lock(&ctx->lock);
ff_v4l2_buffer_set_avail(avbuf);
@@ -533,6 +538,9 @@ static int v4l2_buffer_export_drm(V4L2Buffer* avbuf)
avbuf->buf.m.planes[i].m.fd = dma_fd;
else
avbuf->buf.m.fd = dma_fd;
+
+ if (!s->output_drm)
+ avbuf->plane_info[i].mm_addr = dmabuf_map(avbuf->dmabuf[i]);
}
else {
struct v4l2_exportbuffer expbuf;
@@ -647,6 +655,11 @@ static int v4l2_buffer_buf_to_swframe(AVFrame *frame, V4L2Buffer *avbuf)
break;
}
+ if (avbuf->dmabuf[0] != NULL) {
+ for (unsigned int i = 0; i != avbuf->num_planes; ++i)
+ dmabuf_read_start(avbuf->dmabuf[i]);
+ }
+
return 0;
}
@@ -947,6 +960,7 @@ int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ct
V4L2Buffer * const avbuf = av_mallocz(sizeof(*avbuf));
AVBufferRef * bufref;
V4L2m2mContext * const s = ctx_to_m2mctx(ctx);
+ int want_mmap;
*pbufref = NULL;
if (avbuf == NULL)
@@ -988,10 +1002,10 @@ int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ct
} else
avbuf->num_planes = 1;
- for (i = 0; i < avbuf->num_planes; i++) {
- const int want_mmap = avbuf->buf.memory == V4L2_MEMORY_MMAP &&
- (V4L2_TYPE_IS_OUTPUT(ctx->type) || !buf_to_m2mctx(avbuf)->output_drm);
+ want_mmap = avbuf->buf.memory == V4L2_MEMORY_MMAP &&
+ (V4L2_TYPE_IS_OUTPUT(ctx->type) || !buf_to_m2mctx(avbuf)->output_drm);
+ for (i = 0; i < avbuf->num_planes; i++) {
avbuf->plane_info[i].bytesperline = V4L2_TYPE_IS_MULTIPLANAR(ctx->type) ?
ctx->format.fmt.pix_mp.plane_fmt[i].bytesperline :
ctx->format.fmt.pix.bytesperline;
@@ -1032,13 +1046,12 @@ int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ct
avbuf->buf.length = avbuf->planes[0].length;
}
- if (!V4L2_TYPE_IS_OUTPUT(ctx->type)) {
- if (s->output_drm) {
- ret = v4l2_buffer_export_drm(avbuf);
- if (ret) {
- av_log(logger(avbuf), AV_LOG_ERROR, "Failed to get exported drm handles\n");
- goto fail;
- }
+ if (!want_mmap) {
+ // export_drm does dmabuf alloc if we aren't using v4l2 alloc
+ ret = v4l2_buffer_export_drm(avbuf);
+ if (ret) {
+ av_log(logger(avbuf), AV_LOG_ERROR, "Failed to get exported drm handles\n");
+ goto fail;
}
}
--
2.34.1

View File

@ -1,109 +0,0 @@
From c1328b956e9856210b1f2bc20c20fd152c309123 Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Mon, 29 Jan 2024 15:12:34 +0000
Subject: [PATCH 04/14] v4l2_req: Fix media pool delete race
fds & polltasks associated with media fds that are still in flight are
not freed on delete but the main pool is leading to use after free when
they finally do complete. Stop scanning the free chain on delete and
simply delete everything, in-flight or not. This requires changing alloc
as the buffers weren't previously tracked in-flight.
---
libavcodec/v4l2_req_media.c | 38 ++++++++++++++++++++-----------------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/libavcodec/v4l2_req_media.c b/libavcodec/v4l2_req_media.c
index 0394bb2b23..c94cc5b0f6 100644
--- a/libavcodec/v4l2_req_media.c
+++ b/libavcodec/v4l2_req_media.c
@@ -86,6 +86,8 @@ struct media_pool {
int fd;
sem_t sem;
pthread_mutex_t lock;
+ unsigned int pool_n;
+ struct media_request * pool_reqs;
struct media_request * free_reqs;
struct pollqueue * pq;
};
@@ -251,18 +253,17 @@ int media_request_abort(struct media_request ** const preq)
return 0;
}
-static void delete_req_chain(struct media_request * const chain)
+static void free_req_pool(struct media_request * const pool, const unsigned int n)
{
- struct media_request * next = chain;
- while (next) {
- struct media_request * const req = next;
- next = req->next;
+ unsigned int i;
+ for (i = 0; i != n; ++i) {
+ struct media_request * const req = pool + i;
if (req->pt)
polltask_delete(&req->pt);
if (req->fd != -1)
close(req->fd);
- free(req);
}
+ free(pool);
}
struct media_pool * media_pool_new(const char * const media_path,
@@ -283,17 +284,16 @@ struct media_pool * media_pool_new(const char * const media_path,
goto fail1;
}
+ if ((mp->pool_reqs = calloc(n, sizeof(*mp->pool_reqs))) == NULL)
+ goto fail3;
+ mp->pool_n = n;
for (i = 0; i != n; ++i) {
- struct media_request * req = malloc(sizeof(*req));
- if (!req)
- goto fail4;
+ mp->pool_reqs[i].mp = mp;
+ mp->pool_reqs[i].fd = -1;
+ }
- *req = (struct media_request){
- .next = mp->free_reqs,
- .mp = mp,
- .fd = -1
- };
- mp->free_reqs = req;
+ for (i = 0; i != n; ++i) {
+ struct media_request * const req = mp->pool_reqs + i;
if (ioctl(mp->fd, MEDIA_IOC_REQUEST_ALLOC, &req->fd) == -1) {
request_log("Failed to alloc request %d: %s\n", i, strerror(errno));
@@ -303,6 +303,9 @@ struct media_pool * media_pool_new(const char * const media_path,
req->pt = polltask_new(pq, req->fd, POLLPRI, media_request_done, req);
if (!req->pt)
goto fail4;
+
+ req->next = mp->free_reqs,
+ mp->free_reqs = req;
}
sem_init(&mp->sem, 0, n);
@@ -310,7 +313,8 @@ struct media_pool * media_pool_new(const char * const media_path,
return mp;
fail4:
- delete_req_chain(mp->free_reqs);
+ free_req_pool(mp->pool_reqs, mp->pool_n);
+fail3:
close(mp->fd);
pthread_mutex_destroy(&mp->lock);
fail1:
@@ -327,7 +331,7 @@ void media_pool_delete(struct media_pool ** pMp)
return;
*pMp = NULL;
- delete_req_chain(mp->free_reqs);
+ free_req_pool(mp->pool_reqs, mp->pool_n);
close(mp->fd);
sem_destroy(&mp->sem);
pthread_mutex_destroy(&mp->lock);
--
2.34.1

View File

@ -1,30 +0,0 @@
From 613e5cbb5e0a7626377876e9a441c614afe1e25e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 30 Jan 2024 14:24:59 +0000
Subject: [PATCH 05/14] drm_vout: Fix connector etc. desc memory leak
---
libavdevice/drm_vout.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/libavdevice/drm_vout.c b/libavdevice/drm_vout.c
index 491e1dc608..275748abdc 100644
--- a/libavdevice/drm_vout.c
+++ b/libavdevice/drm_vout.c
@@ -501,6 +501,13 @@ static int find_crtc(struct AVFormatContext * const avctx, int drmfd, struct drm
crtc ? crtc->height : 0,
(s->conId == (int)con->connector_id ?
" (chosen)" : ""));
+
+ if (crtc)
+ drmModeFreeCrtc(crtc);
+ if (enc)
+ drmModeFreeEncoder(enc);
+ if (con)
+ drmModeFreeConnector(con);
}
if (!s->conId) {
--
2.34.1

View File

@ -1,58 +0,0 @@
From f1868ad7d598cf4f194680a5e8d116744d8227cc Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 30 Jan 2024 16:20:53 +0000
Subject: [PATCH 06/14] conf_native: Add --tsan option
---
pi-util/conf_native.sh | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/pi-util/conf_native.sh b/pi-util/conf_native.sh
index f0ed159594..0dbaa53e97 100755
--- a/pi-util/conf_native.sh
+++ b/pi-util/conf_native.sh
@@ -10,6 +10,8 @@ RPI_KEEPS=""
NOSHARED=
MMAL=
USR_PREFIX=
+TOOLCHAIN=
+R=rel
while [ "$1" != "" ] ; do
case $1 in
@@ -22,6 +24,10 @@ while [ "$1" != "" ] ; do
--usr)
USR_PREFIX=/usr
;;
+ --tsan)
+ TOOLCHAIN="--toolchain=gcc-tsan"
+ R=tsan
+ ;;
*)
echo "Usage $0: [--noshared] [--mmal] [--usr]"
echo " noshared Build static libs and executable - good for testing"
@@ -82,11 +88,11 @@ V=`cat RELEASE`
SHARED_LIBS="--enable-shared"
if [ $NOSHARED ]; then
SHARED_LIBS="--disable-shared"
- OUT=$BUILDBASE/$B-$C-$V-static-rel
+ OUT=$BUILDBASE/$B-$C-$V-static-$R
echo Static libs
else
echo Shared libs
- OUT=$BUILDBASE/$B-$C-$V-shared-rel
+ OUT=$BUILDBASE/$B-$C-$V-shared-$R
fi
if [ ! $USR_PREFIX ]; then
@@ -106,6 +112,7 @@ $FFSRC/configure \
--libdir=$LIB_PREFIX\
--incdir=$INC_PREFIX\
$MCOPTS\
+ $TOOLCHAIN\
--disable-stripping\
--disable-thumb\
--enable-sand\
--
2.34.1

View File

@ -1,166 +0,0 @@
From 4f458f6ef9d74a44029dab3c0416f630c96a968b Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 30 Jan 2024 16:25:53 +0000
Subject: [PATCH 07/14] v4l2_m2m: Rework use of ctx->lock to avoid use while
uninit
---
libavcodec/v4l2_buffers.c | 9 ++--
libavcodec/v4l2_context.c | 86 +++++++++++++++++++++++++++------------
2 files changed, 63 insertions(+), 32 deletions(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index b3ef74bcd4..e844a1a0b6 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -484,7 +484,7 @@ static void v4l2_free_bufref(void *opaque, uint8_t *data)
if (ctx != NULL) {
// Buffer still attached to context
- V4L2m2mContext *s = buf_to_m2mctx(avbuf);
+ V4L2m2mContext * const s = ctx_to_m2mctx(ctx);
if (!s->output_drm && avbuf->dmabuf[0] != NULL) {
for (unsigned int i = 0; i != avbuf->num_planes; ++i)
@@ -494,15 +494,14 @@ static void v4l2_free_bufref(void *opaque, uint8_t *data)
ff_mutex_lock(&ctx->lock);
ff_v4l2_buffer_set_avail(avbuf);
+ avbuf->buf.timestamp.tv_sec = 0;
+ avbuf->buf.timestamp.tv_usec = 0;
- if (s->draining && V4L2_TYPE_IS_OUTPUT(ctx->type)) {
+ if (V4L2_TYPE_IS_OUTPUT(ctx->type)) {
av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer avail\n", ctx->name);
- /* no need to queue more buffers to the driver */
}
else if (ctx->streamon) {
av_log(logger(avbuf), AV_LOG_DEBUG, "%s: Buffer requeue\n", ctx->name);
- avbuf->buf.timestamp.tv_sec = 0;
- avbuf->buf.timestamp.tv_usec = 0;
ff_v4l2_buffer_enqueue(avbuf); // will set to IN_DRIVER
}
else {
diff --git a/libavcodec/v4l2_context.c b/libavcodec/v4l2_context.c
index a01a105892..0d61a432c3 100644
--- a/libavcodec/v4l2_context.c
+++ b/libavcodec/v4l2_context.c
@@ -906,56 +906,88 @@ static int stuff_all_buffers(AVCodecContext * avctx, V4L2Context* ctx)
}
}
+ ff_mutex_lock(&ctx->lock);
for (i = 0; i < ctx->num_buffers; ++i) {
struct V4L2Buffer * const buf = (struct V4L2Buffer *)ctx->bufrefs[i]->data;
if (buf->status == V4L2BUF_AVAILABLE) {
rv = ff_v4l2_buffer_enqueue(buf);
if (rv < 0)
- return rv;
+ break;
}
}
- return 0;
+ ff_mutex_unlock(&ctx->lock);
+ return rv;
}
-int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd)
+static int set_streamon(AVCodecContext * const avctx, V4L2Context*const ctx)
{
int type = ctx->type;
int ret = 0;
- AVCodecContext * const avctx = logger(ctx);
+
+ if (!V4L2_TYPE_IS_OUTPUT(ctx->type))
+ stuff_all_buffers(avctx, ctx);
+
+ if (ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_STREAMON, &type) < 0) {
+ ret = AVERROR(errno);
+ av_log(avctx, AV_LOG_ERROR, "%s set status ON failed: err=%s\n", ctx->name,
+ av_err2str(ret));
+ return ret;
+ }
+
+ ctx->first_buf = 1;
+ ctx->streamon = 1;
+ ctx->flag_last = 0;
+ av_log(avctx, AV_LOG_DEBUG, "%s set status ON OK\n", ctx->name);
+ return ret;
+}
+
+static int set_streamoff(AVCodecContext * const avctx, V4L2Context*const ctx)
+{
+ int type = ctx->type;
+ int ret = 0;
+ const int has_bufs = ctx_buffers_alloced(ctx);
// Avoid doing anything if there is nothing we can do
- if (cmd == VIDIOC_STREAMOFF && !ctx_buffers_alloced(ctx) && !ctx->streamon)
+ if (!has_bufs && !ctx->streamon)
return 0;
- ff_mutex_lock(&ctx->lock);
-
- if (cmd == VIDIOC_STREAMON && !V4L2_TYPE_IS_OUTPUT(ctx->type))
- stuff_all_buffers(avctx, ctx);
+ if (has_bufs)
+ ff_mutex_lock(&ctx->lock);
- if (ioctl(ctx_to_m2mctx(ctx)->fd, cmd, &type) < 0) {
- const int err = errno;
- av_log(avctx, AV_LOG_ERROR, "%s set status %d (%s) failed: err=%d\n", ctx->name,
- cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF", err);
- ret = AVERROR(err);
+ if (ioctl(ctx_to_m2mctx(ctx)->fd, VIDIOC_STREAMOFF, &type) < 0) {
+ ret = AVERROR(errno);
+ av_log(avctx, AV_LOG_ERROR, "%s set status ON failed: err=%s\n", ctx->name,
+ av_err2str(ret));
}
- else
- {
- if (cmd == VIDIOC_STREAMOFF)
- flush_all_buffers_status(ctx);
- else
- ctx->first_buf = 1;
+ else {
+ flush_all_buffers_status(ctx);
- ctx->streamon = (cmd == VIDIOC_STREAMON);
- av_log(avctx, AV_LOG_DEBUG, "%s set status %d (%s) OK\n", ctx->name,
- cmd, (cmd == VIDIOC_STREAMON) ? "ON" : "OFF");
+ ctx->streamon = 0;
+ ctx->flag_last = 0;
+
+ av_log(avctx, AV_LOG_DEBUG, "%s set status OFF OK\n", ctx->name);
}
- // Both stream off & on effectively clear flag_last
- ctx->flag_last = 0;
+ if (has_bufs)
+ ff_mutex_unlock(&ctx->lock);
+ return ret;
+}
- ff_mutex_unlock(&ctx->lock);
- return ret;
+int ff_v4l2_context_set_status(V4L2Context* ctx, uint32_t cmd)
+{
+ AVCodecContext * const avctx = logger(ctx);
+
+ switch (cmd) {
+ case VIDIOC_STREAMOFF:
+ return set_streamoff(avctx, ctx);
+ case VIDIOC_STREAMON:
+ return set_streamon(avctx, ctx);
+ default:
+ av_log(avctx, AV_LOG_ERROR, "%s: Unexpected cmd: %d\n", __func__, cmd);
+ break;
+ }
+ return AVERROR_BUG;
}
int ff_v4l2_context_enqueue_frame(V4L2Context* ctx, const AVFrame* frame)
--
2.34.1

View File

@ -1,25 +0,0 @@
From e00b19de388fec567e37c10edeafa646d322afa6 Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Thu, 1 Feb 2024 18:11:06 +0000
Subject: [PATCH 08/14] matroskaenc: Fix H264 delayed extradata creation
---
libavformat/matroskaenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 61e4c976ef..a6a00f03e7 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -1125,7 +1125,7 @@ static int mkv_assemble_native_codecprivate(AVFormatContext *s, AVIOContext *dyn
case AV_CODEC_ID_WAVPACK:
return put_wv_codecpriv(dyn_cp, extradata, extradata_size);
case AV_CODEC_ID_H264:
- if (par->extradata_size)
+ if (extradata_size)
return ff_isom_write_avcc(dyn_cp, extradata,
extradata_size);
else
--
2.34.1

View File

@ -1,34 +0,0 @@
From 97c735a3fc0976aa50d819a2f397e9467228722d Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Thu, 1 Feb 2024 18:12:38 +0000
Subject: [PATCH 09/14] matroskaenc: Assume H264 is Annex B if no extradata
---
libavformat/matroskaenc.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index a6a00f03e7..131ad31d1b 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -3194,9 +3194,15 @@ static int mkv_init(struct AVFormatContext *s)
track->reformat = mkv_reformat_wavpack;
break;
case AV_CODEC_ID_H264:
+ // Default to reformat if no extradata as the only current
+ // encoder which does this is v4l2m2m which needs reformat
+ if (par->extradata_size == 0 ||
+ (par->extradata_size > 3 &&
+ (AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1)))
+ track->reformat = mkv_reformat_h2645;
+ break;
case AV_CODEC_ID_HEVC:
- if ((par->codec_id == AV_CODEC_ID_H264 && par->extradata_size > 0 ||
- par->codec_id == AV_CODEC_ID_HEVC && par->extradata_size > 6) &&
+ if (par->extradata_size > 6 &&
(AV_RB24(par->extradata) == 1 || AV_RB32(par->extradata) == 1))
track->reformat = mkv_reformat_h2645;
break;
--
2.34.1

View File

@ -1,42 +0,0 @@
From 47212b4641888cbf131cbc2f9da58af68e4c92e5 Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Fri, 16 Feb 2024 11:50:56 +0000
Subject: [PATCH 10/14] aarch64/rgb2rgb: Change incorrect SXTX to stxw
---
libswscale/aarch64/rgb2rgb_neon.S | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libswscale/aarch64/rgb2rgb_neon.S b/libswscale/aarch64/rgb2rgb_neon.S
index 0956800b41..38f83a1b78 100644
--- a/libswscale/aarch64/rgb2rgb_neon.S
+++ b/libswscale/aarch64/rgb2rgb_neon.S
@@ -338,8 +338,8 @@ function ff_bgr24toyv12_aarch64, export=1
b.eq 90f
subs w9, w4, #0
- add x0, x0, w14, SXTX
- add x1, x1, w6, SXTX
+ add x0, x0, w14, sxtw
+ add x1, x1, w6, sxtw
mov x10, x0
mov x11, x1
b.lt 12f
@@ -424,10 +424,10 @@ function ff_bgr24toyv12_aarch64, export=1
// ------------------- Loop to start
- add x0, x0, w14, SXTX
- add x1, x1, w6, SXTX
- add x2, x2, w7, SXTX
- add x3, x3, w7, SXTX
+ add x0, x0, w14, sxtw
+ add x1, x1, w6, sxtw
+ add x2, x2, w7, sxtw
+ add x3, x3, w7, sxtw
subs w5, w5, #1
b.gt 11b
90:
--
2.34.1

View File

@ -1,130 +0,0 @@
From d346c57fec8c75e2f36368a5f62f91389e9b7547 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sat, 17 Feb 2024 13:29:36 +0000
Subject: [PATCH 11/14] aarch64/rpi_sand: Fix building under Clang/LLVM
The "Arm A64 Instruction Set Architecture" manual says that the MOV
(element) instruction takes the form `MOV <Vd>.<Ts>[<index1>],
<Vn>.<Ts>[<index2>]`, where `<Ts>` is one of B, H, S, or D. Only certain
other instructions accept a number in front. GNU as allows you to
include it for any instruction, but this is non-standard. This is
explained at https://stackoverflow.com/questions/71907156.
---
libavutil/aarch64/rpi_sand_neon.S | 50 +++++++++++++++----------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/libavutil/aarch64/rpi_sand_neon.S b/libavutil/aarch64/rpi_sand_neon.S
index 11658de0c8..3a6bc3de74 100644
--- a/libavutil/aarch64/rpi_sand_neon.S
+++ b/libavutil/aarch64/rpi_sand_neon.S
@@ -387,13 +387,13 @@ function ff_rpi_sand30_lines_to_planar_c16, export=1
st3 {v0.4h - v2.4h}, [x0], #24
st3 {v16.4h - v18.4h}, [x2], #24
beq 11b
- mov v0.2d[0], v0.2d[1]
+ mov v0.d[0], v0.d[1]
sub w9, w9, #12
- mov v1.2d[0], v1.2d[1]
- mov v2.2d[0], v2.2d[1]
- mov v16.2d[0], v16.2d[1]
- mov v17.2d[0], v17.2d[1]
- mov v18.2d[0], v18.2d[1]
+ mov v1.d[0], v1.d[1]
+ mov v2.d[0], v2.d[1]
+ mov v16.d[0], v16.d[1]
+ mov v17.d[0], v17.d[1]
+ mov v18.d[0], v18.d[1]
1:
cmp w9, #6-48
blt 1f
@@ -526,28 +526,28 @@ function ff_rpi_sand30_lines_to_planar_y16, export=1
blt 1f
st3 {v16.4h, v17.4h, v18.4h}, [x0], #24
beq 11b
- mov v16.2d[0], v16.2d[1]
+ mov v16.d[0], v16.d[1]
sub w5, w5, #12
- mov v17.2d[0], v17.2d[1]
- mov v18.2d[0], v18.2d[1]
+ mov v17.d[0], v17.d[1]
+ mov v18.d[0], v18.d[1]
1:
cmp w5, #6-96
blt 1f
st3 {v16.h, v17.h, v18.h}[0], [x0], #6
st3 {v16.h, v17.h, v18.h}[1], [x0], #6
beq 11b
- mov v16.2s[0], v16.2s[1]
+ mov v16.s[0], v16.s[1]
sub w5, w5, #6
- mov v17.2s[0], v17.2s[1]
- mov v18.2s[0], v18.2s[1]
+ mov v17.s[0], v17.s[1]
+ mov v18.s[0], v18.s[1]
1:
cmp w5, #3-96
blt 1f
st3 {v16.h, v17.h, v18.h}[0], [x0], #6
beq 11b
- mov v16.4h[0], v16.4h[1]
+ mov v16.h[0], v16.h[1]
sub w5, w5, #3
- mov v17.4h[0], v17.4h[1]
+ mov v17.h[0], v17.h[1]
1:
cmp w5, #2-96
blt 1f
@@ -625,10 +625,10 @@ function ff_rpi_sand30_lines_to_planar_y8, export=1
blt 1f
st3 {v16.8b, v17.8b, v18.8b}, [x0], #24
beq 11b
- mov v16.2d[0], v16.2d[1]
+ mov v16.d[0], v16.d[1]
sub w5, w5, #24
- mov v17.2d[0], v17.2d[1]
- mov v18.2d[0], v18.2d[1]
+ mov v17.d[0], v17.d[1]
+ mov v18.d[0], v18.d[1]
1:
cmp w5, #12-96
blt 1f
@@ -637,28 +637,28 @@ function ff_rpi_sand30_lines_to_planar_y8, export=1
st3 {v16.b, v17.b, v18.b}[2], [x0], #3
st3 {v16.b, v17.b, v18.b}[3], [x0], #3
beq 11b
- mov v16.2s[0], v16.2s[1]
+ mov v16.s[0], v16.s[1]
sub w5, w5, #12
- mov v17.2s[0], v17.2s[1]
- mov v18.2s[0], v18.2s[1]
+ mov v17.s[0], v17.s[1]
+ mov v18.s[0], v18.s[1]
1:
cmp w5, #6-96
blt 1f
st3 {v16.b, v17.b, v18.b}[0], [x0], #3
st3 {v16.b, v17.b, v18.b}[1], [x0], #3
beq 11b
- mov v16.4h[0], v16.4h[1]
+ mov v16.h[0], v16.h[1]
sub w5, w5, #6
- mov v17.4h[0], v17.4h[1]
- mov v18.4h[0], v18.4h[1]
+ mov v17.h[0], v17.h[1]
+ mov v18.h[0], v18.h[1]
1:
cmp w5, #3-96
blt 1f
st3 {v16.b, v17.b, v18.b}[0], [x0], #3
beq 11b
- mov v16.8b[0], v16.8b[1]
+ mov v16.b[0], v16.b[1]
sub w5, w5, #3
- mov v17.8b[0], v17.8b[1]
+ mov v17.b[0], v17.b[1]
1:
cmp w5, #2-96
blt 1f
--
2.34.1

View File

@ -1,27 +0,0 @@
From 07ff7baa79d23620d293b03fc2445c43bdacb34a Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sat, 17 Feb 2024 14:37:44 +0000
Subject: [PATCH 12/14] rtpenc: Fix building with GCC 14
This incompatible pointer type issue became a fatal error in GCC 14. The
AVBuffer API started using size_t in 5.0 with ef6a9e5e.
---
libavformat/rtpenc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c
index f67dc2a15a..1f1e4cb25a 100644
--- a/libavformat/rtpenc.c
+++ b/libavformat/rtpenc.c
@@ -588,7 +588,7 @@ static int rtp_write_packet(AVFormatContext *s1, AVPacket *pkt)
case AV_CODEC_ID_H264:
{
uint8_t *side_data;
- int side_data_size = 0;
+ size_t side_data_size = 0;
side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA,
&side_data_size);
--
2.34.1

View File

@ -1,26 +0,0 @@
From aa44997bf59e2aca86a38cb65755861c413b2609 Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sun, 18 Feb 2024 09:18:31 +0000
Subject: [PATCH 13/14] v4l2_req: Fix building against musl by including
pthread.h
---
libavcodec/v4l2_req_decode_q.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavcodec/v4l2_req_decode_q.h b/libavcodec/v4l2_req_decode_q.h
index af7bbe1de4..27eafbc42b 100644
--- a/libavcodec/v4l2_req_decode_q.h
+++ b/libavcodec/v4l2_req_decode_q.h
@@ -1,6 +1,8 @@
#ifndef AVCODEC_V4L2_REQ_DECODE_Q_H
#define AVCODEC_V4L2_REQ_DECODE_Q_H
+#include <pthread.h>
+
typedef struct req_decode_ent {
struct req_decode_ent * next;
struct req_decode_ent * prev;
--
2.34.1

View File

@ -1,28 +0,0 @@
From b3d4a1be1582195480c0f166744ada70f7457a5c Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 27 Feb 2024 12:57:08 +0000
Subject: [PATCH 14/14] v4l2_buffers: Fix init of drmprime source (OUTPUT)
buffers for encode
Previous fix for mmaped dmabuf CAPTURE buffers broke this due to failure
to note that dmabuf export wasn't wanted for OUTPUT buffers.
---
libavcodec/v4l2_buffers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavcodec/v4l2_buffers.c b/libavcodec/v4l2_buffers.c
index e844a1a0b6..2d1db41a30 100644
--- a/libavcodec/v4l2_buffers.c
+++ b/libavcodec/v4l2_buffers.c
@@ -1045,7 +1045,7 @@ int ff_v4l2_buffer_initialize(AVBufferRef ** pbufref, int index, V4L2Context *ct
avbuf->buf.length = avbuf->planes[0].length;
}
- if (!want_mmap) {
+ if (V4L2_TYPE_IS_CAPTURE(ctx->type) && !want_mmap) {
// export_drm does dmabuf alloc if we aren't using v4l2 alloc
ret = v4l2_buffer_export_drm(avbuf);
if (ret) {
--
2.34.1

View File

@ -25,7 +25,7 @@
GRAPHIC_DRIVERS="panfrost"
# kernel serial console
EXTRA_CMDLINE="console=uart8250,mmio32,0xff690000 console=tty0 coherent_pool=2M cec.debounce_ms=5000"
EXTRA_CMDLINE="console=uart8250,mmio32,0xff690000 console=tty0 coherent_pool=2M cec.debounce_ms=5000 cma=384M"
# set the addon project
ADDON_PROJECT="ARMv7"

View File

@ -0,0 +1,12 @@
diff --git a/arch/arm/boot/dts/rockchip/rk3288.dtsi b/arch/arm/boot/dts/rockchip/rk3288.dtsi
index 9ff190ab1d..1d5a4a68f6 100644
--- a/arch/arm/boot/dts/rockchip/rk3288.dtsi
+++ b/arch/arm/boot/dts/rockchip/rk3288.dtsi
@@ -1298,6 +1298,7 @@ vpu_mmu: iommu@ff9a0800 {
clock-names = "aclk", "iface";
#iommu-cells = <0>;
power-domains = <&power RK3288_PD_VIDEO>;
+ status = "disabled";
};
hevc: hevc@ff9c0000 {

View File

@ -2,7 +2,7 @@
# base ffmpeg version
FFMPEG_REPO="git://source.ffmpeg.org/ffmpeg.git"
FFMPEG_VERSION="n6.0.1"
FFMPEG_VERSION="n7.1"
ALL_FEATURE_SETS="v4l2-drmprime v4l2-request libreelec rpi vf-deinterlace-v4l2m2m"
@ -34,11 +34,12 @@ create_patch() {
;;
libreelec)
REPO="https://github.com/LibreELEC/FFmpeg"
REFSPEC="6.0-libreelec-misc"
REFSPEC="libreelec-misc-${FFMPEG_VERSION}"
;;
rpi)
REPO="https://github.com/jc-kynesim/rpi-ffmpeg"
REFSPEC="test/6.0.1/main"
REFSPEC="test/7.1/main"
PATCH_CREATE_DIFF="yes"
;;
*)
echo "illegal feature set ${FEATURE_SET}"