camera_option.dart 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. class CameraRecordOption {
  2. int videoWidth;
  3. int videoHeight;
  4. int fps;
  5. VideoCodecs videoCodecs;
  6. int crf; // only use in android
  7. int encoderFps; // only use in android
  8. VideoQuality quality;
  9. int videoBitrate;
  10. int gop;
  11. CameraRecordOption(
  12. {this.videoWidth,
  13. this.videoHeight,
  14. this.fps,
  15. this.videoCodecs,
  16. this.crf,
  17. this.encoderFps,
  18. this.quality,
  19. this.videoBitrate,
  20. this.gop});
  21. Map toMap() {
  22. Map data = {
  23. "videoWidth": videoWidth,
  24. "videoHeight": videoHeight,
  25. "fps": fps,
  26. "videoCodecs": videoCodecs?.index,
  27. "crf": crf,
  28. "encoderFps": encoderFps,
  29. "quality": quality?.index,
  30. "videoBitrate": videoBitrate,
  31. "gop": gop,
  32. };
  33. data.removeWhere((key, value) => value == null);
  34. return data;
  35. }
  36. }
  37. class CameraComposeOption {
  38. int outputWidth;
  39. int outputHeight;
  40. int frameRate;
  41. int crf; // only use in android
  42. int gop;
  43. int bitrate;
  44. double scaleRate;
  45. VideoCodecs videoCodecs;
  46. VideoQuality quality;
  47. VideoDisplayMode scaleMode;
  48. CameraComposeOption(
  49. {this.outputWidth,
  50. this.outputHeight,
  51. this.frameRate,
  52. this.crf,
  53. this.gop,
  54. this.bitrate,
  55. this.scaleRate,
  56. this.videoCodecs,
  57. this.quality,
  58. this.scaleMode});
  59. Map toMap() {
  60. Map data = {
  61. "outputWidth": outputWidth,
  62. "outputHeight": outputHeight,
  63. "frameRate": frameRate,
  64. "crf": crf,
  65. "gop": gop,
  66. "bitrate": bitrate,
  67. "scaleRate": scaleRate,
  68. "videoCodecs": videoCodecs?.index,
  69. "quality": quality?.index,
  70. "scaleMode": scaleMode?.index,
  71. };
  72. data.removeWhere((key, value) => value == null);
  73. return data;
  74. }
  75. }
  76. enum VideoCodecs { H264_HARDWARE, H264_SOFT_OPENH264, H264_SOFT_FFMPEG }
  77. enum VideoQuality { SSD, HD, SD, LD, PD, EPD }
  78. enum VideoDisplayMode { SCALE, FILL }