Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[camera] add video stabilization #7108

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ruicraveiro
Copy link

@ruicraveiro ruicraveiro commented Jul 12, 2024

Adds support for video stabilization to camera_platform_interface, camera_avfoundation, camera_android_camerax and camera packages.

The video stabilization modes are defined in the new VideoStabilizationMode enum defined in camera_platform_interface:

/// The possible video stabilization modes that can be capturing video.
enum VideoStabilizationMode {
  /// Video stabilization is disabled.
  off,

  /// Basic video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_ON on Android
  /// and throws CameraException on iOS.
  on,

  /// Standard video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
  /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeStandard
  /// on iOS.
  standard,

  /// Cinematic video stabilization is enabled.
  /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
  /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeCinematic
  /// on iOS.
  cinematic,

  /// Extended cinematic video stabilization is enabled.
  /// Maps to AVCaptureVideoStabilizationModeCinematicExtended on iOS and
  /// throws CameraException on Android.
  cinematicExtended,
}

There is some subjectivity on the way with which I mapped the modes to both platforms, and here's a document that compares the several modes: https://docs.google.com/spreadsheets/d/1TLOLZHR5AcyPlr-y75aN-DbR0ssZLJjpV_OAJkRC1FI/edit?usp=sharing, which you can comment on.

List which issues are fixed by this PR. You must list at least one issue.
Partially implements flutter/flutter#89525

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Copy link

google-cla bot commented Jul 12, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

- Adds support for video stabilization to camera:

    Adds getVideoStabilizationSupportedModes() and
    setVideoStabilizationMode() methods to CameraController.

- Adds support for video stabilization to camera_avfoundation

- Adds support for video stabilization to camera_android_camerax

- Adds support for video stabilization to camera_platform_interface:

    - Adds getVideoStabilizationSupportedModes() and
    setVideoStabilizationMode() methods to CameraPlatform.

    - Adds VideoStabilizationMode enum to represent an
    abstraction of the available video stabilization modes,
    meant for Android and iOS, mapped as follows:

      /// Video stabilization is disabled.
      off,

      /// Standard video stabilization is enabled.
      /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_ON on Android
      /// and throws CameraException on iOS.
      on,

      /// Standard video stabilization is enabled.
      /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
      /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeStandard
      /// on iOS.
      standard,

      /// Cinematic video stabilization is enabled.
      /// Maps to CONTROL_VIDEO_STABILIZATION_MODE_PREVIEW_STABILIZATION on Android
      /// (camera_android_camerax) and to AVCaptureVideoStabilizationModeCinematic
      /// on iOS.
      cinematic,

      /// Extended cinematic video stabilization is enabled.
      /// Maps to AVCaptureVideoStabilizationModeCinematicExtended on iOS and
      /// throws CameraException on Android.
      cinematicExtended,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
1 participant