mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-29 05:40:17 +08:00
tweaks (#2426)
* opt: danmaku weight
* opt: cache clean
* opt: level img
* opt: play icon
* opt: svg big-vip
* opt: webview ua
* opt: simple dialog
* feat: export vtt
* tweak
* opt: mapIndexed
* feat: more subtitle
* refa: settings page
* feat: codec list options
* drawPath
Signed-off-by: dom <githubaccount56556@proton.me>
* custom dialog option
Signed-off-by: dom <githubaccount56556@proton.me>
* update
Signed-off-by: dom <githubaccount56556@proton.me>
* Revert "drawPath"
This reverts commit e8a4b19f0f.
* opt: _initStreamIndex
* fix: avoid gap
* fix: scale [skip ci]
* fix: hide repost menu not login
* tweaks
Signed-off-by: dom <githubaccount56556@proton.me>
---------
Co-authored-by: dom <githubaccount56556@proton.me>
This commit is contained in:
committed by
GitHub
parent
3dee6a85e5
commit
9d94c72e95
@@ -1,4 +1,5 @@
|
||||
import 'package:PiliPlus/models/common/video/cdn_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models_new/live/live_room_play_info/codec.dart';
|
||||
import 'package:PiliPlus/utils/extension/iterable_ext.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
@@ -93,4 +94,28 @@ abstract final class VideoUtils {
|
||||
final urlInfo = e.urlInfo.getOrFirst(index);
|
||||
return (liveCdnUrl ?? urlInfo.host) + e.baseUrl + urlInfo.extra;
|
||||
}
|
||||
|
||||
static VideoDecodeFormatType selectCodec(
|
||||
Iterable<String> codecs,
|
||||
List<VideoDecodeFormatType> preferCodecs,
|
||||
) {
|
||||
if (preferCodecs.isNotEmpty) {
|
||||
int bestIndex = preferCodecs.length;
|
||||
for (final e in codecs) {
|
||||
for (int i = 0; i < bestIndex; i++) {
|
||||
if (preferCodecs[i].codes.any(e.startsWith)) {
|
||||
bestIndex = i;
|
||||
if (bestIndex == 0) {
|
||||
return preferCodecs[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bestIndex < preferCodecs.length) {
|
||||
return preferCodecs[bestIndex];
|
||||
}
|
||||
}
|
||||
return VideoDecodeFormatType.fromString(codecs.first);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user