mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-07-20 10:30:13 +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(
|
NormalModel(
|
||||||
title: '首选解码格式',
|
title: '首选解码格式',
|
||||||
leading: const Icon(Icons.movie_creation_outlined),
|
leading: const Icon(Icons.movie_creation_outlined),
|
||||||
getSubtitle: () {
|
getSubtitle: () =>
|
||||||
final list = Pref.preferCodecs;
|
'首选解码格式:${(Pref.preferCodecs.map((i) => i.name).join(","))},请根据设备支持情况与需求调整',
|
||||||
return '首选解码格式:${(list.isEmpty ? '第一个可用' : list.map((i) => i.name).join(","))},请根据设备支持情况与需求调整';
|
|
||||||
},
|
|
||||||
onTap: _showCodecsDialog,
|
onTap: _showCodecsDialog,
|
||||||
),
|
),
|
||||||
if (kDebugMode || Platform.isAndroid)
|
if (kDebugMode || Platform.isAndroid)
|
||||||
@@ -356,13 +354,11 @@ Future<void> _showCodecsDialog(
|
|||||||
values: {for (final e in VideoDecodeFormatType.values) e: e.name},
|
values: {for (final e in VideoDecodeFormatType.values) e: e.name},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (res != null) {
|
if (res != null && res.isNotEmpty) {
|
||||||
await (res.isEmpty
|
await GStorage.setting.put(
|
||||||
? GStorage.setting.delete(SettingBoxKey.preferCodecs)
|
SettingBoxKey.preferCodecs,
|
||||||
: GStorage.setting.put(
|
res.map((i) => i.name).toList(),
|
||||||
SettingBoxKey.preferCodecs,
|
);
|
||||||
res.map((i) => i.name).toList(),
|
|
||||||
));
|
|
||||||
setState();
|
setState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -267,10 +267,10 @@ abstract final class Pref {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final codecs = _setting.get(SettingBoxKey.preferCodecs);
|
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 codecs.map((i) => VideoDecodeFormatType.values.byName(i)).toList();
|
||||||
}
|
}
|
||||||
return const [];
|
return const <VideoDecodeFormatType>[.AVC, .AV1];
|
||||||
}
|
}
|
||||||
|
|
||||||
static String get hardwareDecoding => _setting.get(
|
static String get hardwareDecoding => _setting.get(
|
||||||
|
|||||||
Reference in New Issue
Block a user