mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
mod: set shader
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -1867,7 +1867,7 @@ List<SettingsModel> 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!,
|
||||
|
||||
@@ -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<HeaderControl> {
|
||||
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),
|
||||
|
||||
@@ -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<void> 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) {
|
||||
|
||||
Reference in New Issue
Block a user