distribution/packages/multimedia/ffmpeg/patches/libreelec/ffmpeg-001-libreelec.patch

74 lines
2.6 KiB
Diff
Raw Normal View History

2022-07-12 10:52:40 +00:00
From 8f7c8a0f9e28641880d72996b9452e0a9da1288c 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
call ff_get_format
This will allow applications to properly init the decoder in
cases where a hardware decoder is tried first and and software
decoder is tried after by calling the get_format callback.
Even though there is no hardware pixel formats available
we still need to return the software pixel format.
Tested with Kodi by checking if multithreaded software
decoding is properly activated.
---
libavcodec/libdav1d.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/libavcodec/libdav1d.c b/libavcodec/libdav1d.c
index 3c2a68b7e0..68996426cc 100644
--- a/libavcodec/libdav1d.c
+++ b/libavcodec/libdav1d.c
@@ -58,6 +58,16 @@ static const enum AVPixelFormat pix_fmt_rgb[3] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12,
};
+static enum AVPixelFormat libdav1d_get_format(AVCodecContext *avctx, const Dav1dPicture *p)
+{
+ enum AVPixelFormat pix_fmts[2], *fmt = pix_fmts;
+
+ *fmt++ = pix_fmt[p->p.layout][p->seq_hdr->hbd];
+ *fmt = AV_PIX_FMT_NONE;
+
+ return ff_get_format(avctx, pix_fmts);
+}
+
static void libdav1d_log_callback(void *opaque, const char *fmt, va_list vl)
{
AVCodecContext *c = opaque;
@@ -264,6 +274,7 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
c->profile = p->seq_hdr->profile;
c->level = ((p->seq_hdr->operating_points[0].major_level - 2) << 2)
| p->seq_hdr->operating_points[0].minor_level;
+ frame->format = c->pix_fmt = libdav1d_get_format(c, p);
frame->width = p->p.w;
frame->height = p->p.h;
if (c->width != p->p.w || c->height != p->p.h) {
From 635cf67be3d37159c96e75f00399b3e232372251 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
---
libswscale/yuv2rgb.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/libswscale/yuv2rgb.c b/libswscale/yuv2rgb.c
index 6a3956e8e2..d6f9aea166 100644
--- a/libswscale/yuv2rgb.c
+++ b/libswscale/yuv2rgb.c
@@ -688,10 +688,6 @@ SwsFunc ff_yuv2rgb_get_func_ptr(SwsContext *c)
if (t)
return t;
- av_log(c, AV_LOG_WARNING,
- "No accelerated colorspace conversion found from %s to %s.\n",
- av_get_pix_fmt_name(c->srcFormat), av_get_pix_fmt_name(c->dstFormat));
-
switch (c->dstFormat) {
case AV_PIX_FMT_BGR48BE:
case AV_PIX_FMT_BGR48LE: