feat: 视频解码格式

This commit is contained in:
guozhigq
2023-08-10 11:50:45 +08:00
parent d5943d88b0
commit 7528526252
3 changed files with 150 additions and 24 deletions

View File

@ -89,3 +89,38 @@ extension AudioQualityDesc on AudioQuality {
];
get description => _descList[index];
}
enum VideoDecodeFormats {
AV1,
HEVC,
AVC,
}
extension VideoDecodeFormatsDesc on VideoDecodeFormats {
static final List<String> _descList = [
'AV1',
'HEVC',
'AVC',
];
get description => _descList[index];
}
extension VideoDecodeFormatsCode on VideoDecodeFormats {
static final List<String> _codeList = [
'av01',
'hev1',
'avc1',
];
get code => _codeList[index];
static VideoDecodeFormats? fromString(String val) {
var result = VideoDecodeFormats.values.first;
for (var i in _codeList) {
if (val.startsWith(i)) {
result = VideoDecodeFormats.values[_codeList.indexOf(i)];
break;
}
}
return result;
}
}