diff --git a/packages/multimedia/ffmpeg/patches/rpi/ffmpeg-001-rpi.patch b/packages/multimedia/ffmpeg/patches/rpi/ffmpeg-001-rpi.patch index 89efaaac1a..70f566ef9c 100644 --- a/packages/multimedia/ffmpeg/patches/rpi/ffmpeg-001-rpi.patch +++ b/packages/multimedia/ffmpeg/patches/rpi/ffmpeg-001-rpi.patch @@ -1,7 +1,7 @@ From 2443e873ef3a82087fad1d392a26bf1d8a1cc9d5 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 26 Apr 2021 12:34:50 +0100 -Subject: [PATCH 001/113] Add pi configs and scripts +Subject: [PATCH 001/120] Add pi configs and scripts --- pi-util/BUILD.txt | 59 ++++++++ @@ -1682,7 +1682,7 @@ index 0000000000..5935a11ca5 From bde822d2612b59911b0eb44409c8815aa4ff1fef Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 11:27:39 +0100 -Subject: [PATCH 002/113] Add sand pix fmts & conversion fns +Subject: [PATCH 002/120] Add sand pix fmts & conversion fns --- configure | 3 + @@ -3503,7 +3503,7 @@ index 0000000000..634b55e800 From 3d994f09aa704c80cd2e0496c00f5767f88244cc Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 11:36:47 +0100 -Subject: [PATCH 003/113] Add aarch64 asm sand conv functions +Subject: [PATCH 003/120] Add aarch64 asm sand conv functions Many thanks to eiler.mike@gmail.com (Michael Eiler) for these optimizations @@ -4312,7 +4312,7 @@ index ed0261b02f..1f543e9357 100644 From 0d53002c00ccc9c51321f423a62cb04e523a908f Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 11:56:02 +0100 -Subject: [PATCH 004/113] Add raw encoding for sand +Subject: [PATCH 004/120] Add raw encoding for sand --- libavcodec/raw.c | 6 +++ @@ -4461,7 +4461,7 @@ index 34d7a1bef4..0cd8eaffee 100644 From dd7e385da41ab751d41a44d6395b4cc841b2839a Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 12:02:09 +0100 -Subject: [PATCH 005/113] Deal with the lack of trivial sand cropping +Subject: [PATCH 005/120] Deal with the lack of trivial sand cropping --- fftools/ffmpeg.c | 4 ++-- @@ -4561,7 +4561,7 @@ index 33fac2054c..a112e296f7 100644 From 15e1a26da5d1b6a244a8a663dd469010c1da55e6 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 12:31:16 +0100 -Subject: [PATCH 006/113] Add an unsand filter +Subject: [PATCH 006/120] Add an unsand filter --- configure | 1 + @@ -4859,7 +4859,7 @@ index 0000000000..7100f2fc9b From 5737587f9f3566b8e963d7059136bf6d2f987810 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 12:37:07 +0100 -Subject: [PATCH 007/113] Reduce mmal compile warnings +Subject: [PATCH 007/120] Reduce mmal compile warnings --- libavcodec/mmaldec.c | 4 ++++ @@ -4891,7 +4891,7 @@ index 7fd24ad3b7..03cf5c3bba 100644 From 32db01e1f0c7aa86adad47a013d6ffe2eccae5b8 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 17:56:16 +0100 -Subject: [PATCH 008/113] Add chroma location to hevc parse +Subject: [PATCH 008/120] Add chroma location to hevc parse --- libavcodec/hevc_parser.c | 13 +++++++++++++ @@ -4950,7 +4950,7 @@ index f8f981e838..00e14f0115 100644 From afc9e6c5f8f092de1a7c8a686abd87f7be06e14c Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 26 Sep 2022 18:20:50 +0100 -Subject: [PATCH 009/113] hwaccel: Add .abort_frame & use in hevcdec +Subject: [PATCH 009/120] hwaccel: Add .abort_frame & use in hevcdec --- libavcodec/avcodec.h | 11 +++++++++++ @@ -5002,7 +5002,7 @@ index 00e14f0115..ec3dd3cfa7 100644 From 376135da2c0d311cad5287b8ee0055ea1e4c1eaf Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 26 Sep 2022 18:26:17 +0100 -Subject: [PATCH 010/113] hwaccel: Add CAP_MT_SAFE for accels that can use +Subject: [PATCH 010/120] hwaccel: Add CAP_MT_SAFE for accels that can use multi-thread --- @@ -5051,7 +5051,7 @@ index 43d6cc8ff4..d98b885b0e 100644 From 653671fba5f2ac43703576d3d8ee41bbf175f003 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 17:59:08 +0100 -Subject: [PATCH 011/113] Weak link utils +Subject: [PATCH 011/120] Weak link utils --- libavcodec/weak_link.c | 102 +++++++++++++++++++++++++++++++++++++++++ @@ -5201,7 +5201,7 @@ index 0000000000..415b6a27a0 From 172b496797b51a4c2638acacf45c8f6be03faf95 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 19:23:26 +0100 -Subject: [PATCH 012/113] Add v4l2_req V4L2 request H265 drm_prime decode +Subject: [PATCH 012/120] Add v4l2_req V4L2 request H265 drm_prime decode Has the abiliy to switch between kernel API versions at runtime. This could be removed later once teher is no chance of usage on an old @@ -10676,7 +10676,7 @@ index 0000000000..f14f594564 From 297e4d885dd99aa0d1703c854fcb1f926d60abbb Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 27 Apr 2021 19:30:36 +0100 -Subject: [PATCH 013/113] Add no_cvt_hw option to ffmpeg +Subject: [PATCH 013/120] Add no_cvt_hw option to ffmpeg --- fftools/ffmpeg.c | 6 ++++-- @@ -10745,7 +10745,7 @@ index 6e18a4a23e..877689f8bc 100644 From 1707f2fac047809232ec19c6c9f038461ff1ec94 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 28 Apr 2021 10:16:39 +0100 -Subject: [PATCH 014/113] Add vout_drm +Subject: [PATCH 014/120] Add vout_drm --- configure | 4 + @@ -11456,7 +11456,7 @@ index 0000000000..15ed1b8825 From 4b2ffa315b5a20a84a38e17e74d8a2e6b778b200 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 28 Apr 2021 11:34:18 +0100 -Subject: [PATCH 015/113] Add vout_egl +Subject: [PATCH 015/120] Add vout_egl --- configure | 6 + @@ -12354,7 +12354,7 @@ index 0000000000..0195c9d026 From 183f6ae1b65b695630c8ac8a7cb5659a2ded42f6 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 28 Apr 2021 12:51:22 +0100 -Subject: [PATCH 016/113] V4L2 stateful rework +Subject: [PATCH 016/120] V4L2 stateful rework --- libavcodec/Makefile | 3 +- @@ -14780,7 +14780,7 @@ index 8a51dec3fa..e1d34f4ccd 100644 From d01e2d278c959db020910e62071dd0abe460b0e7 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 10 Jun 2021 18:46:21 +0100 -Subject: [PATCH 017/113] Fix crash in hw_device_default_name if type not found +Subject: [PATCH 017/120] Fix crash in hw_device_default_name if type not found (NONE) --- @@ -14804,7 +14804,7 @@ index 14e702bd92..4194647faa 100644 From 40f4215a999a91398f8e627efe4de2674610d0c6 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 10 Jun 2021 18:59:18 +0100 -Subject: [PATCH 018/113] Allow v4l2m2m to select non-drm_prime output formats +Subject: [PATCH 018/120] Allow v4l2m2m to select non-drm_prime output formats --- libavcodec/v4l2_buffers.c | 2 +- @@ -14871,7 +14871,7 @@ index e1d34f4ccd..d258fed28b 100644 From 353911de1297691582400e34c2edc23b128b1d09 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 10 Jun 2021 18:59:38 +0100 -Subject: [PATCH 019/113] Fix YUV420P output from v4l2m2m +Subject: [PATCH 019/120] Fix YUV420P output from v4l2m2m Also put get_width get_height inlines in header as they are generally useful. @@ -14988,7 +14988,7 @@ index 24a9c94864..8f054f2f50 100644 From 1dec95facf260599f9297a9bebc6227fddfebb07 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 10 Jun 2021 19:23:44 +0100 -Subject: [PATCH 020/113] Report buffer overflows in v4l2m2m +Subject: [PATCH 020/120] Report buffer overflows in v4l2m2m --- libavcodec/v4l2_buffers.c | 14 ++++++++++---- @@ -15064,7 +15064,7 @@ index 5404fb1e94..5f89b5047c 100644 From 6b1946de881162e8d2e256b029a75f1e5804332f Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 14 Jun 2021 11:55:16 +0100 -Subject: [PATCH 021/113] Increase V4L2 H264 stateful coded buffer size +Subject: [PATCH 021/120] Increase V4L2 H264 stateful coded buffer size Try to set a min size of frame size / 2 for bitbuffers passed to V4l2. This fixes a few streams that have large I-frames. You would hope @@ -15188,7 +15188,7 @@ index d258fed28b..b37b005d3f 100644 From 2a241b27bf5862a2faadecff08c2d936bb40b087 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 28 Jun 2021 12:13:35 +0100 -Subject: [PATCH 022/113] Fix raw video s.t. it respects any remaining cropping +Subject: [PATCH 022/120] Fix raw video s.t. it respects any remaining cropping This fixes the long standing CONFWIN_A conformance test failure for drm. --- @@ -15458,7 +15458,7 @@ index 7a9fdbd263..baf18920fa 100644 From c29e1648b05579d84323a5bd5ce8987228115e1c Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 13 Aug 2021 15:38:28 +0100 -Subject: [PATCH 023/113] Set frame interlace from V4L2 buffer field +Subject: [PATCH 023/120] Set frame interlace from V4L2 buffer field --- libavcodec/v4l2_buffers.c | 12 ++++++++++++ @@ -15498,7 +15498,7 @@ index de31f7ced9..97b8eb1db3 100644 From ad065684c270f1e44d53188f89affd913e338696 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 13 Aug 2021 16:11:53 +0100 -Subject: [PATCH 024/113] Fix V4L2 stateful to avoid crash if flush before +Subject: [PATCH 024/120] Fix V4L2 stateful to avoid crash if flush before start --- @@ -15524,7 +15524,7 @@ index fc8325a18d..d6243f6b80 100644 From 3769927973cd27b00743800c8680d33d5982a4fe Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 9 Sep 2021 17:44:13 +0100 -Subject: [PATCH 025/113] Copy properties from frame to v4l2 buffer +Subject: [PATCH 025/120] Copy properties from frame to v4l2 buffer Now copies all the properties in ff_v4l2_buffer_avframe_to_buf that ff_v4l2_buffer_buf_to_avframe copies @@ -15695,7 +15695,7 @@ index 97b8eb1db3..126d2a17f4 100644 From c2c1b11af72cd8bba8140922ff4adab1132f5c3a Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Nov 2021 16:49:01 +0000 -Subject: [PATCH 026/113] ffmpeg: Do not inc DTS on no decode output +Subject: [PATCH 026/120] ffmpeg: Do not inc DTS on no decode output V4L2 H264 decode has long latency and sometimes spits out a long stream of output without input. In this case incrementing DTS is wrong. There @@ -15727,7 +15727,7 @@ index e98f0b8149..517324df3a 100644 From 4aec8304fb35312e36766efa6844cb4be3b03f50 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Nov 2021 17:32:59 +0000 -Subject: [PATCH 027/113] v4l2_m2m_dec: Adjust timebase if H264 +Subject: [PATCH 027/120] v4l2_m2m_dec: Adjust timebase if H264 Adjust AVCodecContext time_base if H264 in the same way that the software decoder does. @@ -15760,7 +15760,7 @@ index b37b005d3f..5c4c199a79 100644 From 818e77a19bbaa4c8d51d68338f801ae4c236fd81 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Nov 2021 17:38:27 +0000 -Subject: [PATCH 028/113] v4l2_m2m_dec: Produce best guess PTSs if none +Subject: [PATCH 028/120] v4l2_m2m_dec: Produce best guess PTSs if none supplied Filter scheduling gets confused by missing PTSs and makes poor guesses @@ -15895,7 +15895,7 @@ index 5c4c199a79..eb19ec422f 100644 From 95182698a54c9656e004479023bcc3bef5b4c6fa Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Nov 2021 17:59:27 +0000 -Subject: [PATCH 029/113] v4l2_m2m_dec: Try harder to get an initial frame +Subject: [PATCH 029/120] v4l2_m2m_dec: Try harder to get an initial frame If the input Q is full then wait on a short timeout for a capture frame rather than stuffing yet still another frame into the input if we could @@ -15936,7 +15936,7 @@ index eb19ec422f..f05f2927e6 100644 From e979ff9809197ad46c299031c4ee39facdadef31 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 17 Nov 2021 18:04:56 +0000 -Subject: [PATCH 030/113] Add a V4L2 M2M deinterlace filter +Subject: [PATCH 030/120] Add a V4L2 M2M deinterlace filter Add a V4L2 deinterlace filter that will accept DRMPRIME frames. @@ -17277,7 +17277,7 @@ index 0000000000..1a933b7e0a From 6f07e022369785213d78b1f211e47adab47f4df2 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 2 Dec 2021 17:49:55 +0000 -Subject: [PATCH 031/113] Put no_pts_rescale in context which makes more sense +Subject: [PATCH 031/120] Put no_pts_rescale in context which makes more sense than an arg --- @@ -17558,7 +17558,7 @@ index f05f2927e6..d341f14a3d 100644 From 57ce5bd1dce97117cce25c215265582c6236784b Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 8 Dec 2021 15:00:37 +0000 -Subject: [PATCH 032/113] Use bitbuf min size for all streams +Subject: [PATCH 032/120] Use bitbuf min size for all streams --- libavcodec/v4l2_m2m_dec.c | 5 +---- @@ -17589,7 +17589,7 @@ index d341f14a3d..422a89edec 100644 From 71a71bd52921753815acf5ad5c4e3288597f1cb4 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 3 Dec 2021 12:54:18 +0000 -Subject: [PATCH 033/113] Track pending frames in v4l2 stateful +Subject: [PATCH 033/120] Track pending frames in v4l2 stateful Track which frames are pending decode in the v4l2 stateful decoder. This relies on DTS & PTS having some relationship to reality, so @@ -17847,7 +17847,7 @@ index 422a89edec..859fecdb77 100644 From 7931bfc9d3e4f30dcc3ab00557c3d0cb2d504516 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 15 Dec 2021 17:58:21 +0000 -Subject: [PATCH 034/113] Use pending tracking to reduce v4l2 latency +Subject: [PATCH 034/120] Use pending tracking to reduce v4l2 latency If there are more than 5 pending decodes outstanding then add a small timeout to the capture poll to reduce the rate at which frames are @@ -17970,7 +17970,7 @@ index 859fecdb77..4d2ef92cbe 100644 From 4425e0ed76c02fcd6dcf84e29c8e28a5aa7bbaf5 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 15 Dec 2021 12:23:54 +0000 -Subject: [PATCH 035/113] Allow logger() to take const ctx +Subject: [PATCH 035/120] Allow logger() to take const ctx --- libavcodec/v4l2_buffers.c | 2 +- @@ -18015,7 +18015,7 @@ index 9de5838256..9833e903c2 100644 From be9d93d6adcb4d4286e39adde9f192eca7812d52 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 15 Dec 2021 13:00:27 +0000 -Subject: [PATCH 036/113] Track numbere of bufs qed with an atomic +Subject: [PATCH 036/120] Track numbere of bufs qed with an atomic Safer and faster than counting status --- @@ -18089,7 +18089,7 @@ index 4cc164886c..a4176448d5 100644 From c9b50f79590acfc352d7023dba4263acfe7b1f29 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 9 Dec 2021 12:01:25 +0000 -Subject: [PATCH 037/113] Clear pkt_buf on flush +Subject: [PATCH 037/120] Clear pkt_buf on flush --- libavcodec/v4l2_m2m_dec.c | 3 +++ @@ -18113,7 +18113,7 @@ index 4d2ef92cbe..94a32a5eee 100644 From bdf67cec94f343dbd6dc7708ee96ea645ae7d9cb Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 15 Dec 2021 12:52:56 +0000 -Subject: [PATCH 038/113] Rework v4l2 buffer dequeue +Subject: [PATCH 038/120] Rework v4l2 buffer dequeue --- libavcodec/v4l2_context.c | 543 ++++++++++++++++++-------------------- @@ -19150,7 +19150,7 @@ index 94a32a5eee..d09b9f6a6d 100644 From e44ac2d67a09e89678c0b6a13329295f0755c22d Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 9 Dec 2021 18:51:00 +0000 -Subject: [PATCH 039/113] Honor result of ff_get_format if possible +Subject: [PATCH 039/120] Honor result of ff_get_format if possible --- libavcodec/v4l2_m2m_dec.c | 6 +++++- @@ -19185,7 +19185,7 @@ index d09b9f6a6d..db87cc5d72 100644 From 2e5821bb8fb333bd971878796f721544f9c26df0 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 14 Dec 2021 16:11:10 +0000 -Subject: [PATCH 040/113] Add an always-reinit quirk +Subject: [PATCH 040/120] Add an always-reinit quirk --- libavcodec/v4l2_context.c | 7 +++++-- @@ -19291,7 +19291,7 @@ index db87cc5d72..f39f3e7ee2 100644 From 69d3d78fb855652b5816833ec619ef90c9bb33b3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 4 Jan 2022 16:58:31 +0000 -Subject: [PATCH 041/113] v4l2_buffers: rework flags for keyframe +Subject: [PATCH 041/120] v4l2_buffers: rework flags for keyframe Previously flags could become confused and keyframe info could be lost. This fixes that and removes the duplicate flags field in V4L2Buffer. @@ -19400,7 +19400,7 @@ index 6e2e5f24ad..d8a86e8261 100644 From 95cdef2adcd0623098b34a2f7ce489c0af4a819a Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 22 Mar 2022 11:44:30 +0000 -Subject: [PATCH 042/113] v4l2m2m: Rework decode to wait for missing buffer, +Subject: [PATCH 042/120] v4l2m2m: Rework decode to wait for missing buffer, add dynamic pending Previously receive_frame exited with EAGAIN if no capture buffer @@ -19620,7 +19620,7 @@ index f39f3e7ee2..ab3584238d 100644 From 123466d58bdd4529fea70395f8201c78bfc5bc8a Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 25 Mar 2022 15:37:58 +0000 -Subject: [PATCH 043/113] v4l2_m2m2_dec: Avoid loop if unable to resize buffers +Subject: [PATCH 043/120] v4l2_m2m2_dec: Avoid loop if unable to resize buffers If source change signals a buffer size that cannot be honored give up rather than looping indefinitely. This happens on Pi if (say) a @@ -19667,7 +19667,7 @@ index 1aff16c1de..e4c848d6da 100644 From 38f2aeca1d38db698686a41f87147d97e18e88db Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 25 Mar 2022 18:14:40 +0000 -Subject: [PATCH 044/113] v4l2dec: Improve size/format validation on init +Subject: [PATCH 044/120] v4l2dec: Improve size/format validation on init --- libavcodec/v4l2_m2m_dec.c | 84 ++++++++++++++++++++++++++++++++-- @@ -19809,7 +19809,7 @@ index b0a5930844..76ab0916cd 100644 From 1c64aa3f328d594db17b90d837c2435b5ab1f460 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 13 Apr 2022 16:05:56 +0000 -Subject: [PATCH 045/113] v4l2 stateless hevc: Add another API variation for +Subject: [PATCH 045/120] v4l2 stateless hevc: Add another API variation for linux 5.18 This is probably going to be a short lived variation and may end up @@ -20255,7 +20255,7 @@ index f14f594564..ed48d62e2d 100644 From 920f91ffbcd3b8f4834ff6d903df7212a958486d Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 3 May 2022 12:44:42 +0000 -Subject: [PATCH 046/113] Remove V4l2 frame size check for meson-vdec +Subject: [PATCH 046/120] Remove V4l2 frame size check for meson-vdec --- libavcodec/v4l2_m2m.h | 3 ++- @@ -20315,7 +20315,7 @@ index f598072b94..8328a78930 100644 From 6d0e620abd7501c0c365e6f94b8937b55e7adf8f Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 23 May 2022 18:05:20 +0100 -Subject: [PATCH 047/113] v4l2m2m_dec: Make some error rturns a bit more robust +Subject: [PATCH 047/120] v4l2m2m_dec: Make some error rturns a bit more robust --- libavcodec/v4l2_context.c | 5 ++--- @@ -20384,7 +20384,7 @@ index 8328a78930..00d2d46d5d 100644 From e1a8efe55dd299dfecd9c0ada3b497d7c6f50cd8 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 24 May 2022 17:02:58 +0000 -Subject: [PATCH 048/113] v4l2m2m_dec: Support in-pkt AV_PKT_DATA_NEW_EXTRADATA +Subject: [PATCH 048/120] v4l2m2m_dec: Support in-pkt AV_PKT_DATA_NEW_EXTRADATA Support packet side-data containing AV_PKT_DATA_NEW_EXTRADATA. Should also detect and complain about unexpected streams of empty packets. @@ -20494,7 +20494,7 @@ index 00d2d46d5d..2f20fc9ad8 100644 From 0797fef446b16f03214043e93e7dadaace02e6e6 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 24 May 2022 20:02:48 +0000 -Subject: [PATCH 049/113] v4l2m2m_dec: Catch repeated Q fulls +Subject: [PATCH 049/120] v4l2m2m_dec: Catch repeated Q fulls --- libavcodec/v4l2_m2m_dec.c | 8 +++++++- @@ -20536,7 +20536,7 @@ index 2f20fc9ad8..4765fe0d5e 100644 From 8c842b220b9d55ff37f7149f198d6dfba532558f Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 25 May 2022 15:22:12 +0000 -Subject: [PATCH 050/113] Remove requirement for epoxy & libudev config options +Subject: [PATCH 050/120] Remove requirement for epoxy & libudev config options --- configure | 26 +++++++++++++++++--------- @@ -20663,7 +20663,7 @@ index 65576846e8..37cea71756 100755 From c01515bd877dcdcdef86babbe93bdd847236d886 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 27 May 2022 09:36:51 +0000 -Subject: [PATCH 051/113] hevc: If hwaccel avoid creation of s/w only vars +Subject: [PATCH 051/120] hevc: If hwaccel avoid creation of s/w only vars --- libavcodec/hevc_refs.c | 35 +++++++++++++++++++++-------------- @@ -20801,7 +20801,7 @@ index a2c43b888b..cd13de2603 100644 From 0d7f7c86342a306c9d547c97e9602537ffa3cd0f Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 30 May 2022 17:51:44 +0100 -Subject: [PATCH 052/113] rpi_sand: Add SAND30->NV12 conversion +Subject: [PATCH 052/120] rpi_sand: Add SAND30->NV12 conversion C code only. Reworks the hwcontext_drm conversion to use the rpi_sand_fns generic frame convert fn rather than calling the @@ -21023,7 +21023,7 @@ index 634b55e800..462ccb8abd 100644 From bc6fdb0674a89cb9f83538beff47cf54e78a4502 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 1 Jun 2022 17:49:26 +0000 -Subject: [PATCH 053/113] rpi_sand: Add SAND30->NV12 asm for Armv7 & Armv8 +Subject: [PATCH 053/120] rpi_sand: Add SAND30->NV12 asm for Armv7 & Armv8 Also reworks the previous Armv8 SAND30->Y16 function in a slightly more efficient way that makes it look more like the Armv7 version. @@ -21962,7 +21962,7 @@ index 256c3d532f..b6071e2928 100644 From 34163b056f9425a5e75440dc045459e451aafc0b Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 7 Jun 2022 14:46:12 +0000 -Subject: [PATCH 054/113] v4l2_m2m_enc: Add the ability to encode DRM_PRIME +Subject: [PATCH 054/120] v4l2_m2m_enc: Add the ability to encode DRM_PRIME frames --- @@ -23337,7 +23337,7 @@ index 20f81df750..db6014d8e3 100644 From 1fa3b2c14f3d237de415b1dd924ffc9b0c6f2ced Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 8 Jun 2022 16:13:31 +0000 -Subject: [PATCH 055/113] v4l2_m2m_dec: Use DTS for best effort PTS if PTS is +Subject: [PATCH 055/120] v4l2_m2m_dec: Use DTS for best effort PTS if PTS is always NO_PTS If we do have DTS but don't have PTS then assume PTS=DTS. @@ -23422,7 +23422,7 @@ index e61464b499..bb809be41e 100644 From 07fbbc149d1aa6fc6e151a7f65505be873c27982 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 30 Jun 2022 15:59:23 +0000 -Subject: [PATCH 056/113] v4l2: Update H265 request for current API +Subject: [PATCH 056/120] v4l2: Update H265 request for current API This works with v9 of the H265 patch set which hopefully will be the last one. Hevc controls extracted from patched v4l2-controls into @@ -24211,7 +24211,7 @@ index ed48d62e2d..d4adb3f812 100644 From e5cfb02fc431551da622c3ccaaf16d25afecf9e5 Mon Sep 17 00:00:00 2001 From: John Cox Date: Sun, 3 Jul 2022 13:40:41 +0000 -Subject: [PATCH 057/113] v4l2_req: Observe limit on size of slice_array +Subject: [PATCH 057/120] v4l2_req: Observe limit on size of slice_array This in fact provides some minor simplifications by combing the multi-slice and single-slice paths. @@ -24342,7 +24342,7 @@ index d4adb3f812..0029e23309 100644 From 73ba75fbab29c26cd8b362b5f450d4e0beb4ed1f Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 4 Jul 2022 14:43:20 +0100 -Subject: [PATCH 058/113] v4l2_req: Add entry point offsets array control +Subject: [PATCH 058/120] v4l2_req: Add entry point offsets array control --- libavcodec/v4l2_req_hevc_vx.c | 88 +++++++++++++++++++++++++++------- @@ -24580,7 +24580,7 @@ index 0029e23309..99c90064ea 100644 From 9cc5b21fa37450d7ab43163637cbf26718ffe92d Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 4 Jul 2022 16:22:54 +0100 -Subject: [PATCH 059/113] v4l2_req: Support Annex B +Subject: [PATCH 059/120] v4l2_req: Support Annex B --- libavcodec/v4l2_req_hevc_vx.c | 61 +++++++++++++++++++++++------------ @@ -24694,7 +24694,7 @@ index 43ef6631ed..5e0db9850a 100644 From 6dc0b1d851ef47fb198d32eb3088cfaa6b792d08 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 4 Jul 2022 18:24:03 +0100 -Subject: [PATCH 060/113] v4l2_req: Add frame mode decode +Subject: [PATCH 060/120] v4l2_req: Add frame mode decode --- libavcodec/v4l2_req_hevc_vx.c | 69 +++++++++++++++++++++++------------ @@ -24820,7 +24820,7 @@ index 5e0db9850a..ada53d0d44 100644 From eb9fe927c6582fba732e8d655072b2ce03099679 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 5 Jul 2022 12:54:22 +0000 -Subject: [PATCH 061/113] v4l2_req: Fix probe for frame based decode +Subject: [PATCH 061/120] v4l2_req: Fix probe for frame based decode --- libavcodec/v4l2_req_hevc_vx.c | 33 +++++++++++++++++++++++---------- @@ -24903,7 +24903,7 @@ index ada53d0d44..5d083016f8 100644 From d01df5c9199285c04b8b31aec41ea0ae2ecaaecf Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 26 Jul 2022 15:46:14 +0000 -Subject: [PATCH 062/113] vf_deinterlace_v4l2m2m: Support NV12 through +Subject: [PATCH 062/120] vf_deinterlace_v4l2m2m: Support NV12 through deinterlace Supports NV12 (though not yet NV12M) through deinterlace. @@ -25229,7 +25229,7 @@ index 1a933b7e0a..1a3bef5bcb 100644 From 234480a99c88f30b201dc16c9ffc8d7f22212be3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 19 Aug 2022 15:29:11 +0000 -Subject: [PATCH 063/113] v4l2_req: Enable use of MMAP for buffer alloc +Subject: [PATCH 063/120] v4l2_req: Enable use of MMAP for buffer alloc Use MMAP rather than DMABUF if either the dmabuf device can't be opened or create_buf doesn't set the capability. @@ -25961,7 +25961,7 @@ index cd79aad563..5cf17dd5e3 100644 From ea0d413ee122f53e6697919884c92a3505c6ae52 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 22 Aug 2022 12:35:40 +0000 -Subject: [PATCH 064/113] Set buffer lengths on DQ +Subject: [PATCH 064/120] Set buffer lengths on DQ --- libavcodec/v4l2_req_media.c | 8 ++++++++ @@ -25990,7 +25990,7 @@ index 910ac77bb6..1a9944774a 100644 From f15e0e5b59b559e4ffb9c3e6673b1815900f0ff3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 22 Aug 2022 17:11:24 +0000 -Subject: [PATCH 065/113] Fix compile if videodev2.h defines V4L2 HEVC request +Subject: [PATCH 065/120] Fix compile if videodev2.h defines V4L2 HEVC request API If videodev2.h does define the HEVC request API it is really hard to @@ -26117,7 +26117,7 @@ index 5cf17dd5e3..614a1b4d99 100644 From 6b41732aaec86b0ade91003419b89035940b32fe Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Sep 2022 17:59:22 +0100 -Subject: [PATCH 066/113] v4l2_m2m_enc: Send headers in in pkt side_data +Subject: [PATCH 066/120] v4l2_m2m_enc: Send headers in in pkt side_data If GLOBAL_HEADERS are requested then we can't provide them at init time so send as NEW_EXTRADATA side data in a similar way to some AV1 @@ -26198,7 +26198,7 @@ index db6014d8e3..c98f2129dc 100644 From b8ea626474687c921372b04b138d6b1ed94fb67e Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 14 Sep 2022 15:44:10 +0000 -Subject: [PATCH 067/113] matroskaenc: Allow H264 SPS/PPS headers in packet +Subject: [PATCH 067/120] matroskaenc: Allow H264 SPS/PPS headers in packet sidedata --- @@ -26267,7 +26267,7 @@ index 1256bdfe36..fae9509442 100644 From aa58b31d5d68abcf5989c747e1d1cde5223813e3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 14 Sep 2022 15:55:15 +0000 -Subject: [PATCH 068/113] movenc: Allow H264 SPS/PPS headers in packet sidedata +Subject: [PATCH 068/120] movenc: Allow H264 SPS/PPS headers in packet sidedata --- libavformat/movenc.c | 1 + @@ -26289,7 +26289,7 @@ index 5608afde42..0f2e236eaa 100644 From 840df546f21f95cc80eeb3f224d53c6dc19f34b9 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 26 Sep 2022 12:45:05 +0100 -Subject: [PATCH 069/113] Allow ffmpeg to select codec internal hwfmts if +Subject: [PATCH 069/120] Allow ffmpeg to select codec internal hwfmts if no_cvt_hw This allows the selection of DRM_PRIME from v4l2m2m without forcing it @@ -26326,7 +26326,7 @@ index 517324df3a..697b8a71cf 100644 From 21b9406798673c6d6275fc7b2f96975b7733e49b Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 1 Sep 2022 11:42:41 +0000 -Subject: [PATCH 070/113] vf_deinterlace_v4l2m2m: Add a v4l2m2m scaler +Subject: [PATCH 070/120] vf_deinterlace_v4l2m2m: Add a v4l2m2m scaler The logic for running an isp based scaler is pretty much identical to that for the deinterlacer so add to the deinterlacer. This requires @@ -27809,7 +27809,7 @@ index 1a3bef5bcb..2df39ec0f1 100644 From 84d071e7f04ac67ee2071c4512a635f0c4388b40 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 22 Sep 2022 14:54:46 +0000 -Subject: [PATCH 071/113] v4l2_m2m: Adjust buffer allocation based on min/max +Subject: [PATCH 071/120] v4l2_m2m: Adjust buffer allocation based on min/max controls Clip requested buffer count to min/max declared by driver. @@ -27861,7 +27861,7 @@ index 0225f6ba64..5754a9fda7 100644 From 35d480e28ddaa7a68d06f00a52deb97f53e251d8 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 22 Sep 2022 15:00:12 +0000 -Subject: [PATCH 072/113] v4l2_m2m_dec: If src Q is full then wait indefinitely +Subject: [PATCH 072/120] v4l2_m2m_dec: If src Q is full then wait indefinitely for buffer If it is not possible to add another buffer to the src Q then alawys @@ -27894,7 +27894,7 @@ index bb809be41e..e67e06313f 100644 From 9bfc5748f3b1325c598af5426f689ccc291087ec Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 22 Sep 2022 15:12:27 +0000 -Subject: [PATCH 073/113] vf_deinterlace_v4l2m2m: Add Q name to structure for +Subject: [PATCH 073/120] vf_deinterlace_v4l2m2m: Add Q name to structure for debug --- @@ -27928,7 +27928,7 @@ index 2df39ec0f1..4edecc02bf 100644 From 0a3064022e113153f6eaba307b7d982b1c350df7 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 22 Sep 2022 16:08:42 +0000 -Subject: [PATCH 074/113] v4l2_m2m_enc: Set src buffer count to min+2 by +Subject: [PATCH 074/120] v4l2_m2m_enc: Set src buffer count to min+2 by default Set output.num_buffers to 0 by default which will then be set to min+2 @@ -27960,7 +27960,7 @@ index c98f2129dc..bc0c2d4245 100644 From 738e263692a00f5a9c4ba37e17a0950d1fdeed6f Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 22 Sep 2022 16:13:57 +0000 -Subject: [PATCH 075/113] vf_deinterlace_m2m: For deinterlace set outlink FR to +Subject: [PATCH 075/120] vf_deinterlace_m2m: For deinterlace set outlink FR to twice inlink We used to set the outlink framerate to unknown but it turns out that @@ -27997,7 +27997,7 @@ index 4edecc02bf..c52dae1c44 100644 From 898b4ef41bfe2a2638f15850f752f04f9a9993bb Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 23 Sep 2022 11:30:56 +0000 -Subject: [PATCH 076/113] v4l2m2m: Add ff_v4l2_dq_all to drain all buffers from +Subject: [PATCH 076/120] v4l2m2m: Add ff_v4l2_dq_all to drain all buffers from a Q Useful for where (encode) we might have drmprime buffers that we want to @@ -28055,7 +28055,7 @@ index 21265f1bd7..523c53e97d 100644 From 6d3e970647486212d614e5d77a4140fbffa12544 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 23 Sep 2022 11:38:36 +0000 -Subject: [PATCH 077/113] v4l2_m2m_enc: DQ output more frequently +Subject: [PATCH 077/120] v4l2_m2m_enc: DQ output more frequently Ensure that we DQ any released src buffers on every op to avoid deadlock with source. @@ -28114,7 +28114,7 @@ index bc0c2d4245..d8ee7fd2f2 100644 From 236301167a8103afaffbdf1ad43616c1af8383c4 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 26 Sep 2022 18:20:00 +0100 -Subject: [PATCH 078/113] conf_native: Remove --enable-rpi from all builds +Subject: [PATCH 078/120] conf_native: Remove --enable-rpi from all builds --- pi-util/conf_native.sh | 5 +++-- @@ -28148,7 +28148,7 @@ index 37cea71756..f22d531ca4 100755 From 7c875c257b3d0ff913ced3ae2bc6b6a4c150b7cc Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 29 Sep 2022 19:48:08 +0000 -Subject: [PATCH 079/113] v4l2_m2m_dec: Deal correctly with avcC H264 data in +Subject: [PATCH 079/120] v4l2_m2m_dec: Deal correctly with avcC H264 data in extradata Decoders expect AnnexB style headers, mkv and similar formats have @@ -28391,7 +28391,7 @@ index e67e06313f..6ffd28e76d 100644 From 62f6924639cee07142ebc2567c693fb1304ac44c Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 30 Sep 2022 14:20:23 +0000 -Subject: [PATCH 080/113] v4l2_request_hevc: Fix up +Subject: [PATCH 080/120] v4l2_request_hevc: Fix up V4L2_CID_CODEC_STATELESS_BASE if missing --- @@ -28420,7 +28420,7 @@ index 7829d82084..c02fdbe5a8 100644 From 76ad115bb301a2b4bd27135557a4e0b4653e8d5f Mon Sep 17 00:00:00 2001 From: John Cox Date: Sat, 1 Oct 2022 13:40:57 +0000 -Subject: [PATCH 081/113] vf_deinterlace_v4l2m2m: Fix compile on m/c without +Subject: [PATCH 081/120] vf_deinterlace_v4l2m2m: Fix compile on m/c without V4L2 SAND --- @@ -28554,7 +28554,7 @@ index c52dae1c44..716789f988 100644 From 7539260084d21d63a5dfd989891cc34a8d2e42c8 Mon Sep 17 00:00:00 2001 From: John Cox Date: Sun, 2 Oct 2022 12:36:43 +0000 -Subject: [PATCH 082/113] configure: Fix v4l2_req_hevc_vx setup; set after deps +Subject: [PATCH 082/120] configure: Fix v4l2_req_hevc_vx setup; set after deps fixups --- @@ -28592,7 +28592,7 @@ index f555f60dc8..c51b342cd2 100755 From d8ffedb056a1c5f5e6f6737d20fecc1aa0b3ed93 Mon Sep 17 00:00:00 2001 From: John Cox Date: Sat, 1 Oct 2022 12:39:45 +0000 -Subject: [PATCH 083/113] vf_deinterlace_v4l2m2m: Ensure we get consistent +Subject: [PATCH 083/120] vf_deinterlace_v4l2m2m: Ensure we get consistent final frames On getting EOS at the input of the filster do not simply drop everything @@ -28944,7 +28944,7 @@ index 716789f988..ce875c2c61 100644 From 6a37ed2a2d181e63e6a73c13fe20302818c21427 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 5 Oct 2022 16:12:02 +0000 -Subject: [PATCH 084/113] v4l2_m2m_dec: Rework decode pending heuristic +Subject: [PATCH 084/120] v4l2_m2m_dec: Rework decode pending heuristic The old code measured the length of the entire Q in the decoder and attempted to dynamically guess an appropriate length. This was prone to @@ -29115,7 +29115,7 @@ index 6ffd28e76d..de2d39de9a 100644 From 105c1cbdf43c288573620276ae8a90c2177fb428 Mon Sep 17 00:00:00 2001 From: John Cox Date: Fri, 21 Oct 2022 13:48:07 +0000 -Subject: [PATCH 085/113] pthread_frame: Fix MT hwaccel. Recent change broke +Subject: [PATCH 085/120] pthread_frame: Fix MT hwaccel. Recent change broke it. Revert the effects of 35aa7e70e7ec350319e7634a30d8d8aa1e6ecdda if the @@ -29222,7 +29222,7 @@ index d98b885b0e..1169ca945c 100644 From e00ca15321f0cbe2a63475e3c611ee15fb3ee4f3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 13:18:27 +0000 -Subject: [PATCH 086/113] v4l2_req: Add swfmt to init logging +Subject: [PATCH 086/120] v4l2_req: Add swfmt to init logging (cherry picked from commit dfa03b702baaf2952bcd2bbf8badcc2f9c961ddf) --- @@ -29259,7 +29259,7 @@ index 614a1b4d99..767ecb036a 100644 From e5ff4d9a8c7fffc587444bfbb9bd8578b1cb5d1a Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 13:39:54 +0000 -Subject: [PATCH 087/113] v4l2_m2m: Avoid polling on a queue that is streamoff +Subject: [PATCH 087/120] v4l2_m2m: Avoid polling on a queue that is streamoff (cherry picked from commit b2658bc56d3034a17db7f39597fc7d71bfe9a43b) --- @@ -29304,7 +29304,7 @@ index eaaec44666..3e527f666d 100644 From e75dba3f588461affa4a54a856418107efa036b0 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 14:07:04 +0000 -Subject: [PATCH 088/113] v4l2_m2m: Add function to get number of queued +Subject: [PATCH 088/120] v4l2_m2m: Add function to get number of queued buffers (cherry picked from commit f9ac6485c00b4531dcff354222aef450b29728f4) @@ -29336,7 +29336,7 @@ index 523c53e97d..8e4f681643 100644 From 3d886c89bfbcb13e230181bb611c1c2d9e235543 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 14:48:20 +0000 -Subject: [PATCH 089/113] v4l2_m2m: Add timeouts to dq_all and dequeue_packet +Subject: [PATCH 089/120] v4l2_m2m: Add timeouts to dq_all and dequeue_packet Add timeouts and use them to have better flow control in encode @@ -29505,7 +29505,7 @@ index d8ee7fd2f2..40bbe499f0 100644 From 41810850e382858c2c74453c472c3c4278e69286 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 14:23:32 +0000 -Subject: [PATCH 090/113] v4l2_m2m_enc: Improve debug trace +Subject: [PATCH 090/120] v4l2_m2m_enc: Improve debug trace (cherry picked from commit 113e89daffb329a0cd3d920abd483a4025664bf5) --- @@ -29565,7 +29565,7 @@ index 40bbe499f0..2c81031336 100644 From e0b4608b940bb16b8326fa6680c22bf5513cceac Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 18 Oct 2022 13:22:36 +0000 -Subject: [PATCH 091/113] v4l2_m2m_enc: Copy dest packets to memory if short of +Subject: [PATCH 091/120] v4l2_m2m_enc: Copy dest packets to memory if short of v4l2 buffers (cherry picked from commit aa4ebbda400b42db952fc713b26927fc8636b0e5) @@ -29604,7 +29604,7 @@ index 2c81031336..3773297543 100644 From 4b1a4ef2e33c2d4c463bf052843715ee35604625 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 19 Oct 2022 11:00:16 +0000 -Subject: [PATCH 092/113] v4l2_m2m_dec: Fix pts_best_effort guessing for +Subject: [PATCH 092/120] v4l2_m2m_dec: Fix pts_best_effort guessing for initial pts (cherry picked from commit 1af32e5c87586a0f7e76cdf19a012ddbcf3eac67) @@ -29629,7 +29629,7 @@ index de2d39de9a..73ce427052 100644 From 519f5e1936caab8436e105d1732e61f8eb538f45 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 19 Oct 2022 14:47:04 +0000 -Subject: [PATCH 093/113] v4l2_m2m_enc: Wait for frame or space in src Q in +Subject: [PATCH 093/120] v4l2_m2m_enc: Wait for frame or space in src Q in rx_pkt If receive_packet we should ensure that there is space in the source Q @@ -29691,7 +29691,7 @@ index 3773297543..684acf9dc7 100644 From 6039d4edf2ee1b2e037666b896d924347583dd75 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 19 Oct 2022 14:54:29 +0000 -Subject: [PATCH 094/113] vf_deinterlace_v4l2m2m: Print dts rather that NOPTS +Subject: [PATCH 094/120] vf_deinterlace_v4l2m2m: Print dts rather that NOPTS in trace (cherry picked from commit e9b468f35f0c6ad9bfe96f5a05e449afa8ae074a) @@ -29718,7 +29718,7 @@ index ce875c2c61..7c6751b69c 100644 From ff3a6c6b3085192be00feb501e0a692dda941f07 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 19 Oct 2022 14:55:21 +0000 -Subject: [PATCH 095/113] vf_deinterlace_v4l2m2m: Ignore "wanted" when +Subject: [PATCH 095/120] vf_deinterlace_v4l2m2m: Ignore "wanted" when processing input If we gate send a frame to the outlink on its frame_wanted flag then we @@ -29751,7 +29751,7 @@ index 7c6751b69c..a173a291f8 100644 From 7ba15c81a923b2e63974e36034492597559cb07b Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 19 Oct 2022 15:00:43 +0000 -Subject: [PATCH 096/113] conf_native: Add --enable-gpl +Subject: [PATCH 096/120] conf_native: Add --enable-gpl (cherry picked from commit bab9bf4a2e39391940d88af2ce5d70236ac21f15) --- @@ -29774,7 +29774,7 @@ index f22d531ca4..082d9b5832 100755 From 577cd088426ecffbce2ab88c40869f690a57ead0 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 15 Nov 2022 13:33:00 +0000 -Subject: [PATCH 097/113] egl_vout: Make formatting consistent - no code +Subject: [PATCH 097/120] egl_vout: Make formatting consistent - no code changes --- @@ -30758,7 +30758,7 @@ index 0195c9d026..8fd3c58bac 100644 From 06d2761f87ee240f2604f19659ad00ee34c728b4 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Dec 2022 16:49:43 +0000 -Subject: [PATCH 098/113] v4l2m2m: reporganise get_raw_format for loop logic +Subject: [PATCH 098/120] v4l2m2m: reporganise get_raw_format for loop logic --- libavcodec/v4l2_context.c | 16 +++++----------- @@ -30806,7 +30806,7 @@ index 042c6a976c..fcd5fdf359 100644 From 01a67c1059c5003c29d5177f1067156c95a82e58 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Dec 2022 17:49:12 +0000 -Subject: [PATCH 099/113] drm_vout: Set zpos on the plane we pick to ensure it +Subject: [PATCH 099/120] drm_vout: Set zpos on the plane we pick to ensure it is at the front --- @@ -30876,7 +30876,7 @@ index 15ed1b8825..8369dc6411 100644 From a92f752c7f6c5ba8d10d0d28bd5e00b01e1f20ef Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Dec 2022 17:51:46 +0000 -Subject: [PATCH 100/113] drm_vout: Only set modifier flag and pass modifiers +Subject: [PATCH 100/120] drm_vout: Only set modifier flag and pass modifiers if there are some --- @@ -30936,7 +30936,7 @@ index 8369dc6411..ccb9484668 100644 From fb14b3bd5f5377118bd36c7fa59c97a323c76937 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Dec 2022 17:52:58 +0000 -Subject: [PATCH 101/113] drm_vout: Fix typo in error message +Subject: [PATCH 101/120] drm_vout: Fix typo in error message --- libavdevice/drm_vout.c | 2 +- @@ -30959,7 +30959,7 @@ index ccb9484668..0510834942 100644 From 0bf60f487e3f61f7d2f464f0fa682ecb8f942daf Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 12 Dec 2022 18:00:41 +0000 -Subject: [PATCH 102/113] drm_vout: Add option to name the drm_module to use +Subject: [PATCH 102/120] drm_vout: Add option to name the drm_module to use --- libavdevice/drm_vout.c | 8 +++++--- @@ -31012,7 +31012,7 @@ index 0510834942..07dc656777 100644 From b44057a48d104b374eed0ac0f0d635b024af6930 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 13:01:00 +0000 -Subject: [PATCH 103/113] dmabufs: Rework to allow for non-CMA backends +Subject: [PATCH 103/120] dmabufs: Rework to allow for non-CMA backends --- libavcodec/v4l2_req_dmabufs.c | 161 ++++++++++++++++++++++++---------- @@ -31266,7 +31266,7 @@ index c4bbed18c6..1c3a5e861f 100644 From 108360ef02f6c16872147cb1d8b8b4fe906a6f67 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 13:07:58 +0000 -Subject: [PATCH 104/113] dmabufs: Use unref rather than deleet on cmabufs_ctl +Subject: [PATCH 104/120] dmabufs: Use unref rather than deleet on cmabufs_ctl --- libavcodec/v4l2_req_dmabufs.c | 12 +++++++++++- @@ -31354,7 +31354,7 @@ index 767ecb036a..db7ed13b6d 100644 From 067f436e1d053af11bb6c8d6ba42dede164247c0 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 14:21:40 +0000 -Subject: [PATCH 105/113] egl_vout: Remove redundant & completely broken debug +Subject: [PATCH 105/120] egl_vout: Remove redundant & completely broken debug --- libavdevice/egl_vout.c | 25 ------------------------- @@ -31400,7 +31400,7 @@ index 8fd3c58bac..c2659e96dc 100644 From ba04b91800e5a17ff1cee5023d94e304037cd7d5 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 16:12:12 +0000 -Subject: [PATCH 106/113] v4l2m2m: Use offset from querybuf rather than always +Subject: [PATCH 106/120] v4l2m2m: Use offset from querybuf rather than always 0 --- @@ -31455,7 +31455,7 @@ index 1ac32c5989..d91d5d1dd0 100644 From e7b15fa9f59f25e074a1f59ed5d16e158bdf8a76 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 17:57:27 +0000 -Subject: [PATCH 107/113] v4l2m2m: Fix crash if init errors out before setting +Subject: [PATCH 107/120] v4l2m2m: Fix crash if init errors out before setting avctx --- @@ -31479,7 +31479,7 @@ index e29df41729..cc4503dcae 100644 From 536e74b776084d66d33730114c96cfc17866180a Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 18:10:30 +0000 -Subject: [PATCH 108/113] v4l2_buffers: Add and use ctx_to_m2mctx + error debug +Subject: [PATCH 108/120] v4l2_buffers: Add and use ctx_to_m2mctx + error debug --- libavcodec/v4l2_buffers.c | 22 +++++++++++++++------- @@ -31546,7 +31546,7 @@ index 5ca58ea593..e28ef2d1e8 100644 From c691e8309d798048c52c8c32427c50cfcbe65055 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 18:53:22 +0000 -Subject: [PATCH 109/113] v4l2m2m: Add ability to use cma alloced dmabufs as +Subject: [PATCH 109/120] v4l2m2m: Add ability to use cma alloced dmabufs as well as v4l2 mmap --- @@ -31807,7 +31807,7 @@ index 73ce427052..663cb60a60 100644 From a6fb8bbf969abb06e18ac5b3fd5ad4b24791f228 Mon Sep 17 00:00:00 2001 From: John Cox Date: Tue, 13 Dec 2022 19:05:47 +0000 -Subject: [PATCH 110/113] testfilt: Skeleton of hw filter test code +Subject: [PATCH 110/120] testfilt: Skeleton of hw filter test code --- pi-util/testfilt.py | 83 +++++++++++++++++++++++++++++++++++++++++++++ @@ -31907,7 +31907,7 @@ index 0000000000..b322dac0c2 From f3e75d79420faff8244d53cf60b555df4d1549f3 Mon Sep 17 00:00:00 2001 From: John Cox Date: Thu, 5 Jan 2023 14:39:30 +0000 -Subject: [PATCH 111/113] pixfmt: Add a #define to indicate presence of SAND +Subject: [PATCH 111/120] pixfmt: Add a #define to indicate presence of SAND formats --- @@ -31931,7 +31931,7 @@ index b0dae0fe83..c917e5ac62 100644 From 1f8906af1d2a493b1b594e7329cdef219e1660f8 Mon Sep 17 00:00:00 2001 From: John Cox Date: Wed, 11 Jan 2023 16:30:37 +0000 -Subject: [PATCH 112/113] v4l2_m2m_dec: Fix initial pkt send if no extradata +Subject: [PATCH 112/120] v4l2_m2m_dec: Fix initial pkt send if no extradata --- libavcodec/v4l2_m2m_dec.c | 4 ++-- @@ -31963,7 +31963,7 @@ index 663cb60a60..1668945cff 100644 From 1beaf80a9f23aa703c50d1882117ccf1de8a3eb4 Mon Sep 17 00:00:00 2001 From: John Cox Date: Mon, 16 Jan 2023 16:05:09 +0000 -Subject: [PATCH 113/113] v4l2m2m_dec: Make capture timeout long once pending +Subject: [PATCH 113/120] v4l2m2m_dec: Make capture timeout long once pending count > 31 For some applications (ffmpeg command line) the current heuristic of adding @@ -32056,3 +32056,483 @@ index 1668945cff..32d5548707 100644 s->draining = 0; output->done = 0; capture->done = 0; + +From 97544fd1ff03633266534860fc4c66fc8e9ca0a1 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Mon, 6 Feb 2023 19:23:16 +0000 +Subject: [PATCH 114/120] Initial buffersink alloc callback code + +(cherry picked from commit dde8d3c8f3cc279b9b92ed4f10a2e3990f4aadeb) +--- + libavfilter/buffersink.c | 22 ++++++++++++++++++++++ + libavfilter/buffersink.h | 3 +++ + 2 files changed, 25 insertions(+) + +diff --git a/libavfilter/buffersink.c b/libavfilter/buffersink.c +index e269cf72d1..d3c82aabf3 100644 +--- a/libavfilter/buffersink.c ++++ b/libavfilter/buffersink.c +@@ -62,6 +62,11 @@ typedef struct BufferSinkContext { + int sample_rates_size; + + AVFrame *peeked_frame; ++ ++ union { ++ av_buffersink_alloc_video_frame * video; ++ } alloc_cb; ++ void * alloc_v; + } BufferSinkContext; + + #define NB_ITEMS(list) (list ## _size / sizeof(*list)) +@@ -154,6 +159,22 @@ int attribute_align_arg av_buffersink_get_samples(AVFilterContext *ctx, + return get_frame_internal(ctx, frame, 0, nb_samples); + } + ++static AVFrame * alloc_video_buffer(AVFilterLink *link, int w, int h) ++{ ++ AVFilterContext * const ctx = link->dst; ++ BufferSinkContext * const bs = ctx->priv; ++ return bs->alloc_cb.video ? bs->alloc_cb.video(ctx, bs->alloc_v, w, h) : ++ ff_default_get_video_buffer(link, w, h); ++} ++ ++int av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v) ++{ ++ BufferSinkContext * const bs = ctx->priv; ++ bs->alloc_cb.video = cb; ++ bs->alloc_v = v; ++ return 0; ++} ++ + #if FF_API_BUFFERSINK_ALLOC + AVBufferSinkParams *av_buffersink_params_alloc(void) + { +@@ -403,6 +424,7 @@ static const AVFilterPad avfilter_vsink_buffer_inputs[] = { + { + .name = "default", + .type = AVMEDIA_TYPE_VIDEO, ++ .get_buffer = {.video = alloc_video_buffer}, + }, + }; + +diff --git a/libavfilter/buffersink.h b/libavfilter/buffersink.h +index 01e7c747d8..52fbb9cac6 100644 +--- a/libavfilter/buffersink.h ++++ b/libavfilter/buffersink.h +@@ -202,6 +202,9 @@ int av_buffersink_get_frame(AVFilterContext *ctx, AVFrame *frame); + */ + int av_buffersink_get_samples(AVFilterContext *ctx, AVFrame *frame, int nb_samples); + ++typedef AVFrame * av_buffersink_alloc_video_frame(AVFilterContext * ctx, void * v, int w, int h); ++int av_buffersink_set_alloc_video_frame(AVFilterContext *ctx, av_buffersink_alloc_video_frame * cb, void * v); ++ + /** + * @} + */ + +From a5ffdc0751f0dad65cfd0757590760ac669d11e5 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Mon, 30 Jan 2023 17:23:12 +0000 +Subject: [PATCH 115/120] v4l2_m2m_dec: Add a profile check + +Check the profile in avctx aginst what the v4l2 driver advertises. If +the driver doesn't support the check then just accept anything. + +(cherry picked from commit 6dd83dead9ebce419fdea152db0c9f5e9a94e9ef) +--- + libavcodec/v4l2_m2m_dec.c | 125 ++++++++++++++++++++++++++++++++++++++ + 1 file changed, 125 insertions(+) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index 32d5548707..b0735e8b62 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -715,6 +715,127 @@ static int v4l2_receive_frame(AVCodecContext *avctx, AVFrame *frame) + } + #endif + ++static uint32_t ++avprofile_to_v4l2(const enum AVCodecID codec_id, const int avprofile) ++{ ++ switch (codec_id) { ++ case AV_CODEC_ID_H264: ++ switch (avprofile) { ++ case FF_PROFILE_H264_BASELINE: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_BASELINE; ++ case FF_PROFILE_H264_CONSTRAINED_BASELINE: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_BASELINE; ++ case FF_PROFILE_H264_MAIN: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_MAIN; ++ case FF_PROFILE_H264_EXTENDED: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_EXTENDED; ++ case FF_PROFILE_H264_HIGH: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH; ++ case FF_PROFILE_H264_HIGH_10: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10; ++ case FF_PROFILE_H264_HIGH_10_INTRA: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_10_INTRA; ++ case FF_PROFILE_H264_MULTIVIEW_HIGH: ++ case FF_PROFILE_H264_HIGH_422: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422; ++ case FF_PROFILE_H264_HIGH_422_INTRA: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_422_INTRA; ++ case FF_PROFILE_H264_STEREO_HIGH: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_STEREO_HIGH; ++ case FF_PROFILE_H264_HIGH_444_PREDICTIVE: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_PREDICTIVE; ++ case FF_PROFILE_H264_HIGH_444_INTRA: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_HIGH_444_INTRA; ++ case FF_PROFILE_H264_CAVLC_444: ++ return V4L2_MPEG_VIDEO_H264_PROFILE_CAVLC_444_INTRA; ++ case FF_PROFILE_H264_HIGH_444: ++ default: ++ break; ++// V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_BASELINE = 12, ++// V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH = 13, ++// V4L2_MPEG_VIDEO_H264_PROFILE_SCALABLE_HIGH_INTRA = 14, ++// V4L2_MPEG_VIDEO_H264_PROFILE_MULTIVIEW_HIGH = 16, ++// V4L2_MPEG_VIDEO_H264_PROFILE_CONSTRAINED_HIGH = 17, ++ } ++ break; ++ case AV_CODEC_ID_MPEG2VIDEO: ++ case AV_CODEC_ID_MPEG4: ++ case AV_CODEC_ID_VC1: ++ case AV_CODEC_ID_VP8: ++ case AV_CODEC_ID_VP9: ++ case AV_CODEC_ID_AV1: ++ // Most profiles are a simple number that matches the V4L2 enum ++ return avprofile; ++ default: ++ break; ++ } ++ return ~(uint32_t)0; ++} ++ ++// This check mirrors Chrome's profile check by testing to see if the profile ++// exists as a possible value for the V4L2 profile control ++static int ++check_profile(AVCodecContext *const avctx, V4L2m2mContext *const s) ++{ ++ struct v4l2_queryctrl query_ctrl; ++ struct v4l2_querymenu query_menu; ++ uint32_t profile_id; ++ ++ // An unset profile is almost certainly zero or -99 - do not reject ++ if (avctx->profile <= 0) { ++ av_log(avctx, AV_LOG_VERBOSE, "Profile <= 0 - check skipped\n"); ++ return 0; ++ } ++ ++ memset(&query_ctrl, 0, sizeof(query_ctrl)); ++ switch (avctx->codec_id) { ++ case AV_CODEC_ID_MPEG2VIDEO: ++ profile_id = V4L2_CID_MPEG_VIDEO_MPEG2_PROFILE; ++ break; ++ case AV_CODEC_ID_MPEG4: ++ profile_id = V4L2_CID_MPEG_VIDEO_MPEG4_PROFILE; ++ break; ++ case AV_CODEC_ID_H264: ++ profile_id = V4L2_CID_MPEG_VIDEO_H264_PROFILE; ++ break; ++ case AV_CODEC_ID_VP8: ++ profile_id = V4L2_CID_MPEG_VIDEO_VP8_PROFILE; ++ break; ++ case AV_CODEC_ID_VP9: ++ profile_id = V4L2_CID_MPEG_VIDEO_VP9_PROFILE; ++ break; ++#ifdef V4L2_CID_MPEG_VIDEO_AV1_PROFILE ++ case AV_CODEC_ID_AV1: ++ profile_id = V4L2_CID_MPEG_VIDEO_AV1_PROFILE; ++ break; ++#endif ++ default: ++ av_log(avctx, AV_LOG_VERBOSE, "Can't map profile for codec id %d; profile check skipped\n", avctx->codec_id); ++ return 0; ++ } ++ ++ query_ctrl = (struct v4l2_queryctrl){.id = profile_id}; ++ if (ioctl(s->fd, VIDIOC_QUERYCTRL, &query_ctrl) != 0) { ++ av_log(avctx, AV_LOG_VERBOSE, "Query profile ctrl (%#x) not supported: assume OK\n", query_ctrl.id); ++ } ++ else { ++ av_log(avctx, AV_LOG_DEBUG, "%s: Control supported: %#x\n", __func__, query_ctrl.id); ++ ++ query_menu = (struct v4l2_querymenu){ ++ .id = query_ctrl.id, ++ .index = avprofile_to_v4l2(avctx->codec_id, avctx->profile), ++ }; ++ ++ if (query_menu.index > query_ctrl.maximum || ++ query_menu.index < query_ctrl.minimum || ++ ioctl(s->fd, VIDIOC_QUERYMENU, &query_menu) != 0) { ++ return AVERROR(ENOENT); ++ } ++ } ++ ++ return 0; ++}; ++ + static int + check_size(AVCodecContext * const avctx, V4L2m2mContext * const s) + { +@@ -955,6 +1076,10 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) + if ((ret = check_size(avctx, s)) != 0) + return ret; + ++ if ((ret = check_profile(avctx, s)) != 0) { ++ av_log(avctx, AV_LOG_WARNING, "Profile %d not supported by decode\n", avctx->profile); ++ return ret; ++ } + return 0; + } + + +From 99a716c8858e97ac48c688a7d3229ab529fb0591 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Wed, 1 Feb 2023 17:24:39 +0000 +Subject: [PATCH 116/120] v4l2_m2m_dec: Add extradata parse for h264 & hevc + +If we have extradata we can extract profile & level and potentailly +other useful info from it. Use the codec parser to get it if the decoder +is configured. + +(cherry picked from commit 6d431e79adeb246c2ed8cebce9011d81175a3906) +--- + libavcodec/v4l2_m2m_dec.c | 84 ++++++++++++++++++++++++++++++++++++++- + 1 file changed, 83 insertions(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index b0735e8b62..636a825ab9 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -21,6 +21,8 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + ++#include "config.h" ++ + #include + #include + +@@ -43,6 +45,13 @@ + #include "v4l2_fmt.h" + #include "v4l2_req_dmabufs.h" + ++#if CONFIG_H264_DECODER ++#include "h264_parse.h" ++#endif ++#if CONFIG_HEVC_DECODER ++#include "hevc_parse.h" ++#endif ++ + // Pick 64 for max last count - that is >1sec at 60fps + #define STATS_LAST_COUNT_MAX 64 + #define STATS_INTERVAL_MAX (1 << 30) +@@ -956,6 +965,78 @@ static uint32_t max_coded_size(const AVCodecContext * const avctx) + return size + (1 << 16); + } + ++static void ++parse_extradata(AVCodecContext *avctx) ++{ ++ if (!avctx->extradata || !avctx->extradata_size) ++ return; ++ ++ switch (avctx->codec_id) { ++#if CONFIG_H264_DECODER ++ case AV_CODEC_ID_H264: ++ { ++ H264ParamSets ps = {{NULL}}; ++ int is_avc = 0; ++ int nal_length_size = 0; ++ int ret; ++ ++ ret = ff_h264_decode_extradata(avctx->extradata, avctx->extradata_size, ++ &ps, &is_avc, &nal_length_size, ++ avctx->err_recognition, avctx); ++ if (ret > 0) { ++ const SPS * sps = NULL; ++ unsigned int i; ++ for (i = 0; i != MAX_SPS_COUNT; ++i) { ++ if (ps.sps_list[i]) { ++ sps = (const SPS *)ps.sps_list[i]->data; ++ break; ++ } ++ } ++ if (sps) { ++ avctx->profile = ff_h264_get_profile(sps); ++ avctx->level = sps->level_idc; ++ } ++ } ++ ff_h264_ps_uninit(&ps); ++ break; ++ } ++#endif ++#if CONFIG_HEVC_DECODER ++ case AV_CODEC_ID_HEVC: ++ { ++ HEVCParamSets ps = {{NULL}}; ++ HEVCSEI sei = {{{{0}}}}; ++ int is_nalff = 0; ++ int nal_length_size = 0; ++ int ret; ++ ++ ret = ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, ++ &ps, &sei, &is_nalff, &nal_length_size, ++ avctx->err_recognition, 0, avctx); ++ if (ret > 0) { ++ const HEVCSPS * sps = NULL; ++ unsigned int i; ++ for (i = 0; i != HEVC_MAX_SPS_COUNT; ++i) { ++ if (ps.sps_list[i]) { ++ sps = (const HEVCSPS *)ps.sps_list[i]->data; ++ break; ++ } ++ } ++ if (sps) { ++ avctx->profile = sps->ptl.general_ptl.profile_idc; ++ avctx->level = sps->ptl.general_ptl.level_idc; ++ } ++ } ++ ff_hevc_ps_uninit(&ps); ++ ff_hevc_reset_sei(&sei); ++ break; ++ } ++#endif ++ default: ++ break; ++ } ++} ++ + static av_cold int v4l2_decode_init(AVCodecContext *avctx) + { + V4L2Context *capture, *output; +@@ -976,7 +1057,8 @@ static av_cold int v4l2_decode_init(AVCodecContext *avctx) + avctx->ticks_per_frame = 2; + } + +- av_log(avctx, AV_LOG_INFO, "level=%d\n", avctx->level); ++ parse_extradata(avctx); ++ + ret = ff_v4l2_m2m_create_context(priv, &s); + if (ret < 0) + return ret; + +From 413f6a651d941c10bbf612eb787414cc213d02c6 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Mon, 20 Mar 2023 18:12:51 +0000 +Subject: [PATCH 117/120] clean_usr_libs: Now wipes the include files too + +When swapping ffmpeg versions obsolete makefiles could confuse +configure utilities. +--- + pi-util/clean_usr_libs.sh | 16 ++++++++++++++++ + 1 file changed, 16 insertions(+) + +diff --git a/pi-util/clean_usr_libs.sh b/pi-util/clean_usr_libs.sh +index b3b2d5509d..01bd6a6a22 100755 +--- a/pi-util/clean_usr_libs.sh ++++ b/pi-util/clean_usr_libs.sh +@@ -1,4 +1,20 @@ + set -e ++U=/usr/include/arm-linux-gnueabihf ++rm -rf $U/libavcodec ++rm -rf $U/libavdevice ++rm -rf $U/libavfilter ++rm -rf $U/libavformat ++rm -rf $U/libavutil ++rm -rf $U/libswresample ++rm -rf $U/libswscale ++U=/usr/include/aarch64-linux-gnu ++rm -rf $U/libavcodec ++rm -rf $U/libavdevice ++rm -rf $U/libavfilter ++rm -rf $U/libavformat ++rm -rf $U/libavutil ++rm -rf $U/libswresample ++rm -rf $U/libswscale + U=/usr/lib/arm-linux-gnueabihf + rm -f $U/libavcodec.* + rm -f $U/libavdevice.* + +From b76725ec990f3821793371a5f4b23b0243dbec97 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Mon, 20 Mar 2023 18:15:08 +0000 +Subject: [PATCH 118/120] vulkan: Add missing decode extension defines + +When building on bookworm the video decode extension names +were missing. This adds them. I expect this patch will be +obsolete shortly but it solves a current problem. +--- + libavutil/hwcontext_vulkan.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c +index 237caa4bc0..522acd1d88 100644 +--- a/libavutil/hwcontext_vulkan.c ++++ b/libavutil/hwcontext_vulkan.c +@@ -57,6 +57,14 @@ + #define CHECK_CU(x) FF_CUDA_CHECK_DL(cuda_cu, cu, x) + #endif + ++// Sometimes missing definitions ++#ifndef VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME ++#define VK_EXT_VIDEO_DECODE_H264_EXTENSION_NAME "VK_EXT_video_decode_h264" ++#endif ++#ifndef VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME ++#define VK_EXT_VIDEO_DECODE_H265_EXTENSION_NAME "VK_EXT_video_decode_h265" ++#endif ++ + typedef struct VulkanQueueCtx { + VkFence fence; + VkQueue queue; + +From 2bb2705c22cb11473129a21b5e4dcbfae3f5f79d Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Tue, 21 Mar 2023 14:20:05 +0000 +Subject: [PATCH 119/120] v4l2_m2m_dec: Fix config file for finding if decoder + enabled + +Fixes parsing of extradata for profile testing. 5.x changed where that +info is defined. +--- + libavcodec/v4l2_m2m_dec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index 636a825ab9..2215c6989f 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -21,7 +21,7 @@ + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +-#include "config.h" ++#include "config_components.h" + + #include + #include + +From 16b34ca779f373728ad4056a40eab70773ed5596 Mon Sep 17 00:00:00 2001 +From: John Cox +Date: Tue, 21 Mar 2023 14:23:20 +0000 +Subject: [PATCH 120/120] v4l2_m2m_dec: Display profile given if skipped in + debug + +--- + libavcodec/v4l2_m2m_dec.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/libavcodec/v4l2_m2m_dec.c b/libavcodec/v4l2_m2m_dec.c +index 2215c6989f..7681279fc2 100644 +--- a/libavcodec/v4l2_m2m_dec.c ++++ b/libavcodec/v4l2_m2m_dec.c +@@ -792,7 +792,7 @@ check_profile(AVCodecContext *const avctx, V4L2m2mContext *const s) + + // An unset profile is almost certainly zero or -99 - do not reject + if (avctx->profile <= 0) { +- av_log(avctx, AV_LOG_VERBOSE, "Profile <= 0 - check skipped\n"); ++ av_log(avctx, AV_LOG_VERBOSE, "Profile %d <= 0 - check skipped\n", avctx->profile); + return 0; + } + diff --git a/projects/RPi/patches/kodi/0005-support-arbitrary-pixel-formats.patch b/projects/RPi/patches/kodi/0005-support-arbitrary-pixel-formats.patch new file mode 100644 index 0000000000..5fe832be50 --- /dev/null +++ b/projects/RPi/patches/kodi/0005-support-arbitrary-pixel-formats.patch @@ -0,0 +1,332 @@ +From 4b60bcc31eddb776d0134c4f2a64ad36969bde1b Mon Sep 17 00:00:00 2001 +From: Dom Cobley +Date: Mon, 6 Feb 2023 15:19:51 +0000 +Subject: [PATCH] DVDVideoCodecDRMPRIME: Add support for arbitrary output pixel + formats + +This enables any ffmpeg pixel formats to be supported by DRMPRIME decoder +by creating a scale ffmpeg filter to convert it to a supported format. + +This allows formats like h264 Hi10P and hevc 12-bit 444 to be software decoded, +converted and displayed through DRM. + +This will be a cheaper path than disabling DRMPRIME, which is also +software decode, convert, but then needs convert to texture and display through GL. + +And it happens automatically without requiring user video settings +--- + .../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 124 +++++++++++------- + .../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 3 +- + 2 files changed, 77 insertions(+), 50 deletions(-) + +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp +index 347dce1ae8..e071de2e53 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp +@@ -201,7 +201,7 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct + { + for (int n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) + { +- if (IsSupportedHwFormat(fmt[n]) || IsSupportedSwFormat(fmt[n])) ++ //if (IsSupportedHwFormat(fmt[n]) || IsSupportedSwFormat(fmt[n])) + { + CDVDVideoCodecDRMPRIME* ctx = static_cast(avctx->opaque); + ctx->UpdateProcessInfo(avctx, fmt[n]); +@@ -222,7 +222,8 @@ enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avct + + int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* frame, int flags) + { +- if (IsSupportedSwFormat(static_cast(frame->format))) ++ AVPixelFormat pix_fmt = static_cast(frame->format); ++ if (IsSupportedSwFormat(pix_fmt)) + { + int width = frame->width; + int height = frame->height; +@@ -230,7 +231,7 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra + AlignedSize(avctx, width, height); + + int size; +- switch (avctx->pix_fmt) ++ switch (pix_fmt) + { + case AV_PIX_FMT_YUV420P: + case AV_PIX_FMT_YUVJ420P: +@@ -250,13 +251,12 @@ int CDVDVideoCodecDRMPRIME::GetBuffer(struct AVCodecContext* avctx, AVFrame* fra + + CDVDVideoCodecDRMPRIME* ctx = static_cast(avctx->opaque); + auto buffer = dynamic_cast( +- ctx->m_processInfo.GetVideoBufferManager().Get(avctx->pix_fmt, size, nullptr)); ++ ctx->m_processInfo.GetVideoBufferManager().Get(pix_fmt, size, nullptr)); + if (!buffer) + return -1; + +- frame->opaque = static_cast(buffer); + frame->opaque_ref = +- av_buffer_create(nullptr, 0, ReleaseBuffer, frame->opaque, AV_BUFFER_FLAG_READONLY); ++ av_buffer_create(nullptr, 0, ReleaseBuffer, static_cast(buffer), AV_BUFFER_FLAG_READONLY); + + buffer->Export(frame, width, height); + buffer->SyncStart(); +@@ -611,9 +611,9 @@ bool CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture) + buffer->SetRef(m_pFrame); + pVideoPicture->videoBuffer = buffer; + } +- else if (m_pFrame->opaque) ++ else if (IsSupportedSwFormat(static_cast(m_pFrame->format))) + { +- CVideoBufferDMA* buffer = static_cast(m_pFrame->opaque); ++ CVideoBufferDMA* buffer = static_cast(av_buffer_get_opaque(m_pFrame->buf[0])); + buffer->SetPictureParams(*pVideoPicture); + buffer->Acquire(); + buffer->SyncEnd(); +@@ -647,13 +647,13 @@ void CDVDVideoCodecDRMPRIME::FilterTest() + + if (name.find("deinterlace") != std::string::npos) + { +- if (FilterOpen(name, true)) ++ bool ret = FilterOpen(name, false, true); ++ FilterClose(); ++ if (ret) + { + m_deintFilterName = name; +- + CLog::Log(LOGDEBUG, "CDVDVideoCodecDRMPRIME::{} - found deinterlacing filter {}", + __FUNCTION__, name); +- + return; + } + } +@@ -663,14 +663,31 @@ void CDVDVideoCodecDRMPRIME::FilterTest() + __FUNCTION__); + } + +-bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) ++AVFrame *CDVDVideoCodecDRMPRIME::alloc_filter_frame(AVFilterContext * ctx, void * v, int w, int h) ++{ ++ int result; ++ CDVDVideoCodecDRMPRIME* me = static_cast(v); ++ AVFrame *frame = av_frame_alloc(); ++ frame->width = w; ++ frame->height = h; ++ frame->format = AV_PIX_FMT_YUV420P; ++ ++ if ((result = CDVDVideoCodecDRMPRIME::GetBuffer(me->m_pCodecContext, frame, 0)) < 0) ++ { ++ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::alloc_filter_frame - failed to GetBuffer ({})", result); ++ return nullptr; ++ } ++ return frame; ++} ++ ++bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool scale, bool test) + { + int result; + + if (m_pFilterGraph) + FilterClose(); + +- if (filters.empty()) ++ if (filters.empty() && !scale) + return true; + + if (!(m_pFilterGraph = avfilter_graph_alloc())) +@@ -681,13 +698,13 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + + const AVFilter* srcFilter = avfilter_get_by_name("buffer"); + const AVFilter* outFilter = avfilter_get_by_name("buffersink"); +- enum AVPixelFormat pix_fmts[] = { AV_PIX_FMT_DRM_PRIME, AV_PIX_FMT_NONE }; ++ enum AVPixelFormat pix_fmts[] = { scale ? AV_PIX_FMT_YUV420P : AV_PIX_FMT_DRM_PRIME, AV_PIX_FMT_NONE }; + + std::string args = StringUtils::Format("video_size={}x{}:pix_fmt={}:time_base={}/{}:" + "pixel_aspect={}/{}", + m_pCodecContext->width, + m_pCodecContext->height, +- AV_PIX_FMT_DRM_PRIME, ++ scale ? m_pCodecContext->pix_fmt : AV_PIX_FMT_DRM_PRIME, + m_pCodecContext->time_base.num ? + m_pCodecContext->time_base.num : 1, + m_pCodecContext->time_base.num ? +@@ -706,7 +723,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + CLog::Log(LOGERROR, + "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_create_filter: src: {} ({})", + err, result); +- FilterClose(); + return false; + } + +@@ -714,7 +730,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + if (!par) + { + CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - unable to alloc buffersrc"); +- FilterClose(); + return false; + } + +@@ -730,7 +745,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + CLog::Log(LOGERROR, + "CDVDVideoCodecDRMPRIME::FilterOpen - av_buffersrc_parameters_set: {} ({})", + err, result); +- FilterClose(); + return false; + } + av_freep(&par); +@@ -744,7 +758,6 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + CLog::Log(LOGERROR, + "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_create_filter: out: {} ({})", + err, result); +- FilterClose(); + return false; + } + +@@ -753,32 +766,46 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + if (result < 0) + { + CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - failed settings pix formats"); +- FilterClose(); + return false; + } + +- AVFilterInOut* outputs = avfilter_inout_alloc(); +- AVFilterInOut* inputs = avfilter_inout_alloc(); ++ if (!filters.empty()) ++ { ++ AVFilterInOut* outputs = avfilter_inout_alloc(); ++ AVFilterInOut* inputs = avfilter_inout_alloc(); + +- outputs->name = av_strdup("in"); +- outputs->filter_ctx = m_pFilterIn; +- outputs->pad_idx = 0; +- outputs->next = nullptr; ++ outputs->name = av_strdup("in"); ++ outputs->filter_ctx = m_pFilterIn; ++ outputs->pad_idx = 0; ++ outputs->next = nullptr; + +- inputs->name = av_strdup("out"); +- inputs->filter_ctx = m_pFilterOut; +- inputs->pad_idx = 0; +- inputs->next = nullptr; ++ inputs->name = av_strdup("out"); ++ inputs->filter_ctx = m_pFilterOut; ++ inputs->pad_idx = 0; ++ inputs->next = nullptr; + +- result = avfilter_graph_parse_ptr(m_pFilterGraph, filters.c_str(), &inputs, &outputs, NULL); +- avfilter_inout_free(&outputs); +- avfilter_inout_free(&inputs); ++ result = avfilter_graph_parse_ptr(m_pFilterGraph, filters.c_str(), &inputs, &outputs, NULL); ++ avfilter_inout_free(&outputs); ++ avfilter_inout_free(&inputs); + +- if (result < 0) ++ if (result < 0) ++ { ++ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_parse"); ++ return false; ++ } ++ } ++ else + { +- CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_parse"); +- FilterClose(); +- return false; ++ if ((result = av_buffersink_set_alloc_video_frame(m_pFilterOut, alloc_filter_frame, static_cast(this))) < 0) ++ { ++ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - av_buffersink_set_alloc_video_frame = {}", result); ++ return result; ++ } ++ if ((result = avfilter_link(m_pFilterIn, 0, m_pFilterOut, 0)) < 0) ++ { ++ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_link"); ++ return false; ++ } + } + + if ((result = avfilter_graph_config(m_pFilterGraph, nullptr)) < 0) +@@ -787,15 +814,11 @@ bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test) + av_strerror(result, err, AV_ERROR_MAX_STRING_SIZE); + CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - avfilter_graph_config: {} ({})", + err, result); +- FilterClose(); + return false; + } + + if (test) +- { +- FilterClose(); + return true; +- } + + m_processInfo.SetVideoDeintMethod(filters); + +@@ -830,16 +853,16 @@ void CDVDVideoCodecDRMPRIME::FilterClose() + CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn() + { + // sw decoded buffers need cache flush and for descripter to be set +- if (!IsSupportedHwFormat(static_cast(m_pFrame->format)) && m_pFrame->opaque != nullptr) ++ if (!IsSupportedHwFormat(static_cast(m_pFrame->format)) && IsSupportedSwFormat(static_cast(m_pFrame->format))) + { +- CVideoBufferDMA* buffer = static_cast(m_pFrame->opaque); ++ CVideoBufferDMA* buffer = static_cast(av_buffer_get_opaque(m_pFrame->buf[0])); + buffer->SetDimensions(m_pFrame->width, m_pFrame->height); + buffer->SyncEnd(); + auto descriptor = buffer->GetDescriptor(); + m_pFrame->data[0] = reinterpret_cast(descriptor); ++ m_pFrame->format = AV_PIX_FMT_DRM_PRIME; + } + +- m_pFrame->format = AV_PIX_FMT_DRM_PRIME; + int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame); + if (ret < 0) + { +@@ -932,25 +955,28 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo + return VC_ERROR; + } + ++ // we need to scale if the buffer isn't in DRM_PRIME format ++ bool need_scale = !IsSupportedSwFormat(static_cast(m_pFrame->format)) && !IsSupportedHwFormat(static_cast(m_pFrame->format)); ++ + if (!m_processInfo.GetVideoInterlaced() && m_pFrame->interlaced_frame) + m_processInfo.SetVideoInterlaced(true); + + std::string filterChain = GetFilterChain(m_pFrame->interlaced_frame); +- if (!filterChain.empty()) ++ if (!filterChain.empty() || need_scale) + { + bool reopenFilter = false; + if (m_filters != filterChain) + reopenFilter = true; + + if (m_pFilterGraph && +- (m_pFilterIn->outputs[0]->w != m_pCodecContext->width || +- m_pFilterIn->outputs[0]->h != m_pCodecContext->height)) ++ (m_pFilterIn->outputs[0]->w != m_pFrame->width || ++ m_pFilterIn->outputs[0]->h != m_pFrame->height)) + reopenFilter = true; + +- if (reopenFilter) ++ if (reopenFilter || (need_scale && m_pFilterGraph == nullptr)) + { + m_filters = filterChain; +- if (!FilterOpen(filterChain, false)) ++ if (!FilterOpen(filterChain, need_scale, false)) + FilterClose(); + } + +diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h +index fab3431d40..bb88fde1f9 100644 +--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h ++++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h +@@ -44,7 +44,8 @@ protected: + CDVDVideoCodec::VCReturn ProcessFilterOut(); + static enum AVPixelFormat GetFormat(struct AVCodecContext* avctx, const enum AVPixelFormat* fmt); + static int GetBuffer(struct AVCodecContext* avctx, AVFrame* frame, int flags); +- bool FilterOpen(const std::string& filters, bool test); ++ static AVFrame *alloc_filter_frame(AVFilterContext * ctx, void * v, int w, int h); ++ bool FilterOpen(const std::string& filters, bool scale, bool test); + void FilterClose(); + void FilterTest(); + std::string GetFilterChain(bool interlaced); +-- +2.39.2 + diff --git a/tools/ffmpeg/gen-patches.sh b/tools/ffmpeg/gen-patches.sh index f6d296e5e0..3b27067b07 100755 --- a/tools/ffmpeg/gen-patches.sh +++ b/tools/ffmpeg/gen-patches.sh @@ -38,7 +38,7 @@ create_patch() { ;; rpi) REPO="https://github.com/jc-kynesim/rpi-ffmpeg" - REFSPEC="dev/5.1.2/rpi_import_1" + REFSPEC="test/5.1.2/main" ;; *) echo "illegal feature set ${FEATURE_SET}"