From 0950395671470e0299184c11154eedbf66e33b9f Mon Sep 17 00:00:00 2001 From: misaka00251 Date: Mon, 1 Apr 2024 11:32:41 +0800 Subject: [PATCH] Add patch to fix chromium build on riscv64 & Cleanup patches (cherry picked from commit 8f7261da7d32ae05f518f0566760c9a0b34aa317) --- avformat-get_first_dts.patch | 46 ++++++++++++++++++++++++++++++++++++ ffmpeg.spec | 16 ++++++++----- fix-vmaf-model-path.patch | 13 ---------- 3 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 avformat-get_first_dts.patch delete mode 100644 fix-vmaf-model-path.patch diff --git a/avformat-get_first_dts.patch b/avformat-get_first_dts.patch new file mode 100644 index 0000000..cabb6b8 --- /dev/null +++ b/avformat-get_first_dts.patch @@ -0,0 +1,46 @@ +commit 95aab0fd83619408995720ce53d7a74790580220 +author liberato@chromium.org Thu Jul 08 02:01:22 2021 +committer liberato@chromium.org Thu Jul 08 02:01:22 2021 +tree ac725b5e2c548c8142aa7096d8184d87d3876a49 +parent e073b7a22e4993e0a7cab80a42a21524e5349f95 + +Add av_stream_get_first_dts for Chromium + +--- + libavformat/avformat.h | 4 ++++ + libavformat/utils.c | 7 +++++++ + 2 files changed, 11 insertions(+) + +Index: ffmpeg-6.1.1/libavformat/avformat.h +=================================================================== +--- ffmpeg-6.1.1.orig/libavformat/avformat.h ++++ ffmpeg-6.1.1/libavformat/avformat.h +@@ -1030,6 +1030,10 @@ attribute_deprecated + int64_t av_stream_get_end_pts(const AVStream *st); + #endif + ++// Chromium: We use the internal field first_dts vvv ++int64_t av_stream_get_first_dts(const AVStream *st); ++// Chromium: We use the internal field first_dts ^^^ ++ + #define AV_PROGRAM_RUNNING 1 + + /** +Index: ffmpeg-6.1.1/libavformat/utils.c +=================================================================== +--- ffmpeg-6.1.1.orig/libavformat/utils.c ++++ ffmpeg-6.1.1/libavformat/utils.c +@@ -56,6 +56,13 @@ int ff_unlock_avformat(void) + return ff_mutex_unlock(&avformat_mutex) ? -1 : 0; + } + ++// Chromium: We use the internal field first_dts vvv ++int64_t av_stream_get_first_dts(const AVStream *st) ++{ ++ return cffstream(st)->first_dts; ++} ++// Chromium: We use the internal field first_dts ^^^ ++ + /* an arbitrarily chosen "sane" max packet size -- 50M */ + #define SANE_CHUNK_SIZE (50000000) + diff --git a/ffmpeg.spec b/ffmpeg.spec index 25414d1..1d7eab5 100644 --- a/ffmpeg.spec +++ b/ffmpeg.spec @@ -20,10 +20,8 @@ %global _without_xvid 1 %endif -# Disable nvenc when not relevant -%ifnarch %{cuda_arches} -%global _without_nvenc 1 -%endif +# Disable nvenc +%global _without_nvenc 0 # extras flags %if 0%{!?_cuda_version:1} @@ -61,11 +59,14 @@ ExclusiveArch: armv7hnl Summary: Digital VCR and streaming server Name: ffmpeg%{?flavor} Version: 6.1.1 -Release: 1 +Release: 2 License: GPL-3.0-or-later URL: http://ffmpeg.org/ Source0: http://ffmpeg.org/releases/ffmpeg-%{version}.tar.xz -# Patch0: fix-vmaf-model-path.patch +%ifarch riscv64 +# Special patch for building chromium on riscv64 +Patch0: avformat-get_first_dts.patch +%endif Requires: %{name}-libs%{?_isa} = %{version}-%{release} %{?_with_cuda:BuildRequires: cuda-minimal-build-%{_cuda_version_rpm} cuda-drivers-devel} @@ -394,6 +395,9 @@ install -pm755 tools/qt-faststart %{buildroot}%{_bindir} %changelog +* Wed Apr 03 2024 misaka00251 - 6.1.1-2 +- Add patch to fix chromium build on riscv64 & Cleanup patches + * Thu Feb 22 2024 Dongxing Wang - 6.1.1-1 - Upgrade to 6.1.1 to fix Eulermaker failure diff --git a/fix-vmaf-model-path.patch b/fix-vmaf-model-path.patch deleted file mode 100644 index 5a5500a..0000000 --- a/fix-vmaf-model-path.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libavfilter/vf_libvmaf.c b/libavfilter/vf_libvmaf.c -index 4d49127..bd6f451 100644 ---- a/libavfilter/vf_libvmaf.c -+++ b/libavfilter/vf_libvmaf.c -@@ -72,7 +72,7 @@ typedef struct LIBVMAFContext { - #define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM - - static const AVOption libvmaf_options[] = { -- {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/local/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS}, -+ {"model_path", "Set the model to be used for computing vmaf.", OFFSET(model_path), AV_OPT_TYPE_STRING, {.str="/usr/share/model/vmaf_v0.6.1.pkl"}, 0, 1, FLAGS}, - {"log_path", "Set the file path to be used to store logs.", OFFSET(log_path), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS}, - {"log_fmt", "Set the format of the log (csv, json or xml).", OFFSET(log_fmt), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, FLAGS}, - {"enable_transform", "Enables transform for computing vmaf.", OFFSET(enable_transform), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, FLAGS}, -- Gitee