Documentation
¶
Overview ¶
Package videostore contains the implementation of the video storage camera component.
Index ¶
- Variables
- func ParseDateTimeString(datetime string) (time.Time, error)
- func SetFFmpegLogCallback()
- func SetLibAVLogLevel(level string)
- type CodecType
- type Config
- type EncoderConfig
- type FetchRequest
- type FetchResponse
- type FramePollerConfig
- type RTPVideoStore
- type RawSegmenter
- type SaveRequest
- type SaveResponse
- type SourceType
- type StorageConfig
- type VideoStore
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 ¶
func ParseDateTimeString ¶
ParseDateTimeString parses a date and time string in the format "2006-01-02_15-04-05". Returns a time.Time object and an error if the string is not in the correct format.
func SetFFmpegLogCallback ¶
func SetFFmpegLogCallback()
SetFFmpegLogCallback sets the custom log callback for ffmpeg.
func SetLibAVLogLevel ¶
func SetLibAVLogLevel(level string)
SetLibAVLogLevel sets the libav log level. this is global for the entire OS process. valid inputs are "info", "warn", "error", "debug" https://www.ffmpeg.org/doxygen/2.5/group__lavu__log__constants.html
Types ¶
type Config ¶
type Config struct { Type SourceType Storage StorageConfig Encoder EncoderConfig FramePoller FramePollerConfig }
Config configures a videostore.
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 ¶
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(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 VideoStore ¶
type VideoStore interface { Fetch(ctx context.Context, r *FetchRequest) (*FetchResponse, error) Save(ctx context.Context, r *SaveRequest) (*SaveResponse, error) Close() }
VideoStore stores video and provides APIs to request the stored video
func NewFramePollingVideoStore ¶
func NewFramePollingVideoStore(_ 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(config Config, logger logging.Logger) (VideoStore, error)
NewReadOnlyVideoStore returns a VideoStore that can return stored video but doesn't create new video segements