aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDjihad Mahboubi <76681596+Djihads80@users.noreply.github.com>2026-11-01 17:25:14 +0100
committerGitHub <noreply@github.com>2026-11-01 17:25:14 +0100
commit6957331b913bd50dfab106071e8c7ff4fa662599 (patch)
treed4e4aea57d2b0198009576b16aa25fb4394dc176
parentfce9c5fd25c66558eb8ed4e9e5ca9129589a5e7d (diff)
parent959973a76abaa5444b4b300c37b6d8245ac89396 (diff)
Merge pull request #218 from Djihads80/fix/nx2-video-av1
nx2: play AV1 movies (FFmpeg with dav1d on Windows and Linux x86_64)
-rw-r--r--cpmfile.json7
-rw-r--r--externals/ffmpeg/CMakeLists.txt8
-rw-r--r--src/video_core/host1x/codecs/codec.cpp2
-rw-r--r--src/video_core/host1x/ffmpeg.cpp2
-rw-r--r--src/video_core/host1x/nvdec_common.h1
-rw-r--r--src/video_core/host1x/nx2_video_decoder.cpp4
6 files changed, 23 insertions, 1 deletions
diff --git a/cpmfile.json b/cpmfile.json
index 20e7c92c97..341e5b2c9f 100644
--- a/cpmfile.json
+++ b/cpmfile.json
@@ -81,6 +81,13 @@
"repo": "crueter-ci/FFmpeg",
"version": "9.0.2-1790726865-946fcce07b"
},
+ "ffmpeg-ci-av1": {
+ "ci": true,
+ "name": "ffmpeg",
+ "package": "FFmpeg",
+ "repo": "Takoroka/ffmpeg-av1",
+ "version": "9.0.2-av1-1"
+ },
"fmt": {
"hash": "f0da82c545b01692e9fd30fdfb613dbb8dd9716983dcd0ff19ac2a8d36f74beb5540ef38072fdecc1e34191b3682a8542ecbf3a61ef287dbba0a2679d4e023f2",
"min_version": "8",
diff --git a/externals/ffmpeg/CMakeLists.txt b/externals/ffmpeg/CMakeLists.txt
index f1bf099c10..890de4303c 100644
--- a/externals/ffmpeg/CMakeLists.txt
+++ b/externals/ffmpeg/CMakeLists.txt
@@ -179,7 +179,13 @@ elseif (MANAGARM)
endif()
if (YUZU_USE_BUNDLED_FFMPEG)
- AddJsonPackage(ffmpeg-ci)
+ # Windows (MSVC) and Linux x86_64 get the same FFmpeg with libdav1d, for Switch 2 titles' AV1
+ # movies; crueter-ci's packages, used elsewhere, have no AV1 decoder.
+ if ((MSVC OR LINUX) AND CPMUTIL_AMD64)
+ AddJsonPackage(ffmpeg-ci-av1)
+ else()
+ AddJsonPackage(ffmpeg-ci)
+ endif()
set(FFmpeg_INCLUDE_DIR
"${FFmpeg_SOURCE_DIR}/include;${FFmpeg_HWACCEL_INCLUDE_DIRS}"
diff --git a/src/video_core/host1x/codecs/codec.cpp b/src/video_core/host1x/codecs/codec.cpp
index 56332866e5..3cbef1d891 100644
--- a/src/video_core/host1x/codecs/codec.cpp
+++ b/src/video_core/host1x/codecs/codec.cpp
@@ -104,6 +104,8 @@ std::string_view Codec::GetCurrentCodecName() const {
return "H265";
case Host1x::NvdecCommon::VideoCodec::VP9:
return "VP9";
+ case Host1x::NvdecCommon::VideoCodec::AV1:
+ return "AV1";
default:
return "Unknown";
}
diff --git a/src/video_core/host1x/ffmpeg.cpp b/src/video_core/host1x/ffmpeg.cpp
index 676e5820a5..1af8307adc 100644
--- a/src/video_core/host1x/ffmpeg.cpp
+++ b/src/video_core/host1x/ffmpeg.cpp
@@ -163,6 +163,8 @@ Decoder::Decoder(Tegra::Host1x::NvdecCommon::VideoCodec codec) {
return AV_CODEC_ID_VP8;
case Tegra::Host1x::NvdecCommon::VideoCodec::VP9:
return AV_CODEC_ID_VP9;
+ case Tegra::Host1x::NvdecCommon::VideoCodec::AV1:
+ return AV_CODEC_ID_AV1;
default:
UNIMPLEMENTED_MSG("Unknown codec {}", codec);
return AV_CODEC_ID_NONE;
diff --git a/src/video_core/host1x/nvdec_common.h b/src/video_core/host1x/nvdec_common.h
index 0857a9f95c..26d7c86c98 100644
--- a/src/video_core/host1x/nvdec_common.h
+++ b/src/video_core/host1x/nvdec_common.h
@@ -22,6 +22,7 @@ enum class VideoCodec : u64 {
VP8 = 0x5,
H265 = 0x7,
VP9 = 0x9,
+ AV1 = 0xA,
};
struct Offset {
diff --git a/src/video_core/host1x/nx2_video_decoder.cpp b/src/video_core/host1x/nx2_video_decoder.cpp
index 7d185ca573..9b34bd84af 100644
--- a/src/video_core/host1x/nx2_video_decoder.cpp
+++ b/src/video_core/host1x/nx2_video_decoder.cpp
@@ -35,6 +35,10 @@ std::optional<NvdecCommon::VideoCodec> CodecFromMime(std::string_view mime) {
if (mime.find("vp8") != std::string_view::npos) {
return NvdecCommon::VideoCodec::VP8;
}
+ // "video/av01" or "video/av1". FFmpeg decodes AV1 with libdav1d.
+ if (mime.find("av01") != std::string_view::npos || mime.find("av1") != std::string_view::npos) {
+ return NvdecCommon::VideoCodec::AV1;
+ }
if (mime.find("avc") != std::string_view::npos || mime.find("264") != std::string_view::npos) {
return NvdecCommon::VideoCodec::H264;
}