-
Notifications
You must be signed in to change notification settings - Fork 111
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
[RSDK-9458] Remove 'Stream' from Camera interface #4691
base: main
Are you sure you want to change the base?
Changes from all commits
a643d22
41cb592
f6e3d69
d6439dd
6417a56
59c36ec
16079fa
9084264
c44afa2
11b1d7d
438d550
0d8081b
824c30f
e744b68
fd50881
e570393
6646d78
612e91c
9029a05
6ec0041
ef1bd0e
d01159a
44611d5
146345f
c698e16
9da582f
1b51109
eaf28d7
4fe7e36
b4e1960
fc6665d
8afb714
375a35f
5bf744c
2a1cd8b
1233170
95f3f42
b208d2c
0b85975
c44454b
d848d20
09e295c
3edf860
b7c4635
63b7681
c91b68d
d63980e
6ffbae2
65b5bad
9a9612f
ab7e736
8244dfd
5feb0ed
5c0191d
a1fcc2f
859d027
de2cb6a
21fe63a
2fdabbf
f3e9fd5
b27c121
4a8ad4a
5ecc6ed
7815d22
7283fef
58fce9c
0b08026
728d547
4c4b53c
96fcdb5
cd7e4c2
d9b0136
4aef8b1
7f47f80
c137806
278a362
f997af7
1204b54
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -79,12 +79,6 @@ type ImageMetadata struct { | |
} | ||
|
||
// A Camera is a resource that can capture frames. | ||
type Camera interface { | ||
resource.Resource | ||
VideoSource | ||
} | ||
|
||
// VideoSource represents anything that can capture frames. | ||
// For more information, see the [camera component docs]. | ||
// | ||
// Image example: | ||
|
@@ -103,17 +97,6 @@ type Camera interface { | |
// | ||
// images, metadata, err := myCamera.Images(context.Background()) | ||
// | ||
// Stream example: | ||
// | ||
// myCamera, err := camera.FromRobot(machine, "my_camera") | ||
// | ||
// // gets the stream from a camera | ||
// stream, err := myCamera.Stream(context.Background()) | ||
// | ||
// // gets an image from the camera stream | ||
// img, release, err := stream.Next(context.Background()) | ||
// defer release() | ||
// | ||
// NextPointCloud example: | ||
// | ||
// myCamera, err := camera.FromRobot(machine, "my_camera") | ||
|
@@ -128,7 +111,8 @@ type Camera interface { | |
// err = myCamera.Close(context.Background()) | ||
// | ||
// [camera component docs]: https://docs.viam.com/components/camera/ | ||
type VideoSource interface { | ||
type Camera interface { | ||
resource.Resource | ||
// Image returns a byte slice representing an image that tries to adhere to the MIME type hint. | ||
// Image also may return metadata about the frame. | ||
Image(ctx context.Context, mimeType string, extra map[string]interface{}) ([]byte, ImageMetadata, error) | ||
|
@@ -137,20 +121,20 @@ type VideoSource interface { | |
// along with associated metadata (just timestamp for now). It's not for getting a time series of images from the same imager. | ||
Images(ctx context.Context) ([]NamedImage, resource.ResponseMetadata, error) | ||
|
||
// Stream returns a stream that makes a best effort to return consecutive images | ||
// that may have a MIME type hint dictated in the context via gostream.WithMIMETypeHint. | ||
Stream(ctx context.Context, errHandlers ...gostream.ErrorHandler) (gostream.VideoStream, error) | ||
|
||
// NextPointCloud returns the next immediately available point cloud, not necessarily one | ||
// a part of a sequence. In the future, there could be streaming of point clouds. | ||
NextPointCloud(ctx context.Context) (pointcloud.PointCloud, error) | ||
|
||
// Properties returns properties that are intrinsic to the particular | ||
// implementation of a camera. | ||
Properties(ctx context.Context) (Properties, error) | ||
} | ||
|
||
// Close shuts down the resource and prevents further use. | ||
Close(ctx context.Context) error | ||
// StreamCamera is a camera that has `Stream` embedded to directly integrate with gostream. | ||
// Note that generally, when writing camera components from scratch, embedding `Stream` is an anti-pattern. | ||
type StreamCamera interface { | ||
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. I can rename this to VideoSource - less of a break I think, even if the interface has changed. That being said - the things that care about this struct still being a video source are set not to use Videsoruces in the (hopefully near) future. |
||
Camera | ||
Stream(ctx context.Context, errHandlers ...gostream.ErrorHandler) (gostream.VideoStream, error) | ||
Comment on lines
+133
to
+137
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. this is meant to be removed in a follow up pr - affected drivers are transform, ffmpeg, fake, image_file and webcam |
||
} | ||
|
||
// ReadImage reads an image from the given source that is immediately available. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a lot of files changed here. Am I correct that these changes to VideoSource/Camera/StreamCamera are the only real changes and everything else is the refactor to appease the compiler?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of - in the process of deprecating Stream, different methods are being used in vision, and the stream server now takes context to refresh the streams - I can break up this pr into independent pieces and remove some of sean yu's renames to make it smaller, I do think this was the diff that made the most sense for his manual testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The camera driver changes + the new
StreamCamera
interface (ffmpeg, transformpipeline, webcam) are there to appease the compiler without refactoring those drivers intensely.