-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
111 changed files
with
2,810 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
436df69a4684aaf7d0d1b09b61bb29c75b32ad61 | ||
9b6945b465a104c7dea41f3042a70781abc39718 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
...camerax/android/src/main/java/io/flutter/plugins/camerax/FallbackStrategyHostApiImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// Copyright 2013 The Flutter Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.camerax; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.annotation.VisibleForTesting; | ||
import androidx.camera.video.FallbackStrategy; | ||
import androidx.camera.video.Quality; | ||
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.FallbackStrategyHostApi; | ||
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint; | ||
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoResolutionFallbackRule; | ||
|
||
/** | ||
* Host API implementation for {@link FallbackStrategy}. | ||
* | ||
* <p>This class may handle instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class FallbackStrategyHostApiImpl implements FallbackStrategyHostApi { | ||
private final InstanceManager instanceManager; | ||
|
||
private final FallbackStrategyProxy proxy; | ||
|
||
/** Proxy for constructors and static method of {@link FallbackStrategy}. */ | ||
@VisibleForTesting | ||
public static class FallbackStrategyProxy { | ||
/** Creates an instance of {@link FallbackStrategy}. */ | ||
public @NonNull FallbackStrategy create( | ||
@NonNull VideoQualityConstraint videoQualityConstraint, | ||
@NonNull VideoResolutionFallbackRule fallbackRule) { | ||
Quality videoQuality = | ||
QualitySelectorHostApiImpl.getQualityFromVideoQualityConstraint(videoQualityConstraint); | ||
|
||
switch (fallbackRule) { | ||
case HIGHER_QUALITY_OR_LOWER_THAN: | ||
return FallbackStrategy.higherQualityOrLowerThan(videoQuality); | ||
case HIGHER_QUALITY_THAN: | ||
return FallbackStrategy.higherQualityThan(videoQuality); | ||
case LOWER_QUALITY_OR_HIGHER_THAN: | ||
return FallbackStrategy.lowerQualityOrHigherThan(videoQuality); | ||
case LOWER_QUALITY_THAN: | ||
return FallbackStrategy.lowerQualityThan(videoQuality); | ||
} | ||
throw new IllegalArgumentException( | ||
"Specified fallback rule " + fallbackRule + " unrecognized."); | ||
} | ||
} | ||
|
||
/** | ||
* Constructs a {@link FallbackStrategyHostApiImpl}. | ||
* | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public FallbackStrategyHostApiImpl(@NonNull InstanceManager instanceManager) { | ||
this(instanceManager, new FallbackStrategyProxy()); | ||
} | ||
|
||
/** | ||
* Constructs a {@link FallbackStrategyHostApiImpl}. | ||
* | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
* @param proxy proxy for constructors and static method of {@link FallbackStrategy} | ||
*/ | ||
FallbackStrategyHostApiImpl( | ||
@NonNull InstanceManager instanceManager, @NonNull FallbackStrategyProxy proxy) { | ||
this.instanceManager = instanceManager; | ||
this.proxy = proxy; | ||
} | ||
|
||
/** | ||
* Creates a {@link FallbackStrategy} instance with the video quality and fallback rule specified. | ||
*/ | ||
@Override | ||
public void create( | ||
@NonNull Long identifier, | ||
@NonNull VideoQualityConstraint videoQualityConstraint, | ||
@NonNull VideoResolutionFallbackRule fallbackRule) { | ||
instanceManager.addDartCreatedInstance( | ||
proxy.create(videoQualityConstraint, fallbackRule), identifier); | ||
} | ||
} |
Oops, something went wrong.