Documentation ¶
Overview ¶
Package mjpeg implements support for mjpeg (sometimes M-JPEG) video streams.
Each frame of the stream is sent as an encoded JPEG. This, while it has quite a bit of overhead, is simple to work with both from a client and server point of view. Clients update the stream frame-by-frame with a golang image.Image.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct { // FrameDuration determines how many frames per second are sent to the // client. FrameDuration time.Duration // Context is the root context -- not related to the context of the // per-connection HTTP streams, which is pulled from the http.Request Context context.Context }
Options contains all the knobs exposed from the library.
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream contains a handle to the underlying image to be distributed to listening clients, as well as some internal state.
This is thread-safe; any client may update or call methods on this object, and that will make its way out to all clients.
func NewStream ¶
func NewStream() *Stream
NewStream will return a new Stream object, with default options. If control over timings, etc is required, you may use the NewStreamWithOptions helper.
func NewStreamWithOptions ¶
NewStreamWithOptions will return a new Stream object, with the options specified by the caller.