video_normalizer_platform_interface 0.1.1
video_normalizer_platform_interface: ^0.1.1 copied to clipboard
A common platform interface for the video_normalizer plugin: the public models, the decision engine, the encoder-settings resolver and the contract every platform implementation fulfils.
video_normalizer_platform_interface #
The common platform interface of video_normalizer.
Apps depend on video_normalizer, which re-exports the models and errors
defined here.
This package is where the behaviour that must be identical on every platform lives, in Dart, and is unit tested once:
| Models | VideoInput, VideoOutput, VideoInfo, VideoNormalizationRequest, VideoNormalizationConfiguration and the presets, VideoNormalizationResult, VideoCapabilities, VideoProcessingProgress |
| Errors | the sealed VideoNormalizationException hierarchy with its stable codes |
DecisionEngine |
skip, remux or transcode, with the reasons |
EncoderSettingsResolver |
output dimensions, frame rate, bitrate, profile, level, audio |
TargetSizePlanner |
the bitrate for a target file size, one resolution step down at most |
VideoNormalizerPlatform |
what an implementation has to provide: analysis, capabilities, running one fully resolved job, cancellation, progress events |
PigeonVideoNormalizer |
the implementation of that interface over the generated Pigeon channel, shared by Android and iOS |
A platform implementation executes a resolved job and validates its result. It decides nothing: what to do and with which settings is decided here.
Implementing a platform #
Extend VideoNormalizerPlatform and register an instance:
class VideoNormalizerFoo extends VideoNormalizerPlatform {
static void registerWith() {
VideoNormalizerPlatform.instance = VideoNormalizerFoo();
}
// ...
}
Android and iOS need no Dart code beyond
VideoNormalizerPlatform.instance = PigeonVideoNormalizer(platformName: '...'):
they implement the host API generated from pigeons/messages.dart.
The channel contract #
pigeons/messages.dart is the single definition. Regenerate the Dart, Kotlin
and Swift sides after editing it:
dart run pigeon --input pigeons/messages.dart
dart format lib/src/pigeon
Tests #
flutter test
They run against synthetic VideoInfo values and a fake channel. They prove
the rules in docs/PRESETS.md; they prove nothing
about native transcoding.