mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-05 09:37:52 +08:00
opt audio normalization
Signed-off-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -208,6 +208,7 @@ abstract final class VideoHttp {
|
|||||||
required bool tryLook,
|
required bool tryLook,
|
||||||
required VideoType videoType,
|
required VideoType videoType,
|
||||||
String? language,
|
String? language,
|
||||||
|
bool voiceBalance = false,
|
||||||
}) async {
|
}) async {
|
||||||
final params = await WbiSign.makSign({
|
final params = await WbiSign.makSign({
|
||||||
'avid': ?avid,
|
'avid': ?avid,
|
||||||
@@ -220,7 +221,7 @@ abstract final class VideoHttp {
|
|||||||
'fnval': 4048,
|
'fnval': 4048,
|
||||||
'fourk': 1,
|
'fourk': 1,
|
||||||
'fnver': 0,
|
'fnver': 0,
|
||||||
'voice_balance': 1,
|
'voice_balance': voiceBalance ? 1 : 0,
|
||||||
'gaia_source': 'pre-load',
|
'gaia_source': 'pre-load',
|
||||||
'isGaiaAvoided': true,
|
'isGaiaAvoided': true,
|
||||||
'web_location': 1315873,
|
'web_location': 1315873,
|
||||||
|
|||||||
@@ -856,6 +856,7 @@ class VideoDetailController extends GetxController
|
|||||||
tryLook: plPlayerController.tryLook,
|
tryLook: plPlayerController.tryLook,
|
||||||
videoType: _actualVideoType ?? videoType,
|
videoType: _actualVideoType ?? videoType,
|
||||||
language: currLang.value,
|
language: currLang.value,
|
||||||
|
voiceBalance: plPlayerController.enableAudioNormalization,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (result case Success(:final response)) {
|
if (result case Success(:final response)) {
|
||||||
|
|||||||
@@ -613,6 +613,12 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
// offline
|
// offline
|
||||||
bool get isFileSource => dataSource is FileSource;
|
bool get isFileSource => dataSource is FileSource;
|
||||||
|
|
||||||
|
late final _audioNormalization = Pref.audioNormalization;
|
||||||
|
late final enableAudioNormalization =
|
||||||
|
Platform.isAndroid && _audioNormalization != '0';
|
||||||
|
late final String _audioNormalizationParam =
|
||||||
|
AudioNormalization.getParamFromConfig(_audioNormalization);
|
||||||
|
|
||||||
// 初始化资源
|
// 初始化资源
|
||||||
Future<void> setDataSource(
|
Future<void> setDataSource(
|
||||||
DataSource dataSource, {
|
DataSource dataSource, {
|
||||||
@@ -851,12 +857,10 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
extras['audio-files'] =
|
extras['audio-files'] =
|
||||||
'"${Platform.isWindows ? audio.replaceAll(';', r'\;') : audio.replaceAll(':', r'\:')}"';
|
'"${Platform.isWindows ? audio.replaceAll(';', r'\;') : audio.replaceAll(':', r'\:')}"';
|
||||||
}
|
}
|
||||||
if (kDebugMode || Platform.isAndroid) {
|
if (enableAudioNormalization) {
|
||||||
String audioNormalization = AudioNormalization.getParamFromConfig(
|
final String audioNormalization;
|
||||||
Pref.audioNormalization,
|
|
||||||
);
|
|
||||||
if (volume != null && volume.isNotEmpty) {
|
if (volume != null && volume.isNotEmpty) {
|
||||||
audioNormalization = audioNormalization.replaceFirstMapped(
|
audioNormalization = _audioNormalizationParam.replaceFirstMapped(
|
||||||
loudnormRegExp,
|
loudnormRegExp,
|
||||||
(i) =>
|
(i) =>
|
||||||
'loudnorm=${volume.format(
|
'loudnorm=${volume.format(
|
||||||
@@ -869,7 +873,7 @@ class PlPlayerController with BlockConfigMixin {
|
|||||||
)}',
|
)}',
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
audioNormalization = audioNormalization.replaceFirst(
|
audioNormalization = _audioNormalizationParam.replaceFirst(
|
||||||
loudnormRegExp,
|
loudnormRegExp,
|
||||||
AudioNormalization.getParamFromConfig(Pref.fallbackNormalization),
|
AudioNormalization.getParamFromConfig(Pref.fallbackNormalization),
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user