mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-11 20:00:12 +08:00
fix(player): preserve default codec preferences after upgrade (#2444)
* fix(player): preserve default codec preferences after upgrade * update --------- Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
@@ -127,10 +127,8 @@ List<SettingsModel> get videoSettings => [
|
||||
NormalModel(
|
||||
title: '首选解码格式',
|
||||
leading: const Icon(Icons.movie_creation_outlined),
|
||||
getSubtitle: () {
|
||||
final list = Pref.preferCodecs;
|
||||
return '首选解码格式:${(list.isEmpty ? '第一个可用' : list.map((i) => i.name).join(","))},请根据设备支持情况与需求调整';
|
||||
},
|
||||
getSubtitle: () =>
|
||||
'首选解码格式:${(Pref.preferCodecs.map((i) => i.name).join(","))},请根据设备支持情况与需求调整',
|
||||
onTap: _showCodecsDialog,
|
||||
),
|
||||
if (kDebugMode || Platform.isAndroid)
|
||||
@@ -356,13 +354,11 @@ Future<void> _showCodecsDialog(
|
||||
values: {for (final e in VideoDecodeFormatType.values) e: e.name},
|
||||
),
|
||||
);
|
||||
if (res != null) {
|
||||
await (res.isEmpty
|
||||
? GStorage.setting.delete(SettingBoxKey.preferCodecs)
|
||||
: GStorage.setting.put(
|
||||
SettingBoxKey.preferCodecs,
|
||||
res.map((i) => i.name).toList(),
|
||||
));
|
||||
if (res != null && res.isNotEmpty) {
|
||||
await GStorage.setting.put(
|
||||
SettingBoxKey.preferCodecs,
|
||||
res.map((i) => i.name).toList(),
|
||||
);
|
||||
setState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,10 +267,10 @@ abstract final class Pref {
|
||||
}
|
||||
|
||||
final codecs = _setting.get(SettingBoxKey.preferCodecs);
|
||||
if (codecs is List && codecs.isNotEmpty) {
|
||||
if (codecs is List) {
|
||||
return codecs.map((i) => VideoDecodeFormatType.values.byName(i)).toList();
|
||||
}
|
||||
return const [];
|
||||
return const <VideoDecodeFormatType>[.AVC, .AV1];
|
||||
}
|
||||
|
||||
static String get hardwareDecoding => _setting.get(
|
||||
|
||||
Reference in New Issue
Block a user