platform.m.dart 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. class LoadVidResult {
  2. LoadVidResult({
  3. this.isSuccess = false,
  4. this.frameCount = 0,
  5. this.probeBase64,
  6. });
  7. String? probeBase64;
  8. int frameCount;
  9. bool isSuccess;
  10. factory LoadVidResult.fromJson(Map<String, dynamic> map) {
  11. return LoadVidResult(
  12. isSuccess: map['IsSuccess'],
  13. frameCount: map['FrameCount'],
  14. probeBase64: map["ProbeBase64"],
  15. );
  16. }
  17. }
  18. abstract class VidFrameProcessorBase {
  19. VidFrameProcessorBase(this.typeName);
  20. final String typeName;
  21. Map<String, dynamic> toJson() {
  22. return <String, dynamic>{};
  23. }
  24. String toJsonText() {
  25. final map = toJson();
  26. final values = map.values;
  27. final valuesTxt = values.join(',');
  28. return '$typeName|$valuesTxt';
  29. }
  30. }
  31. class VidFrameBrightnessProcessor extends VidFrameProcessorBase {
  32. VidFrameBrightnessProcessor(this.brightness) : super("Brightness");
  33. int brightness;
  34. factory VidFrameBrightnessProcessor.fromJson(Map<String, dynamic> map) {
  35. return VidFrameBrightnessProcessor(map['Brightness']);
  36. }
  37. Map<String, dynamic> toJson() {
  38. final map = super.toJson();
  39. map["Brightness"] = brightness;
  40. return map;
  41. }
  42. }
  43. class VidFrameContrastProcessor extends VidFrameProcessorBase {
  44. VidFrameContrastProcessor(this.contrast) : super("Contrast");
  45. int contrast;
  46. factory VidFrameContrastProcessor.fromJson(Map<String, dynamic> map) {
  47. return VidFrameContrastProcessor(map['Contrast']);
  48. }
  49. Map<String, dynamic> toJson() {
  50. final map = super.toJson();
  51. map["Contrast"] = contrast;
  52. return map;
  53. }
  54. }
  55. class GetVidFrameRequest {
  56. /// 获取Vid帧请求
  57. ///
  58. /// [name] Vid缓存文件名
  59. ///
  60. /// [index] 帧索引
  61. ///
  62. /// [processors] 图像处理器集合
  63. GetVidFrameRequest({
  64. required this.index,
  65. this.processors,
  66. });
  67. int index;
  68. List<VidFrameProcessorBase>? processors;
  69. Map<String, dynamic> toJson() {
  70. final map = <String, dynamic>{};
  71. map['Index'] = index;
  72. if (processors != null) {
  73. map['Processors'] = processors!.map((e) => e.toJsonText()).toList();
  74. }
  75. return map;
  76. }
  77. }
  78. class GetVidFrameResult {
  79. GetVidFrameResult({
  80. this.isSuccess = false,
  81. this.frameBase64,
  82. });
  83. String? frameBase64;
  84. bool isSuccess;
  85. factory GetVidFrameResult.fromJson(Map<String, dynamic> map) {
  86. return GetVidFrameResult(
  87. isSuccess: map['IsSuccess'],
  88. frameBase64: map["FrameBase64"],
  89. );
  90. }
  91. }