Documentation
¶
Overview ¶
Package videostore contains the implementation of the video storage camera component.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Model = resource.ModelNamespace("viam").WithFamily("video").WithModel("storage")
Model is the model for the video storage camera component.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Name string
Type SourceType
Storage StorageConfig
Encoder EncoderConfig
FramePoller FramePollerConfig
}
Config configures a videostore.
type ContainerFormat ¶ added in v0.0.8
type ContainerFormat int
ContainerFormat specifies the output container format for concatenation.
const ( // ContainerDefault is the default format (currently MP4 with faststart). ContainerDefault ContainerFormat = iota // ContainerMP4 produces standard MP4 with moov atom at the beginning for progressive playback. ContainerMP4 // ContainerFMP4 produces fragmented MP4 with moof/mdat pairs for streaming. ContainerFMP4 )
func (ContainerFormat) String ¶ added in v0.0.8
func (c ContainerFormat) String() string
String returns the string representation of the container format.
type EncoderConfig ¶
EncoderConfig is the config for the video encoder.
func (EncoderConfig) Validate ¶
func (c EncoderConfig) Validate() error
Validate returns an error if the EncoderConfig is invalid.
type FetchRequest ¶
type FetchRequest struct {
From time.Time
To time.Time
Container ContainerFormat
}
FetchRequest is the request to the Fetch method.
func (*FetchRequest) Validate ¶
func (r *FetchRequest) Validate() error
Validate returns an error if the FetchRequest is invalid.
type FetchResponse ¶
type FetchResponse struct {
Video []byte
}
FetchResponse is the resonse to the Fetch method.
type FramePollerConfig ¶
FramePollerConfig is the config for the frame poller.
func (FramePollerConfig) Validate ¶
func (c FramePollerConfig) Validate() error
Validate returns an error if the FramePollerConfig is invalid.
type RTPVideoStore ¶
type RTPVideoStore interface {
VideoStore
Segmenter() *RawSegmenter
}
RTPVideoStore stores video derived from RTP packets and provides APIs to request the stored video.
func NewRTPVideoStore ¶
func NewRTPVideoStore(ctx context.Context, config Config, logger logging.Logger) (RTPVideoStore, error)
NewRTPVideoStore returns a VideoStore that stores video it receives from the caller.
type RawSegmenter ¶
type RawSegmenter struct {
// contains filtered or unexported fields
}
RawSegmenter stores video in supported codecs to disk in segment video files
func (*RawSegmenter) Close ¶
func (rs *RawSegmenter) Close() error
Close closes the segmenter and writes the trailer to prevent corruption when exiting early in the middle of a segment. Init may be called after Close
func (*RawSegmenter) Init ¶
func (rs *RawSegmenter) Init(codec CodecType, width, height int) error
Init initializes the *RawSegmenter Close must be called to free the resources taken during Init Note: May write to disk
func (*RawSegmenter) WritePacket ¶
func (rs *RawSegmenter) WritePacket(payload []byte, pts, dts int64, isIDR bool) error
WritePacket writes video data in the codec passed to Init to the current segment file. Can't be called before Init is called
type SaveRequest ¶
SaveRequest is the request to the Save method.
func (*SaveRequest) Validate ¶
func (r *SaveRequest) Validate() error
Validate returns an error if the SaveRequest is invalid.
type SaveResponse ¶
type SaveResponse struct {
Filename string
}
SaveResponse is the response to the Save method.
type SourceType ¶
type SourceType int
SourceType describes the type of video source.
const ( // SourceTypeUnknown is an invalid type. SourceTypeUnknown SourceType = iota // SourceTypeFrame is a video store that creates a video from frames. SourceTypeFrame // SourceTypeRTP is a video store that creates a video from rtp packets. SourceTypeRTP // SourceTypeReadOnly is a video store that only reads already stored segment files. SourceTypeReadOnly )
func (SourceType) String ¶
func (t SourceType) String() string
type StorageConfig ¶
type StorageConfig struct {
SizeGB int
OutputFileNamePrefix string
UploadPath string
StoragePath string
}
StorageConfig is the config for storage.
func (StorageConfig) Validate ¶
func (c StorageConfig) Validate() error
Validate returns an error if the StorageConfig is invalid.
type StorageState ¶ added in v0.0.8
type StorageState struct {
VideoRanges indexer.VideoRanges
StorageLimitGB int
DeviceStorageRemainingGB float64
StoragePath string
}
StorageState summarizes the state of the stored video segments and storage config info.
type VideoStore ¶
type VideoStore interface {
Fetch(ctx context.Context, r *FetchRequest) (*FetchResponse, error)
FetchStream(ctx context.Context, r *FetchRequest, emit func(video.Chunk) error) error
Save(ctx context.Context, r *SaveRequest) (*SaveResponse, error)
Close()
GetStorageState(ctx context.Context) (*StorageState, error)
}
VideoStore stores video and provides APIs to request the stored video.
func NewFramePollingVideoStore ¶
func NewFramePollingVideoStore(ctx context.Context, config Config, logger logging.Logger) (VideoStore, error)
NewFramePollingVideoStore returns a VideoStore that stores video it encoded from polling frames from a camera.Camera.
func NewReadOnlyVideoStore ¶
func NewReadOnlyVideoStore(ctx context.Context, config Config, logger logging.Logger) (VideoStore, error)
NewReadOnlyVideoStore returns a VideoStore that can return stored video but doesn't create new video segements.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package indexer manages metadata for video files stored on disk.
|
Package indexer manages metadata for video files stored on disk. |
|
Package vsutils provides shared utility functions for video store.
|
Package vsutils provides shared utility functions for video store. |