mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-29 05:36:47 +00:00
kodi: rebase drmprime filter patches
Signed-off-by: Matthias Reichl <hias@horus.com>
This commit is contained in:
parent
f7f69a9a5c
commit
11cb4f2abd
@ -1,13 +1,15 @@
|
||||
From 6789405cbea23dd0d53ba5a6833dc2266f166ad9 Mon Sep 17 00:00:00 2001
|
||||
From a90ad221abf77aa38d34b52edf21a43f85aedac2 Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Sun, 20 Oct 2019 17:10:07 +0000
|
||||
Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
|
||||
---
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 68 ++++++++++++++++---
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 62 +++++++++++++++++--
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 10 +++
|
||||
2 files changed, 69 insertions(+), 9 deletions(-)
|
||||
2 files changed, 66 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
index 80ca60290c..40cde1ba6e 100644
|
||||
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
@@ -27,6 +27,8 @@
|
||||
@ -19,7 +21,7 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
#include <libavutil/error.h>
|
||||
#include <libavutil/imgutils.h>
|
||||
#include <libavutil/opt.h>
|
||||
@@ -559,18 +561,30 @@ void CDVDVideoCodecDRMPRIME::SetPictureP
|
||||
@@ -559,12 +561,30 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
|
||||
pVideoPicture->dts = DVD_NOPTS_VALUE;
|
||||
}
|
||||
|
||||
@ -30,19 +32,16 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
- Drain();
|
||||
+ if (!m_pFilterIn)
|
||||
+ return VC_PICTURE;
|
||||
|
||||
- if (pVideoPicture->videoBuffer)
|
||||
+
|
||||
+ int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame);
|
||||
+ if (ret < 0)
|
||||
{
|
||||
- pVideoPicture->videoBuffer->Release();
|
||||
- pVideoPicture->videoBuffer = nullptr;
|
||||
+ {
|
||||
+ char err[AV_ERROR_MAX_STRING_SIZE] = {};
|
||||
+ av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
|
||||
+ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::{} - buffersrc add frame failed: {} ({})",
|
||||
+ __FUNCTION__, err, ret);
|
||||
+ return VC_ERROR;
|
||||
}
|
||||
+ }
|
||||
|
||||
- int ret = avcodec_receive_frame(m_pCodecContext, m_pFrame);
|
||||
+ return ProcessFilterOut();
|
||||
@ -57,7 +56,7 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
if (ret == AVERROR(EAGAIN))
|
||||
return VC_BUFFER;
|
||||
else if (ret == AVERROR_EOF)
|
||||
@@ -587,11 +601,47 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD
|
||||
@@ -581,11 +601,41 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideo
|
||||
{
|
||||
char err[AV_ERROR_MAX_STRING_SIZE] = {};
|
||||
av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
|
||||
@ -76,12 +75,6 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
+ if (m_codecControlFlags & DVD_CODEC_CTRL_DRAIN)
|
||||
+ Drain();
|
||||
+
|
||||
+ if (pVideoPicture->videoBuffer)
|
||||
+ {
|
||||
+ pVideoPicture->videoBuffer->Release();
|
||||
+ pVideoPicture->videoBuffer = nullptr;
|
||||
+ }
|
||||
+
|
||||
+ auto result = ProcessFilterOut();
|
||||
+ if (result != VC_PICTURE)
|
||||
+ {
|
||||
@ -106,7 +99,9 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
+
|
||||
SetPictureParams(pVideoPicture);
|
||||
|
||||
if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
|
||||
if (pVideoPicture->videoBuffer)
|
||||
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
index db49d165e7..b5cacf1a3c 100644
|
||||
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
@@ -14,6 +14,11 @@
|
||||
@ -139,3 +134,6 @@ Subject: [PATCH 1/2] WIP: DVDVideoCodecDRMPRIME: add support for filters
|
||||
+ AVFilterContext* m_pFilterOut = nullptr;
|
||||
std::shared_ptr<IVideoBufferPool> m_videoBufferPool;
|
||||
};
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
@ -1,16 +1,18 @@
|
||||
From 58f2acdc63d85eb9818d783a9a858b1ecc267fa7 Mon Sep 17 00:00:00 2001
|
||||
From 60c20b00749ddf3ffd8cbb7a3cd3778fb8af13fc Mon Sep 17 00:00:00 2001
|
||||
From: Jernej Skrabec <jernej.skrabec@siol.net>
|
||||
Date: Thu, 26 Dec 2019 11:01:51 +0100
|
||||
Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
|
||||
---
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 368 +++++++++++++++---
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp | 378 +++++++++++++++---
|
||||
.../DVDCodecs/Video/DVDVideoCodecDRMPRIME.h | 9 +-
|
||||
2 files changed, 322 insertions(+), 55 deletions(-)
|
||||
2 files changed, 327 insertions(+), 60 deletions(-)
|
||||
|
||||
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
index 40cde1ba6e..6588abec6d 100644
|
||||
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
|
||||
@@ -79,12 +79,15 @@ CDVDVideoCodecDRMPRIME::CDVDVideoCodecDR
|
||||
@@ -79,12 +79,15 @@ CDVDVideoCodecDRMPRIME::CDVDVideoCodecDRMPRIME(CProcessInfo& processInfo)
|
||||
: CDVDVideoCodec(processInfo)
|
||||
{
|
||||
m_pFrame = av_frame_alloc();
|
||||
@ -26,7 +28,7 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
avcodec_free_context(&m_pCodecContext);
|
||||
}
|
||||
|
||||
@@ -341,8 +344,19 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDSt
|
||||
@@ -341,8 +344,19 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
|
||||
}
|
||||
|
||||
UpdateProcessInfo(m_pCodecContext, m_pCodecContext->pix_fmt);
|
||||
@ -65,11 +67,17 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
{
|
||||
pVideoPicture->iWidth = m_pFrame->width;
|
||||
pVideoPicture->iHeight = m_pFrame->height;
|
||||
@@ -559,13 +575,232 @@ void CDVDVideoCodecDRMPRIME::SetPictureP
|
||||
@@ -559,13 +575,238 @@ void CDVDVideoCodecDRMPRIME::SetPictureParams(VideoPicture* pVideoPicture)
|
||||
? DVD_NOPTS_VALUE
|
||||
: static_cast<double>(pts) * DVD_TIME_BASE / AV_TIME_BASE;
|
||||
pVideoPicture->dts = DVD_NOPTS_VALUE;
|
||||
+
|
||||
+ if (pVideoPicture->videoBuffer)
|
||||
+ {
|
||||
+ pVideoPicture->videoBuffer->Release();
|
||||
+ pVideoPicture->videoBuffer = nullptr;
|
||||
+ }
|
||||
+
|
||||
+ if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
|
||||
+ {
|
||||
+ CVideoBufferDRMPRIMEFFmpeg* buffer =
|
||||
@ -132,9 +140,7 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+}
|
||||
+
|
||||
+bool CDVDVideoCodecDRMPRIME::FilterOpen(const std::string& filters, bool test)
|
||||
{
|
||||
- if (!m_pFilterIn)
|
||||
- return VC_PICTURE;
|
||||
+{
|
||||
+ int result;
|
||||
+
|
||||
+ if (m_pFilterGraph)
|
||||
@ -148,7 +154,7 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::FilterOpen - unable to alloc filter graph");
|
||||
+ return false;
|
||||
+ }
|
||||
|
||||
+
|
||||
+ 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 };
|
||||
@ -284,7 +290,9 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+}
|
||||
+
|
||||
+void CDVDVideoCodecDRMPRIME::FilterClose()
|
||||
+{
|
||||
{
|
||||
- if (!m_pFilterIn)
|
||||
- return VC_PICTURE;
|
||||
+ if (m_pFilterGraph)
|
||||
+ {
|
||||
+ CLog::Log(LOGDEBUG, LOGVIDEO, "CDVDVideoCodecDRMPRIME::FilterClose - Freeing filter graph");
|
||||
@ -295,13 +303,13 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+ m_pFilterOut = nullptr;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
|
||||
+CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
|
||||
+{
|
||||
int ret = av_buffersrc_add_frame(m_pFilterIn, m_pFrame);
|
||||
if (ret < 0)
|
||||
{
|
||||
@@ -581,21 +816,14 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD
|
||||
@@ -581,21 +822,14 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterIn()
|
||||
|
||||
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterOut()
|
||||
{
|
||||
@ -327,7 +335,7 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
}
|
||||
else if (ret)
|
||||
{
|
||||
@@ -606,9 +834,27 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD
|
||||
@@ -606,71 +840,97 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::ProcessFilterOut()
|
||||
return VC_ERROR;
|
||||
}
|
||||
|
||||
@ -355,9 +363,7 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
CDVDVideoCodec::VCReturn CDVDVideoCodecDRMPRIME::GetPicture(VideoPicture* pVideoPicture)
|
||||
{
|
||||
if (m_codecControlFlags & DVD_CODEC_CTRL_DRAIN)
|
||||
@@ -620,57 +866,71 @@ CDVDVideoCodec::VCReturn CDVDVideoCodecD
|
||||
pVideoPicture->videoBuffer = nullptr;
|
||||
}
|
||||
Drain();
|
||||
|
||||
- auto result = ProcessFilterOut();
|
||||
- if (result != VC_PICTURE)
|
||||
@ -380,23 +386,29 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+ if (!SetPictureParams(pVideoPicture))
|
||||
+ return VC_ERROR;
|
||||
+ return VC_PICTURE;
|
||||
}
|
||||
+ }
|
||||
+ else if (ret != VC_BUFFER)
|
||||
+ {
|
||||
+ return ret;
|
||||
+ }
|
||||
+ }
|
||||
|
||||
}
|
||||
-
|
||||
- result = ProcessFilterIn();
|
||||
- if (result != VC_PICTURE)
|
||||
- return result;
|
||||
}
|
||||
|
||||
- SetPictureParams(pVideoPicture);
|
||||
-
|
||||
- if (pVideoPicture->videoBuffer)
|
||||
+ int ret = avcodec_receive_frame(m_pCodecContext, m_pFrame);
|
||||
+ if (ret == AVERROR(EAGAIN))
|
||||
+ return VC_BUFFER;
|
||||
+ else if (ret == AVERROR_EOF)
|
||||
+ return VC_EOF;
|
||||
+ else if (ret)
|
||||
+ {
|
||||
{
|
||||
- pVideoPicture->videoBuffer->Release();
|
||||
- pVideoPicture->videoBuffer = nullptr;
|
||||
+ char err[AV_ERROR_MAX_STRING_SIZE] = {};
|
||||
+ av_strerror(ret, err, AV_ERROR_MAX_STRING_SIZE);
|
||||
+ CLog::Log(LOGERROR, "CDVDVideoCodecDRMPRIME::{} - receive frame failed: {} ({})",
|
||||
@ -404,11 +416,10 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
+ return VC_ERROR;
|
||||
}
|
||||
|
||||
- SetPictureParams(pVideoPicture);
|
||||
- if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
|
||||
+ if (!m_processInfo.GetVideoInterlaced() && m_pFrame->interlaced_frame)
|
||||
+ m_processInfo.SetVideoInterlaced(true);
|
||||
|
||||
- if (IsSupportedHwFormat(static_cast<AVPixelFormat>(m_pFrame->format)))
|
||||
+
|
||||
+ std::string filterChain = GetFilterChain(m_pFrame->interlaced_frame);
|
||||
+ if (!filterChain.empty())
|
||||
{
|
||||
@ -465,6 +476,8 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
|
||||
return VC_PICTURE;
|
||||
}
|
||||
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
index b5cacf1a3c..fab3431d40 100644
|
||||
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
|
||||
@@ -38,19 +38,26 @@ public:
|
||||
@ -495,3 +508,6 @@ Subject: [PATCH 2/2] WIP: DRMPRIME deinterlace filter
|
||||
AVFilterGraph* m_pFilterGraph = nullptr;
|
||||
AVFilterContext* m_pFilterIn = nullptr;
|
||||
AVFilterContext* m_pFilterOut = nullptr;
|
||||
--
|
||||
2.34.1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user