mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-24 11:06:51 +08:00
117
lib/models/common/video/CDN.dart
Normal file
117
lib/models/common/video/CDN.dart
Normal file
@@ -0,0 +1,117 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
//https://github.com/yujincheng08/BiliRoaming/blob/master/app/src/main/res/values/strings_raw.xml
|
||||
//https://github.com/yujincheng08/BiliRoaming/blob/master/app/src/main/res/values/arrays.xml
|
||||
|
||||
enum CDNService {
|
||||
baseUrl,
|
||||
backupUrl,
|
||||
ali,
|
||||
alib,
|
||||
alio1,
|
||||
cos,
|
||||
cosb,
|
||||
coso1,
|
||||
hw,
|
||||
hwb,
|
||||
hwo1,
|
||||
hw_08c,
|
||||
hw_08h,
|
||||
hw_08ct,
|
||||
tf_hw,
|
||||
tf_tx,
|
||||
akamai,
|
||||
aliov,
|
||||
cosov,
|
||||
hwov,
|
||||
hk_bcache,
|
||||
}
|
||||
|
||||
extension CDNServiceDesc on CDNService {
|
||||
static const List<String> _descList = [
|
||||
'基础 URL(不推荐)',
|
||||
'备用 URL',
|
||||
'ali(阿里云)',
|
||||
'alib(阿里云)',
|
||||
'alio1(阿里云)',
|
||||
'cos(腾讯云)',
|
||||
'cosb(腾讯云,VOD 加速类型)',
|
||||
'coso1(腾讯云)',
|
||||
'hw(华为云,融合 CDN)',
|
||||
'hwb(华为云,融合 CDN)',
|
||||
'hwo1(华为云,融合 CDN)',
|
||||
'08c(华为云,融合 CDN)',
|
||||
'08h(华为云,融合 CDN)',
|
||||
'08ct(华为云,融合 CDN)',
|
||||
'tf_hw(华为云)',
|
||||
'tf_tx(腾讯云)',
|
||||
'akamai(Akamai 海外)',
|
||||
'aliov(阿里云海外)',
|
||||
'cosov(腾讯云海外)',
|
||||
'hwov(华为云海外)',
|
||||
'hk_bcache(Bilibili海外)',
|
||||
];
|
||||
String get description => _descList[index];
|
||||
}
|
||||
|
||||
extension CDNServiceHost on CDNService {
|
||||
static const List<String> _hostList = [
|
||||
'',
|
||||
'',
|
||||
'upos-sz-mirrorali.bilivideo.com',
|
||||
'upos-sz-mirroralib.bilivideo.com',
|
||||
'upos-sz-mirroralio1.bilivideo.com',
|
||||
'upos-sz-mirrorcos.bilivideo.com',
|
||||
'upos-sz-mirrorcosb.bilivideo.com',
|
||||
'upos-sz-mirrorcoso1.bilivideo.com',
|
||||
'upos-sz-mirrorhw.bilivideo.com',
|
||||
'upos-sz-mirrorhwb.bilivideo.com',
|
||||
'upos-sz-mirrorhwo1.bilivideo.com',
|
||||
'upos-sz-mirror08c.bilivideo.com',
|
||||
'upos-sz-mirror08h.bilivideo.com',
|
||||
'upos-sz-mirror08ct.bilivideo.com',
|
||||
'upos-tf-all-hw.bilivideo.com',
|
||||
'upos-tf-all-tx.bilivideo.com',
|
||||
'upos-hz-mirrorakam.akamaized.net',
|
||||
'upos-sz-mirroraliov.bilivideo.com',
|
||||
'upos-sz-mirrorcosov.bilivideo.com',
|
||||
'upos-sz-mirrorhwov.bilivideo.com',
|
||||
'cn-hk-eq-bcache-01.bilivideo.com',
|
||||
];
|
||||
String get host => _hostList[index];
|
||||
}
|
||||
|
||||
extension CDNServiceCode on CDNService {
|
||||
static const List<String> _codeList = [
|
||||
'baseUrl',
|
||||
'backupUrl',
|
||||
'ali',
|
||||
'alib',
|
||||
'alio1',
|
||||
'cos',
|
||||
'cosb',
|
||||
'coso1',
|
||||
'hw',
|
||||
'hwb',
|
||||
'hwo1',
|
||||
'hw_08c',
|
||||
'hw_08h',
|
||||
'hw_08ct',
|
||||
'tf_hw',
|
||||
'tf_tx',
|
||||
'akamai',
|
||||
'aliov',
|
||||
'cosov',
|
||||
'hwov',
|
||||
'hk_bcache',
|
||||
];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static CDNService? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return CDNService.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
30
lib/models/common/video/audio_quality.dart
Normal file
30
lib/models/common/video/audio_quality.dart
Normal file
@@ -0,0 +1,30 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum AudioQuality { k64, k132, k192, dolby, hiRes }
|
||||
|
||||
extension AudioQualityExt on AudioQuality {
|
||||
static const List<int> _codeList = [
|
||||
30216,
|
||||
30232,
|
||||
30280,
|
||||
30250,
|
||||
30251,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static AudioQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return AudioQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get description => const [
|
||||
'64K',
|
||||
'132K',
|
||||
'192K',
|
||||
'杜比全景声',
|
||||
'Hi-Res无损',
|
||||
][index];
|
||||
}
|
||||
40
lib/models/common/video/live_quality.dart
Normal file
40
lib/models/common/video/live_quality.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
enum LiveQuality {
|
||||
dolby,
|
||||
super4K,
|
||||
origin,
|
||||
bluRay,
|
||||
superHD,
|
||||
smooth,
|
||||
flunt,
|
||||
}
|
||||
|
||||
extension LiveQualityExt on LiveQuality {
|
||||
static const List<int> _codeList = [
|
||||
30000,
|
||||
20000,
|
||||
10000,
|
||||
400,
|
||||
250,
|
||||
150,
|
||||
80,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static LiveQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return LiveQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get description => const [
|
||||
'杜比',
|
||||
'4K',
|
||||
'原画',
|
||||
'蓝光',
|
||||
'超清',
|
||||
'高清',
|
||||
'流畅',
|
||||
][index];
|
||||
}
|
||||
21
lib/models/common/video/subtitle_pref_type.dart
Normal file
21
lib/models/common/video/subtitle_pref_type.dart
Normal file
@@ -0,0 +1,21 @@
|
||||
enum SubtitlePrefType { off, on, withoutAi, auto }
|
||||
|
||||
extension SubtitlePrefTypeExt on SubtitlePrefType {
|
||||
String get description => const [
|
||||
'默认不显示字幕',
|
||||
'优先选择非自动生成(ai)字幕',
|
||||
'跳过自动生成(ai)字幕,选择第一个可用字幕',
|
||||
'静音时等同第二项,非静音时等同第三项'
|
||||
][index];
|
||||
|
||||
static const List<String> _codeList = ['off', 'on', 'withoutAi', 'auto'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static SubtitlePrefType? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return SubtitlePrefType.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
34
lib/models/common/video/video_decode_type.dart
Normal file
34
lib/models/common/video/video_decode_type.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
// ignore_for_file: constant_identifier_names
|
||||
|
||||
enum VideoDecodeFormatType {
|
||||
DVH1,
|
||||
AV1,
|
||||
HEVC,
|
||||
AVC,
|
||||
}
|
||||
|
||||
extension VideoDecodeFormatTypeExt on VideoDecodeFormatType {
|
||||
String get description => const ['DVH1', 'AV1', 'HEVC', 'AVC'][index];
|
||||
|
||||
static const List<String> _codeList = ['dvh1', 'av01', 'hev1', 'avc1'];
|
||||
String get code => _codeList[index];
|
||||
|
||||
static VideoDecodeFormatType? fromCode(String code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return VideoDecodeFormatType.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static VideoDecodeFormatType? fromString(String val) {
|
||||
var result = VideoDecodeFormatType.values.first;
|
||||
for (var i in _codeList) {
|
||||
if (val.startsWith(i)) {
|
||||
result = VideoDecodeFormatType.values[_codeList.indexOf(i)];
|
||||
break;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
55
lib/models/common/video/video_quality.dart
Normal file
55
lib/models/common/video/video_quality.dart
Normal file
@@ -0,0 +1,55 @@
|
||||
enum VideoQuality {
|
||||
speed240,
|
||||
fluent360,
|
||||
clear480,
|
||||
high720,
|
||||
high72060,
|
||||
high1080,
|
||||
high1080plus,
|
||||
high108060,
|
||||
super4K,
|
||||
hdr,
|
||||
dolbyVision,
|
||||
super8k
|
||||
}
|
||||
|
||||
extension VideoQualityExt on VideoQuality {
|
||||
static const List<int> _codeList = [
|
||||
6,
|
||||
16,
|
||||
32,
|
||||
64,
|
||||
74,
|
||||
80,
|
||||
112,
|
||||
116,
|
||||
120,
|
||||
125,
|
||||
126,
|
||||
127,
|
||||
];
|
||||
int get code => _codeList[index];
|
||||
|
||||
static VideoQuality? fromCode(int code) {
|
||||
final index = _codeList.indexOf(code);
|
||||
if (index != -1) {
|
||||
return VideoQuality.values[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
String get description => const [
|
||||
'240P 极速',
|
||||
'360P 流畅',
|
||||
'480P 清晰',
|
||||
'720P 高清',
|
||||
'720P60 高帧率',
|
||||
'1080P 高清',
|
||||
'1080P+ 高码率',
|
||||
'1080P60 高帧率',
|
||||
'4K 超清',
|
||||
'HDR 真彩色',
|
||||
'杜比视界',
|
||||
'8K 超高清'
|
||||
][index];
|
||||
}
|
||||
Reference in New Issue
Block a user