12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- part of 'data_host.dart';
- class _VidDataHostShell implements VidDataHostInterface {
- _VidDataHostShell(this.url);
- static PlatformService get _platform => VidDataHostEnv.platformGetter!.call();
- VidUsImageData? _data;
- @override
- final String url;
- @override
- int get frameCount => _data!.imageCount;
- @override
- VidUsProbe get probe => _data!.probe;
- @override
- Future<VidUsImageData?> getData() async => _data;
- @override
- Future<VidDataHostLoadInfo?> load() async {
- final rst = await _platform.getVidFile(url);
- if (rst == null || rst.isEmpty) return null;
- final buffer = const Base64Decoder().convert(rst);
- _data = VidUsImageData(buffer);
- final info = VidDataHostLoadInfo(_data!.probe);
- return info;
- }
- @override
- Future<VidUsImage?> getFrame<TProcessor extends VidFrameProcessor>(
- int index, {
- List<TProcessor>? processors,
- }) async {
- return _data?.getImage(index);
- }
- @override
- Future<void> release() async {
- _data = null;
- }
- }
|