This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camera] Interface method to allow concurrent recording and streaming of video #6550
Merged
auto-submit
merged 6 commits into
flutter:main
from
adam-harwood:aharwood/concurrent_stream_record_interface
Nov 1, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
880e038
Add interface method to allow concurrent recording and streaming of v…
b821ff6
Update packages/camera/camera_platform_interface/CHANGELOG.md
adam-harwood 68a0d05
A few tweaks from the code review
0fd25e7
Add some more newlines and add a check to ensure streamOptions fails …
1dc2c77
Run formatter
9300ddd
Change VideoCaptureOptions to use assert instead of throw
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
55 changes: 55 additions & 0 deletions
55
packages/camera/camera_platform_interface/lib/src/types/video_capture_options.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,55 @@ | ||
| // 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. | ||
|
|
||
| import 'package:flutter/foundation.dart'; | ||
|
|
||
| import 'camera_image_data.dart'; | ||
|
|
||
| /// Options wrapper for [CameraPlatform.startVideoCapturing] parameters. | ||
| @immutable | ||
| class VideoCaptureOptions { | ||
| /// Constructs a new instance. | ||
| const VideoCaptureOptions( | ||
| this.cameraId, { | ||
| this.maxDuration, | ||
| this.streamCallback, | ||
| this.streamOptions, | ||
| }) : assert( | ||
| streamOptions == null || streamCallback != null, | ||
| 'Must specify streamCallback if providing streamOptions.', | ||
| ); | ||
|
|
||
| /// The ID of the camera to use for capturing. | ||
| final int cameraId; | ||
|
|
||
| /// The maximum time to perform capturing for. | ||
| /// | ||
| /// By default there is no maximum on the capture time. | ||
| final Duration? maxDuration; | ||
|
|
||
| /// An optional callback to enable streaming. | ||
adam-harwood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// | ||
| /// If set, then each image captured by the camera will be | ||
| /// passed to this callback. | ||
| final Function(CameraImageData image)? streamCallback; | ||
|
|
||
| /// Configuration options for streaming. | ||
bparrishMines marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| /// | ||
| /// Should only be set if a streamCallback is also present. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If this is true, can you add an assertion to the constructor that verifies this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, done. |
||
| final CameraImageStreamOptions? streamOptions; | ||
|
|
||
| @override | ||
| bool operator ==(Object other) => | ||
| identical(this, other) || | ||
| other is VideoCaptureOptions && | ||
| runtimeType == other.runtimeType && | ||
| cameraId == other.cameraId && | ||
| maxDuration == other.maxDuration && | ||
| streamCallback == other.streamCallback && | ||
| streamOptions == other.streamOptions; | ||
|
|
||
| @override | ||
| int get hashCode => | ||
adam-harwood marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Object.hash(cameraId, maxDuration, streamCallback, streamOptions); | ||
| } | ||
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
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.