From b2f5b16ea9c8da762f9dd602fd595d94f66b19d7 Mon Sep 17 00:00:00 2001 From: phunkyfish Date: Mon, 29 Jan 2024 10:11:21 +0000 Subject: [PATCH] VideoPlayer: VAAPI - Add av1 hw decoding --- src/stream/DemuxStream.h | 1 + src/stream/FFmpegStream.cpp | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/src/stream/DemuxStream.h b/src/stream/DemuxStream.h index fb03e322..2869fce1 100644 --- a/src/stream/DemuxStream.h +++ b/src/stream/DemuxStream.h @@ -112,6 +112,7 @@ class DemuxStreamVideo : public DemuxStream int iOrientation = 0; // orientation of the video in degrees counter clockwise int iBitsPerPixel = 0; int iBitRate = 0; + int iBitDepth = 0; AVColorSpace colorSpace = AVCOL_SPC_UNSPECIFIED; AVColorRange colorRange = AVCOL_RANGE_UNSPECIFIED; diff --git a/src/stream/FFmpegStream.cpp b/src/stream/FFmpegStream.cpp index 216b54b9..97e3143f 100644 --- a/src/stream/FFmpegStream.cpp +++ b/src/stream/FFmpegStream.cpp @@ -41,6 +41,11 @@ extern "C" { using namespace ffmpegdirect; using namespace kodi::tools; +extern "C" +{ +#include "libavutil/pixdesc.h" +} + /*********************************************************** * InputSteam Client AddOn specific public library functions ***********************************************************/ @@ -2033,6 +2038,11 @@ DemuxStream* FFmpegStream::AddStream(int streamIdx) st->iOrientation = 0; st->iBitsPerPixel = pStream->codecpar->bits_per_coded_sample; st->iBitRate = static_cast(pStream->codecpar->bit_rate); + st->iBitDepth = 8; + const AVPixFmtDescriptor* desc = + av_pix_fmt_desc_get(static_cast(pStream->codecpar->format)); + if (desc != nullptr && desc->comp != nullptr) + st->iBitDepth = desc->comp[0].depth; st->colorPrimaries = pStream->codecpar->color_primaries; st->colorSpace = pStream->codecpar->color_space;