Compare commits

..

6 Commits

Author SHA1 Message Date
dom
e293083492 opt set shader
opt refresh player

Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-15 09:48:31 +08:00
dom
7f39f36c75 fix auto fullscreen
Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-15 09:16:21 +08:00
dom
565819febe remove unused param
Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-15 09:16:21 +08:00
dom
af150118a1 opt load saved reply
Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-15 09:16:21 +08:00
dom
470e519a2b opt save panel
Signed-off-by: dom <githubaccount56556@proton.me>
2026-03-15 09:16:21 +08:00
HeXis-YS
d73588f1fd fix(player): disable audio normalization on missing audio input (#1865)
* fix(player): disable audio normalization on missing audio input

* fix(player): skip normalization when local audio input is missing

* fix `hasDashAudio`

---------

Co-authored-by: dom <githubaccount56556@proton.me>
2026-03-15 09:16:10 +08:00
11 changed files with 292 additions and 318 deletions

View File

@@ -211,7 +211,6 @@ void importFromInput<T>(
Future<void> showImportExportDialog<T>( Future<void> showImportExportDialog<T>(
BuildContext context, { BuildContext context, {
required String title, required String title,
String? label,
required ValueGetter<String> onExport, required ValueGetter<String> onExport,
required FutureOr<void> Function(T json) onImport, required FutureOr<void> Function(T json) onImport,
required ValueGetter<String> localFileName, required ValueGetter<String> localFileName,

View File

@@ -161,6 +161,7 @@ abstract final class DownloadHttp {
dashDrmType: 0, dashDrmType: 0,
), ),
]; ];
entry.hasDashAudio = true;
} }
return Type2( return Type2(
duration: dash.duration!, duration: dash.duration!,

View File

@@ -7,7 +7,7 @@ import 'package:get/route_manager.dart';
class BiliDownloadEntryInfo with MultiSelectData { class BiliDownloadEntryInfo with MultiSelectData {
int mediaType; int mediaType;
final bool hasDashAudio; bool hasDashAudio;
bool isCompleted; bool isCompleted;
int totalBytes; int totalBytes;
int downloadedBytes; int downloadedBytes;

View File

@@ -267,7 +267,6 @@ Commit Hash: ${BuildConfig.commitHash}''',
context, context,
title: '设置', title: '设置',
localFileName: () => 'setting_${context.platformName}', localFileName: () => 'setting_${context.platformName}',
label: GStorage.setting.name,
onExport: GStorage.exportAllSettings, onExport: GStorage.exportAllSettings,
onImport: GStorage.importAllJsonSettings, onImport: GStorage.importAllJsonSettings,
), ),

View File

@@ -37,10 +37,9 @@ class _MyReplyState extends State<MyReply> with DynMixin {
} }
void _initReply() { void _initReply() {
_replies.assignAll( _replies
GStorage.reply!.values.map(ReplyInfo.fromBuffer).toList() ..assignAll(GStorage.reply!.values.map(ReplyInfo.fromBuffer))
..sort((a, b) => b.ctime.compareTo(a.ctime)), // rpid not aligned ..sort((a, b) => b.ctime.compareTo(a.ctime)); // rpid not aligned;
);
} }
@override @override

View File

@@ -336,55 +336,53 @@ class _SavePanelState extends State<SavePanel> {
final padding = MediaQuery.viewPaddingOf(context); final padding = MediaQuery.viewPaddingOf(context);
final maxWidth = context.mediaQueryShortestSide; final maxWidth = context.mediaQueryShortestSide;
late final coverSize = MediaQuery.textScalerOf(context).scale(65); late final coverSize = MediaQuery.textScalerOf(context).scale(65);
return GestureDetector( return Stack(
behavior: HitTestBehavior.opaque, clipBehavior: .none,
onTap: Get.back, alignment: .center,
child: Stack(
clipBehavior: Clip.none,
alignment: Alignment.center,
children: [ children: [
SingleChildScrollView( SingleChildScrollView(
padding: EdgeInsets.only( hitTestBehavior: .deferToChild,
padding: .only(
top: 12 + padding.top, top: 12 + padding.top,
bottom: 80 + padding.bottom, bottom: 80 + padding.bottom,
), ),
child: Listener(
child: Container( child: Container(
width: maxWidth, width: maxWidth,
padding: const EdgeInsets.symmetric(horizontal: 12), padding: const .symmetric(horizontal: 12),
child: RepaintBoundary( child: RepaintBoundary(
key: boundaryKey, key: boundaryKey,
child: Container( child: Container(
clipBehavior: Clip.hardEdge, clipBehavior: .hardEdge,
decoration: BoxDecoration( decoration: BoxDecoration(
color: theme.colorScheme.surface, color: theme.colorScheme.surface,
borderRadius: const .all(.circular(12)), borderRadius: const .all(.circular(12)),
), ),
child: AnimatedSize( child: AnimatedSize(
curve: Curves.easeInOut, curve: Curves.easeInOut,
alignment: Alignment.topCenter, alignment: .topCenter,
duration: const Duration(milliseconds: 255), duration: const Duration(milliseconds: 255),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: .min,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: .start,
children: [ children: [
if (_item case final ReplyInfo reply) switch (_item) {
IgnorePointer( ReplyInfo reply => IgnorePointer(
child: ReplyItemGrpc( child: ReplyItemGrpc(
replyItem: reply, replyItem: reply,
replyLevel: 0, replyLevel: 0,
needDivider: false, needDivider: false,
upMid: widget.upMid, upMid: widget.upMid,
), ),
) ),
else if (_item case final DynamicItemModel dyn) DynamicItemModel dyn => IgnorePointer(
IgnorePointer(
child: DynamicPanel( child: DynamicPanel(
item: dyn, item: dyn,
isDetail: true, isDetail: true,
isSave: true, isSave: true,
), ),
), ),
_ => throw UnsupportedError(_item.toString()),
},
if (cover?.isNotEmpty == true && if (cover?.isNotEmpty == true &&
title?.isNotEmpty == true) title?.isNotEmpty == true)
Container( Container(
@@ -397,29 +395,29 @@ class _SavePanelState extends State<SavePanel> {
borderRadius: const .all(.circular(8)), borderRadius: const .all(.circular(8)),
), ),
child: Row( child: Row(
spacing: 10,
children: [ children: [
NetworkImgLayer( NetworkImgLayer(
src: cover!, src: cover!,
height: coverSize, height: coverSize,
width: coverType == .def16_9 width: coverType == .def16_9
? coverSize * ? coverSize * StyleString.aspectRatio16x9
StyleString.aspectRatio16x9
: coverSize, : coverSize,
quality: 100, quality: 100,
borderRadius: const .all(.circular(6)), borderRadius: const .all(.circular(6)),
), ),
const SizedBox(width: 10),
Expanded( Expanded(
child: Column( child: Column(
crossAxisAlignment: .start, crossAxisAlignment: .start,
children: [ children: [
Text( Expanded(
child: Text(
'$title\n', '$title\n',
maxLines: 2, maxLines: 2,
overflow: .ellipsis, overflow: .ellipsis,
), ),
if (pubdate != null) ...[ ),
const Spacer(), if (pubdate != null)
Text( Text(
DateFormatUtils.format( DateFormatUtils.format(
pubdate, pubdate,
@@ -430,7 +428,6 @@ class _SavePanelState extends State<SavePanel> {
), ),
), ),
], ],
],
), ),
), ),
], ],
@@ -438,18 +435,17 @@ class _SavePanelState extends State<SavePanel> {
), ),
showBottom showBottom
? Stack( ? Stack(
clipBehavior: Clip.none, clipBehavior: .none,
children: [ children: [
if (uri.isNotEmpty) if (uri.isNotEmpty)
Align( Align(
alignment: Alignment.centerRight, alignment: .centerRight,
child: Row( child: Row(
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: .min,
crossAxisAlignment: crossAxisAlignment: .end,
CrossAxisAlignment.end,
spacing: 4, spacing: 4,
children: [ children: [
if (uname?.isNotEmpty == true) if (uname?.isNotEmpty == true)
@@ -465,7 +461,7 @@ class _SavePanelState extends State<SavePanel> {
), ),
Text( Text(
'识别二维码,$viewType$itemType', '识别二维码,$viewType$itemType',
textAlign: TextAlign.end, textAlign: .end,
style: TextStyle( style: TextStyle(
color: theme color: theme
.colorScheme .colorScheme
@@ -475,12 +471,11 @@ class _SavePanelState extends State<SavePanel> {
Text( Text(
DateFormatUtils.longFormatDs DateFormatUtils.longFormatDs
.format(.now()), .format(.now()),
textAlign: TextAlign.end, textAlign: .end,
style: TextStyle( style: TextStyle(
fontSize: 13, fontSize: 13,
color: theme color:
.colorScheme theme.colorScheme.outline,
.outline,
), ),
), ),
], ],
@@ -510,13 +505,12 @@ class _SavePanelState extends State<SavePanel> {
), ),
), ),
Align( Align(
alignment: Alignment.centerLeft, alignment: .centerLeft,
child: Image.asset( child: Image.asset(
'assets/images/logo/logo_2.png', 'assets/images/logo/logo_2.png',
width: 100, width: 100,
cacheWidth: 100.cacheSize(context), cacheWidth: 100.cacheSize(context),
color: color: theme.colorScheme.onSurfaceVariant,
theme.colorScheme.onSurfaceVariant,
), ),
), ),
], ],
@@ -529,7 +523,6 @@ class _SavePanelState extends State<SavePanel> {
), ),
), ),
), ),
),
Positioned( Positioned(
left: 0, left: 0,
right: 0, right: 0,
@@ -537,8 +530,8 @@ class _SavePanelState extends State<SavePanel> {
child: DecoratedBox( child: DecoratedBox(
decoration: const BoxDecoration( decoration: const BoxDecoration(
gradient: LinearGradient( gradient: LinearGradient(
begin: Alignment.topCenter, begin: .topCenter,
end: Alignment.bottomCenter, end: .bottomCenter,
colors: [ colors: [
Colors.transparent, Colors.transparent,
Colors.black54, Colors.black54,
@@ -553,7 +546,7 @@ class _SavePanelState extends State<SavePanel> {
), ),
child: Row( child: Row(
spacing: 40, spacing: 40,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: .center,
children: [ children: [
iconButton( iconButton(
size: 42, size: 42,
@@ -595,7 +588,6 @@ class _SavePanelState extends State<SavePanel> {
), ),
), ),
], ],
),
); );
} }
} }

View File

@@ -663,7 +663,9 @@ class VideoDetailController extends GetxController
(isFileSource (isFileSource
? true ? true
: videoPlayerKey.currentState?.mounted == true)) { : videoPlayerKey.currentState?.mounted == true)) {
return playerInit(autoFullScreenFlag: autoFullScreenFlag); return playerInit(
autoFullScreenFlag: autoFullScreenFlag && _autoPlay.value,
);
} }
return null; return null;
} }
@@ -687,6 +689,7 @@ class VideoDetailController extends GetxController
dir: args['dirPath'], dir: args['dirPath'],
typeTag: entry.typeTag!, typeTag: entry.typeTag!,
isMp4: entry.mediaType == 1, isMp4: entry.mediaType == 1,
hasDashAudio: entry.hasDashAudio,
) )
: NetworkSource( : NetworkSource(
videoSource: video ?? videoUrl!, videoSource: video ?? videoUrl!,

View File

@@ -309,13 +309,17 @@ class _VideoDetailPageVState extends State<VideoDetailPageV>
return null; return null;
} }
} }
plPlayerController = videoDetailController.plPlayerController; final plPlayerController = this.plPlayerController =
videoDetailController.plPlayerController;
videoDetailController.autoPlay = true; videoDetailController.autoPlay = true;
plPlayerController! plPlayerController
..addStatusLister(playerListener) ..addStatusLister(playerListener)
..addPositionListener(positionListener); ..addPositionListener(positionListener);
if (videoDetailController.plPlayerController.preInitPlayer) { if (plPlayerController.preInitPlayer) {
return plPlayerController!.play(); if (plPlayerController.autoEnterFullScreen) {
plPlayerController.triggerFullScreen();
}
return plPlayerController.play();
} else { } else {
return videoDetailController.playerInit( return videoDetailController.playerInit(
autoplay: true, autoplay: true,

View File

@@ -34,7 +34,6 @@ import 'package:PiliPlus/utils/accounts.dart';
import 'package:PiliPlus/utils/asset_utils.dart'; import 'package:PiliPlus/utils/asset_utils.dart';
import 'package:PiliPlus/utils/extension/box_ext.dart'; import 'package:PiliPlus/utils/extension/box_ext.dart';
import 'package:PiliPlus/utils/extension/num_ext.dart'; import 'package:PiliPlus/utils/extension/num_ext.dart';
import 'package:PiliPlus/utils/extension/string_ext.dart';
import 'package:PiliPlus/utils/feed_back.dart'; import 'package:PiliPlus/utils/feed_back.dart';
import 'package:PiliPlus/utils/image_utils.dart'; import 'package:PiliPlus/utils/image_utils.dart';
import 'package:PiliPlus/utils/page_utils.dart'; import 'package:PiliPlus/utils/page_utils.dart';
@@ -369,7 +368,7 @@ class PlPlayerController with BlockConfigMixin {
late final showFsLockBtn = Pref.showFsLockBtn; late final showFsLockBtn = Pref.showFsLockBtn;
late final keyboardControl = Pref.keyboardControl; late final keyboardControl = Pref.keyboardControl;
late final bool _autoEnterFullScreen = Pref.autoEnterFullScreen; late final bool autoEnterFullScreen = Pref.autoEnterFullScreen;
late final bool autoExitFullscreen = Pref.autoExitFullscreen; late final bool autoExitFullscreen = Pref.autoExitFullscreen;
late final bool autoPlayEnable = Pref.autoPlayEnable; late final bool autoPlayEnable = Pref.autoPlayEnable;
late final bool enableVerticalExpand = Pref.enableVerticalExpand; late final bool enableVerticalExpand = Pref.enableVerticalExpand;
@@ -630,7 +629,7 @@ class PlPlayerController with BlockConfigMixin {
// 数据加载完成 // 数据加载完成
dataStatus.value = DataStatus.loaded; dataStatus.value = DataStatus.loaded;
if (autoFullScreenFlag && _autoEnterFullScreen) { if (autoFullScreenFlag && autoEnterFullScreen) {
triggerFullScreen(status: true); triggerFullScreen(status: true);
} }
@@ -774,9 +773,10 @@ class PlPlayerController with BlockConfigMixin {
return; return;
} }
_videoPlayerController = player; _videoPlayerController = player;
if (isAnim && superResolutionType.value != .disable) {
await setShader();
}
} }
if (isAnim) await setShader();
final Map<String, String> extras = {}; final Map<String, String> extras = {};
@@ -788,8 +788,6 @@ 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 (kDebugMode || Platform.isAndroid) {
String audioNormalization = AudioNormalization.getParamFromConfig( String audioNormalization = AudioNormalization.getParamFromConfig(
Pref.audioNormalization, Pref.audioNormalization,
@@ -817,6 +815,7 @@ class PlPlayerController with BlockConfigMixin {
extras['lavfi-complex'] = '"[aid1] $audioNormalization [ao]"'; extras['lavfi-complex'] = '"[aid1] $audioNormalization [ao]"';
} }
} }
}
await player.open( await player.open(
Media( Media(
@@ -828,38 +827,17 @@ class PlPlayerController with BlockConfigMixin {
); );
} }
Future<bool> refreshPlayer() async { Future<void>? refreshPlayer() {
if (dataSource is FileSource) { if (dataSource is FileSource) {
return true; return null;
} }
if (_videoPlayerController == null) { if (_videoPlayerController?.current.isNotEmpty ?? false) {
// SmartDialog.showToast('视频播放器为空,请重新进入本页面'); return _videoPlayerController!.open(
return false; _videoPlayerController!.current.last.copyWith(start: position),
}
if (dataSource.videoSource.isNullOrEmpty) {
SmartDialog.showToast('视频源为空,请重新进入本页面');
return false;
}
String? audioUri;
if (!isLive) {
if (dataSource.audioSource.isNullOrEmpty) {
SmartDialog.showToast('音频源为空');
} else {
audioUri = Platform.isWindows
? dataSource.audioSource!.replaceAll(';', '\\;')
: dataSource.audioSource!.replaceAll(':', '\\:');
}
}
await _videoPlayerController!.open(
Media(
dataSource.videoSource,
start: position,
extras: audioUri == null ? null : {'audio-files': '"$audioUri"'},
),
play: true, play: true,
); );
return true; }
// seekTo(currentPos); return null;
} }
// 开始播放 // 开始播放
@@ -1000,7 +978,7 @@ class PlPlayerController with BlockConfigMixin {
'controllerStream.error.listen', 'controllerStream.error.listen',
const Duration(milliseconds: 10000), const Duration(milliseconds: 10000),
() { () {
Future.delayed(const Duration(milliseconds: 3000), () async { Future.delayed(const Duration(milliseconds: 3000), () {
// if (kDebugMode) { // if (kDebugMode) {
// debugPrint("isBuffering.value: ${isBuffering.value}"); // debugPrint("isBuffering.value: ${isBuffering.value}");
// } // }
@@ -1012,9 +990,7 @@ class PlPlayerController with BlockConfigMixin {
'视频链接打开失败,重试中', '视频链接打开失败,重试中',
displayTime: const Duration(milliseconds: 500), displayTime: const Duration(milliseconds: 500),
); );
if (!await refreshPlayer()) { refreshPlayer();
if (kDebugMode) debugPrint("failed");
}
} }
}); });
}, },

View File

@@ -25,6 +25,7 @@ class FileSource extends DataSource {
FileSource({ FileSource({
required this.dir, required this.dir,
required this.isMp4, required this.isMp4,
required bool hasDashAudio,
required String typeTag, required String typeTag,
}) : super( }) : super(
videoSource: path.join( videoSource: path.join(
@@ -32,7 +33,7 @@ class FileSource extends DataSource {
typeTag, typeTag,
isMp4 ? PathUtils.videoNameType1 : PathUtils.videoNameType2, isMp4 ? PathUtils.videoNameType1 : PathUtils.videoNameType2,
), ),
audioSource: isMp4 audioSource: isMp4 || !hasDashAudio
? null ? null
: path.join(dir, typeTag, PathUtils.audioNameType2), : path.join(dir, typeTag, PathUtils.audioNameType2),
); );

View File

@@ -138,7 +138,7 @@ class DownloadService extends GetxService {
final currentTime = DateTime.now().millisecondsSinceEpoch ~/ 1000; final currentTime = DateTime.now().millisecondsSinceEpoch ~/ 1000;
final entry = BiliDownloadEntryInfo( final entry = BiliDownloadEntryInfo(
mediaType: 2, mediaType: 2,
hasDashAudio: true, hasDashAudio: false,
isCompleted: false, isCompleted: false,
totalBytes: 0, totalBytes: 0,
downloadedBytes: 0, downloadedBytes: 0,
@@ -206,7 +206,7 @@ class DownloadService extends GetxService {
); );
final entry = BiliDownloadEntryInfo( final entry = BiliDownloadEntryInfo(
mediaType: 2, mediaType: 2,
hasDashAudio: true, hasDashAudio: false,
isCompleted: false, isCompleted: false,
totalBytes: 0, totalBytes: 0,
downloadedBytes: 0, downloadedBytes: 0,