diff --git a/other/ffmpeg_hevc_ac3.patch b/other/ffmpeg_hevc_ac3.patch index a6449d8d..00f53658 100644 --- a/other/ffmpeg_hevc_ac3.patch +++ b/other/ffmpeg_hevc_ac3.patch @@ -338,7 +338,7 @@ index c9666ae199..75415127f1 100644 + &ff_ac3_fixed_decoder, NULL }; diff --git a/chromium/config/Chrome/win/x64/libavcodec/parser_list.c b/chromium/config/Chrome/win/x64/libavcodec/parser_list.c -index c85087a596..d57aae769c 100644 +index c85087a596..a9e086ef6d 100644 --- a/chromium/config/Chrome/win/x64/libavcodec/parser_list.c +++ b/chromium/config/Chrome/win/x64/libavcodec/parser_list.c @@ -7,4 +7,5 @@ static const AVCodecParser * const parser_list[] = { @@ -359,10 +359,10 @@ index 920b22bfa7..d6d293dc60 100644 + &ff_eac3_demuxer, NULL }; diff --git a/ffmpeg_generated.gni b/ffmpeg_generated.gni -index 16e1b7c3ff..b5a6b146da 100644 +index 16e1b7c3ff..21439c5672 100644 --- a/ffmpeg_generated.gni +++ b/ffmpeg_generated.gni -@@ -265,7 +265,37 @@ if ((is_apple && ffmpeg_branding == "Chrome") || +@@ -265,7 +265,19 @@ if ((is_apple && ffmpeg_branding == "Chrome") || "libavcodec/hevc_sei.c", "libavcodec/hevcdec.c", "libavcodec/hevcdsp.c", @@ -380,24 +380,18 @@ index 16e1b7c3ff..b5a6b146da 100644 + "libavcodec/eac3_data.c", + "libavcodec/ac3dec_fixed.c", + "libavformat/ac3dec.c", -+ ] -+ -+ ffmpeg_c_sources += [ -+ "libavcodec/x86/bswapdsp_init.c", -+ "libavcodec/x86/hevcdsp_init.c" -+ ] -+ -+ ffmpeg_asm_sources += [ -+ "libavcodec/x86/bswapdsp.asm", -+ "libavcodec/x86/hevc_add_res.asm", -+ "libavcodec/x86/hevc_deblock.asm", -+ "libavcodec/x86/hevc_idct.asm", -+ "libavcodec/x86/hevc_mc.asm", -+ "libavcodec/x86/hevc_sao.asm", -+ "libavcodec/x86/hevc_sao_10bit.asm", -+ "libavcodec/x86/ac3dsp.asm", -+ "libavcodec/x86/ac3dsp_downmix.asm", -+ "libavcodec/x86/fmtconvert.asm", + ] + + ffmpeg_c_sources += [ +@@ -324,7 +336,10 @@ if ((is_apple && current_cpu == "x64" && ffmpeg_branding == "Chrome") || + "libavcodec/x86/hevc_mc.asm", + "libavcodec/x86/hevc_sao.asm", + "libavcodec/x86/hevc_sao_10bit.asm", +- "libavcodec/x86/h26x/h2656_inter.asm" ++ "libavcodec/x86/h26x/h2656_inter.asm", ++ "libavcodec/x86/ac3dsp.asm", ++ "libavcodec/x86/ac3dsp_downmix.asm", ++ "libavcodec/x86/fmtconvert.asm" ] ffmpeg_c_sources += [ diff --git a/patch_ac3.sh b/patch_ac3.sh new file mode 100755 index 00000000..29e58072 --- /dev/null +++ b/patch_ac3.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# Copyright (c) 2024 Alex313031. + +YEL='\033[1;33m' # Yellow +CYA='\033[1;96m' # Cyan +RED='\033[1;31m' # Red +GRE='\033[1;32m' # Green +c0='\033[0m' # Reset Text +bold='\033[1m' # Bold Text +underline='\033[4m' # Underline Text + +# Error handling +yell() { echo "$0: $*" >&2; } +die() { yell "$*"; exit 111; } +try() { "$@" || die "${RED}Failed $*"; } + +# --help +displayHelp () { + printf "\n" && + printf "${bold}${GRE}Script to patch Chromium's FFMPEG for AC3/EAC3 support.${c0}\n" && + printf "\n" +} +case $1 in + --help) displayHelp; exit 0;; +esac + +# chromium/src dir env variable +if [ -z "${CR_DIR}" ]; then + CR_SRC_DIR="$HOME/chromium/src" + export CR_SRC_DIR +else + CR_SRC_DIR="${CR_DIR}" + export CR_SRC_DIR +fi + +printf "\n" && +printf "${bold}${GRE}Script to patch Chromium's FFMPEG for AC3/EAC3 support.${c0}\n" && + +printf "\n" && +printf "${YEL}Patching FFMPEG for AC3 & E-AC3...${c0}\n" && + +cp -v other/ffmpeg_hevc_ac3.patch ${CR_SRC_DIR}/third_party/ffmpeg/ && +cd ${CR_SRC_DIR}/third_party/ffmpeg && +git apply --reject ./ffmpeg_hevc_ac3.patch && + +tput sgr0 diff --git a/setup.sh b/setup.sh index a3cfed7e..b13554f6 100755 --- a/setup.sh +++ b/setup.sh @@ -84,16 +84,25 @@ cp -r -v thorium_shell/. ${CR_SRC_DIR}/out/thorium/ && cp -r -v pak_src/binaries/pak ${CR_SRC_DIR}/out/thorium/ && cp -r -v pak_src/binaries/pak-win/. ${CR_SRC_DIR}/out/thorium/ && -printf "\n" && -printf "${YEL}Patching FFMPEG for HEVC...${c0}\n" && - patchFFMPEG () { cp -v other/add-hevc-ffmpeg-decoder-parser.patch ${CR_SRC_DIR}/third_party/ffmpeg/ && cp -v other/Fix-policy-templates.patch ${CR_SRC_DIR}/ && + cp -v other/ftp-support-thorium.patch ${CR_SRC_DIR}/ && + + printf "\n" && + printf "${YEL}Patching FFMPEG for HEVC...${c0}\n" && cd ${CR_SRC_DIR}/third_party/ffmpeg && git apply --reject ./add-hevc-ffmpeg-decoder-parser.patch && + + printf "\n" && + printf "${YEL}Patching policy templates...${c0}\n" && cd ${CR_SRC_DIR} && - git apply --reject ./Fix-policy-templates.patch + git apply --reject ./Fix-policy-templates.patch && + + printf "\n" && + printf "${YEL}Patching FTP support...${c0}\n" && + cd ${CR_SRC_DIR} && + git apply --reject ./ftp-support-thorium.patch } [ -f ${CR_SRC_DIR}/third_party/ffmpeg/add-hevc-ffmpeg-decoder-parser.patch ] || patchFFMPEG;