diff --git a/lib/pages/setting/widgets/model.dart b/lib/pages/setting/widgets/model.dart index 5f1f21f8..49a6e098 100644 --- a/lib/pages/setting/widgets/model.dart +++ b/lib/pages/setting/widgets/model.dart @@ -1867,7 +1867,7 @@ List get extraSettings => [ title: '超分辨率', leading: const Icon(Icons.stay_current_landscape_outlined), getSubtitle: () => - '当前:「${SuperResolutionType.values[GStorage.superResolutionType].title}」\n超分辨率只对「番剧」启用, 需要启用硬件解码, 若启用硬件解码后仍然不生效, 尝试切换硬件解码器为 auto-copy', + '当前:「${SuperResolutionType.values[GStorage.superResolutionType].title}」\n超分辨率需要启用硬件解码, 若启用硬件解码后仍然不生效, 尝试切换硬件解码器为 auto-copy', onTap: (setState) async { SuperResolutionType? result = await showDialog( context: Get.context!, diff --git a/lib/pages/video/detail/widgets/header_control.dart b/lib/pages/video/detail/widgets/header_control.dart index ee888eb1..c7f3be41 100644 --- a/lib/pages/video/detail/widgets/header_control.dart +++ b/lib/pages/video/detail/widgets/header_control.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'dart:math'; import 'package:PiliPlus/common/widgets/self_sized_horizontal_list.dart'; +import 'package:PiliPlus/models/common/super_resolution_type.dart'; import 'package:PiliPlus/pages/setting/widgets/switch_item.dart'; import 'package:PiliPlus/utils/extension.dart'; import 'package:PiliPlus/utils/id_utils.dart'; @@ -197,6 +198,75 @@ class _HeaderControlState extends State { leading: const Icon(Icons.refresh_outlined, size: 20), title: const Text('重载视频', style: titleStyle), ), + ListTile( + dense: true, + leading: const Icon( + Icons.stay_current_landscape_outlined, + size: 20), + title: Row( + children: [ + const Text( + '超分辨率', + strutStyle: StrutStyle(leading: 0, height: 1), + style: TextStyle( + height: 1, + fontSize: 14, + ), + ), + const SizedBox(width: 10), + Builder( + builder: (context) => PopupMenuButton( + initialValue: SuperResolutionType.values[ + widget.controller.superResolutionType], + child: Padding( + padding: const EdgeInsets.all(4), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text( + SuperResolutionType + .values[widget.controller + .superResolutionType] + .title, + strutStyle: + StrutStyle(leading: 0, height: 1), + style: TextStyle( + height: 1, + fontSize: 14, + color: Theme.of(context) + .colorScheme + .secondary, + ), + ), + Icon( + MdiIcons.unfoldMoreHorizontal, + size: MediaQuery.textScalerOf(context) + .scale(14), + color: Theme.of(context) + .colorScheme + .secondary, + ) + ], + ), + ), + onSelected: (value) { + widget.controller.setShader(value.index); + if (context.mounted) { + (context as Element).markNeedsBuild(); + } + }, + itemBuilder: (context) => + SuperResolutionType.values + .map((item) => PopupMenuItem( + value: item, + child: Text(item.title), + )) + .toList(), + ), + ), + ], + ), + ), ListTile( dense: true, title: const Text('CDN 设置', style: titleStyle), diff --git a/lib/plugin/pl_player/controller.dart b/lib/plugin/pl_player/controller.dart index b82584a8..67f0bcec 100644 --- a/lib/plugin/pl_player/controller.dart +++ b/lib/plugin/pl_player/controller.dart @@ -583,13 +583,17 @@ class PlPlayerController { return shadersDirectory; } - late int superResolutionType = GStorage.superResolutionType; + bool get _isBangumi => + Get.parameters['type'] == '1' || Get.parameters['type'] == '4'; + late int superResolutionType = _isBangumi ? GStorage.superResolutionType : 0; Future setShader([int? type, NativePlayer? pp]) async { if (type == null) { type ??= superResolutionType; } else { superResolutionType = type; - GStorage.setting.put(SettingBoxKey.superResolutionType, type); + if (_isBangumi) { + GStorage.setting.put(SettingBoxKey.superResolutionType, type); + } } pp ??= _videoPlayerController?.platform as NativePlayer; await pp.waitForPlayerInitialization; @@ -652,7 +656,7 @@ class PlPlayerController { ); var pp = player.platform as NativePlayer; // 解除倍速限制 - if (Get.parameters['type'] == '1' || Get.parameters['type'] == '4') { + if (_isBangumi) { setShader(superResolutionType, pp); } if (_videoPlayerController == null) {