Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
VideoHandler is a handler for video streams. A handler should do its work and return as fast as possible. If a handler needs to modify the given frame in any way, it should first make a copy of it as the given frame is shared by all handlers (concurrently).
Even if you are not modifying the given frame but you are doing some expensive image processing, it might be better to copy it internally and return ASAP, deferring the processing to a separate goroutine (you might need to queue frames).
After doing its work, a VideoHandler must call wg.Done() before returning.
type Video ¶
type Video struct {
// contains filtered or unexported fields
}
Video handles starting a robot's video stream, receiving and decoding the data from it and sending to all registered VideoHandlers and stopping the video stream. The decoding relies on GoCV (https://gocv.io).
func New ¶
New creates a new Video instance. The control parameter is used to start stop the video stream and setup the video connection address.
func (*Video) StartStream ¶
StartStream starts the video stream (if it has not started yet) and starts sending video frames to the given videoHandler. It returns a positive int token (used to stop the stream when needed) and a nil error on success and a non-nil error on failure.
func (*Video) StopStream ¶
StopStream stops sending frames to the VideoHandler associated with the given token and remove it from the list of VideoHandlers. If it is the last VideoHandler in the list, the robot's video stream is stopped.