aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Karlman <jonas@kwiboo.se>2019-04-22 20:03:55 +0000
committerJonas Karlman <jonas@kwiboo.se>2019-06-13 22:16:10 +0000
commitc4a2887538a53eab5b9254c43ce29f469db4291d (patch)
tree87cd8ed084615327d130df642c002366ce535d4f
parentb89d0a4a03b4e18b93619b41b3f76d3ef1cf6ac3 (diff)
DVDVideoCodecDRMPRIME: update process info in get format callback
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp30
-rw-r--r--xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h2
2 files changed, 23 insertions, 9 deletions
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
index 8db92f15ff..48796e944b 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.cpp
@@ -90,11 +90,17 @@ static const AVCodec* FindDecoder(CDVDStreamInfo& hints)
return nullptr;
}
-static enum AVPixelFormat GetFormat(struct AVCodecContext* avctx, const enum AVPixelFormat* fmt)
+enum AVPixelFormat CDVDVideoCodecDRMPRIME::GetFormat(struct AVCodecContext* avctx, const enum AVPixelFormat* fmt)
{
for (int n = 0; fmt[n] != AV_PIX_FMT_NONE; n++)
+ {
if (fmt[n] == AV_PIX_FMT_DRM_PRIME)
+ {
+ CDVDVideoCodecDRMPRIME* ctx = static_cast<CDVDVideoCodecDRMPRIME*>(avctx->opaque);
+ ctx->UpdateProcessInfo(avctx, fmt[n]);
return fmt[n];
+ }
+ }
return AV_PIX_FMT_NONE;
}
@@ -129,6 +135,7 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
}
m_pCodecContext->pix_fmt = AV_PIX_FMT_DRM_PRIME;
+ m_pCodecContext->opaque = static_cast<void*>(this);
m_pCodecContext->get_format = GetFormat;
m_pCodecContext->codec_tag = hints.codec_tag;
m_pCodecContext->coded_width = hints.width;
@@ -151,20 +158,25 @@ bool CDVDVideoCodecDRMPRIME::Open(CDVDStreamInfo& hints, CDVDCodecOptions& optio
return false;
}
- const char* pixFmtName = av_get_pix_fmt_name(m_pCodecContext->pix_fmt);
- m_processInfo.SetVideoPixelFormat(pixFmtName ? pixFmtName : "");
- m_processInfo.SetVideoDimensions(hints.width, hints.height);
+ UpdateProcessInfo(m_pCodecContext, m_pCodecContext->pix_fmt);
m_processInfo.SetVideoDeintMethod("none");
m_processInfo.SetVideoDAR(hints.aspect);
- if (pCodec->name)
- m_name = std::string("ff-") + pCodec->name;
+ return true;
+}
+
+void CDVDVideoCodecDRMPRIME::UpdateProcessInfo(struct AVCodecContext* avctx, const enum AVPixelFormat pix_fmt)
+{
+ const char* pixFmtName = av_get_pix_fmt_name(pix_fmt);
+ m_processInfo.SetVideoPixelFormat(pixFmtName ? pixFmtName : "");
+ m_processInfo.SetVideoDimensions(avctx->coded_width, avctx->coded_height);
+
+ if (avctx->codec && avctx->codec->name)
+ m_name = std::string("ff-") + avctx->codec->name;
else
m_name = "ffmpeg";
- m_processInfo.SetVideoDecoderName(m_name, true);
-
- return true;
+ m_processInfo.SetVideoDecoderName(m_name, pix_fmt == AV_PIX_FMT_DRM_PRIME);
}
bool CDVDVideoCodecDRMPRIME::AddData(const DemuxPacket& packet)
diff --git a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
index 676397ee6a..8d399eb5bc 100644
--- a/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
+++ b/xbmc/cores/VideoPlayer/DVDCodecs/Video/DVDVideoCodecDRMPRIME.h
@@ -34,6 +34,8 @@ public:
protected:
void Drain();
void SetPictureParams(VideoPicture* pVideoPicture);
+ void UpdateProcessInfo(struct AVCodecContext* avctx, const enum AVPixelFormat fmt);
+ static enum AVPixelFormat GetFormat(struct AVCodecContext* avctx, const enum AVPixelFormat* fmt);
std::string m_name;
int m_codecControlFlags = 0;