-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camera] CameraPlatform.createCameraWithSettings #3615
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
Merged
auto-submit
merged 23 commits into
flutter:main
from
mtbo-org:camera-platform-interface
Oct 23, 2023
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d3ec9b8
PR that has only the platform interface package changes from the #358…
PROGrand 54e757a
touch
PROGrand 197d67f
touch
PROGrand 2a83a10
touch
PROGrand 5dbb4e8
Update packages/camera/camera_platform_interface/pubspec.yaml
PROGrand 3343cef
Update packages/camera/camera_platform_interface/CHANGELOG.md
PROGrand 3a7db1a
Applied suggestions of https://github.com/flutter/packages/pull/3615#…
PROGrand 40c4385
tested and analyzed
PROGrand 442d25f
Delete packages/camera/camera_platform_interface/coverage/lcov.info
PROGrand 462d032
Merge branch 'main' into camera-platform-interface
PROGrand 3f3e092
delegated as in the "Note" section under (1) [here]( https://github.c…
PROGrand 030d134
lexical corrections
PROGrand e8231d6
removed excessive comments
PROGrand a29e41b
correct description
PROGrand 820f4b4
test all parameters combinations in operator ==
PROGrand 26ac77d
Merge branch 'main' into camera-platform-interface
PROGrand d4d3c53
Merge branch 'main' into camera-platform-interface
PROGrand 891dcca
Merge branch 'main' into camera-platform-interface
PROGrand afed7bc
tests are simplified
PROGrand bb01c48
Merge branch 'main' into camera-platform-interface
PROGrand a3a35a7
Merge branch 'main' into camera-platform-interface
PROGrand 21967bc
Merge branch 'main' into camera-platform-interface
PROGrand 7af349c
test: createCameraWithSettings() should call createCamera() using par…
PROGrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
77 changes: 77 additions & 0 deletions
77
packages/camera/camera_platform_interface/lib/src/types/media_settings.dart
This file contains hidden or 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,77 @@ | ||
| // Copyright 2013 The Flutter Authors. All rights reserved. | ||
PROGrand marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // Use of this source code is governed by a BSD-style license that can be | ||
| // found in the LICENSE file. | ||
|
|
||
| // ignore_for_file: avoid_equals_and_hash_code_on_mutable_classes | ||
|
|
||
| import 'resolution_preset.dart'; | ||
|
|
||
| /// Recording media settings. | ||
| /// | ||
| /// Used in [CameraPlatform.createCameraWithSettings]. | ||
| /// Allows to tune recorded video parameters, such as resolution, frame rate, bitrate. | ||
| /// If [fps], [videoBitrate] or [audioBitrate] are passed, they must be greater than zero. | ||
| class MediaSettings { | ||
| /// Creates a [MediaSettings]. | ||
| const MediaSettings({ | ||
| this.resolutionPreset, | ||
| this.fps, | ||
| this.videoBitrate, | ||
| this.audioBitrate, | ||
| this.enableAudio = false, | ||
| }) : assert(fps == null || fps > 0, 'fps must be null or greater than zero'), | ||
| assert(videoBitrate == null || videoBitrate > 0, | ||
| 'videoBitrate must be null or greater than zero'), | ||
| assert(audioBitrate == null || audioBitrate > 0, | ||
| 'audioBitrate must be null or greater than zero'); | ||
|
|
||
| /// [ResolutionPreset] affect the quality of video recording and image capture. | ||
| final ResolutionPreset? resolutionPreset; | ||
|
|
||
| /// Rate at which frames should be captured by the camera in frames per second. | ||
| final int? fps; | ||
|
|
||
| /// The video encoding bit rate for recording. | ||
| final int? videoBitrate; | ||
|
|
||
| /// The audio encoding bit rate for recording. | ||
| final int? audioBitrate; | ||
PROGrand marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// Controls audio presence in recorded video. | ||
| final bool enableAudio; | ||
|
|
||
| @override | ||
| bool operator ==(Object other) { | ||
| if (identical(other, this)) { | ||
| return true; | ||
| } | ||
| if (other.runtimeType != runtimeType) { | ||
| return false; | ||
| } | ||
| return other is MediaSettings && | ||
| resolutionPreset == other.resolutionPreset && | ||
| fps == other.fps && | ||
| videoBitrate == other.videoBitrate && | ||
| audioBitrate == other.audioBitrate && | ||
| enableAudio == other.enableAudio; | ||
| } | ||
|
|
||
| @override | ||
| int get hashCode => Object.hash( | ||
| resolutionPreset, | ||
| fps, | ||
| videoBitrate, | ||
| audioBitrate, | ||
| enableAudio, | ||
| ); | ||
|
|
||
| @override | ||
| String toString() { | ||
| return 'MediaSettings{' | ||
| 'resolutionPreset: $resolutionPreset, ' | ||
| 'fps: $fps, ' | ||
| 'videoBitrate: $videoBitrate, ' | ||
| 'audioBitrate: $audioBitrate, ' | ||
| 'enableAudio: $enableAudio}'; | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.