feat: hardwareDecodeFormat
This commit is contained in:
@ -31,6 +31,7 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
late int defaultFullScreenMode;
|
late int defaultFullScreenMode;
|
||||||
late int defaultBtmProgressBehavior;
|
late int defaultBtmProgressBehavior;
|
||||||
late String defaultAoOutput;
|
late String defaultAoOutput;
|
||||||
|
late String hardwareDecodeFormat;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@ -49,6 +50,8 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
defaultValue: BtmProgresBehavior.values.first.code);
|
defaultValue: BtmProgresBehavior.values.first.code);
|
||||||
defaultAoOutput =
|
defaultAoOutput =
|
||||||
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
setting.get(SettingBoxKey.defaultAoOutput, defaultValue: '0');
|
||||||
|
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
|
||||||
|
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -294,6 +297,34 @@ class _PlaySettingState extends State<PlaySetting> {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
ListTile(
|
||||||
|
dense: false,
|
||||||
|
title: Text('硬解方式', style: titleStyle),
|
||||||
|
subtitle: Text(
|
||||||
|
'当前硬解方式(--hwdec):$hardwareDecodeFormat',
|
||||||
|
style: subTitleStyle,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
|
String? result = await showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return SelectDialog<String>(
|
||||||
|
title: '硬解方式',
|
||||||
|
value: hardwareDecodeFormat,
|
||||||
|
values: ['no', 'auto-safe', 'auto', 'yes', 'auto-copy']
|
||||||
|
.map((e) {
|
||||||
|
return {'title': e, 'value': e};
|
||||||
|
}).toList());
|
||||||
|
},
|
||||||
|
);
|
||||||
|
if (result != null) {
|
||||||
|
setting.put(SettingBoxKey.hardwareDecodeFormat, result);
|
||||||
|
hardwareDecodeFormat = result;
|
||||||
|
GlobalDataCache.hardwareDecodeFormat = result;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
dense: false,
|
dense: false,
|
||||||
title: Text('默认全屏方式', style: titleStyle),
|
title: Text('默认全屏方式', style: titleStyle),
|
||||||
|
|||||||
@ -470,6 +470,7 @@ class PlPlayerController {
|
|||||||
configuration: VideoControllerConfiguration(
|
configuration: VideoControllerConfiguration(
|
||||||
enableHardwareAcceleration: enableHA,
|
enableHardwareAcceleration: enableHA,
|
||||||
androidAttachSurfaceAfterVideoParameters: false,
|
androidAttachSurfaceAfterVideoParameters: false,
|
||||||
|
hwdec: enableHA ? GlobalDataCache.hardwareDecodeFormat : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
|
import 'dart:io';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive/hive.dart';
|
||||||
import 'package:pilipala/models/user/info.dart';
|
import 'package:pilipala/models/user/info.dart';
|
||||||
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
import 'package:pilipala/plugin/pl_player/models/play_repeat.dart';
|
||||||
@ -55,6 +56,8 @@ class GlobalDataCache {
|
|||||||
static late bool enableDynamicSwitch;
|
static late bool enableDynamicSwitch;
|
||||||
// 投屏开关
|
// 投屏开关
|
||||||
static bool enableDlna = false;
|
static bool enableDlna = false;
|
||||||
|
// 硬件解码格式
|
||||||
|
static late String hardwareDecodeFormat;
|
||||||
|
|
||||||
// 私有构造函数
|
// 私有构造函数
|
||||||
GlobalDataCache._();
|
GlobalDataCache._();
|
||||||
@ -123,5 +126,7 @@ class GlobalDataCache {
|
|||||||
enableDynamicSwitch =
|
enableDynamicSwitch =
|
||||||
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
setting.get(SettingBoxKey.enableDynamicSwitch, defaultValue: true);
|
||||||
enableDlna = setting.get(SettingBoxKey.enableDlna, defaultValue: false);
|
enableDlna = setting.get(SettingBoxKey.enableDlna, defaultValue: false);
|
||||||
|
hardwareDecodeFormat = setting.get(SettingBoxKey.hardwareDecodeFormat,
|
||||||
|
defaultValue: Platform.isAndroid ? 'auto-safe' : 'auto');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -116,7 +116,8 @@ class SettingBoxKey {
|
|||||||
enableAutoExpand = 'enableAutoExpand',
|
enableAutoExpand = 'enableAutoExpand',
|
||||||
defaultHomePage = 'defaultHomePage',
|
defaultHomePage = 'defaultHomePage',
|
||||||
enableRelatedVideo = 'enableRelatedVideo',
|
enableRelatedVideo = 'enableRelatedVideo',
|
||||||
enableDlna = 'enableDlna';
|
enableDlna = 'enableDlna',
|
||||||
|
hardwareDecodeFormat = 'hardwareDecodeFormat';
|
||||||
|
|
||||||
/// 外观
|
/// 外观
|
||||||
static const String themeMode = 'themeMode',
|
static const String themeMode = 'themeMode',
|
||||||
|
|||||||
Reference in New Issue
Block a user