mediafilefind

package
v0.0.0-...-72e33f6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close(ctx context.Context, c dahuarpc.Conn, object int64) (bool, error)

func Create

func Create(ctx context.Context, c dahuarpc.Conn) (int64, error)

func Destroy

func Destroy(ctx context.Context, c dahuarpc.Conn, object int64) (bool, error)

func FindFile

func FindFile(ctx context.Context, c dahuarpc.Conn, object int64, condition Condition) (bool, error)

func GetCount

func GetCount(ctx context.Context, c dahuarpc.Conn, object int64) (int, error)

Types

type Condition

type Condition struct {
	Channel   int                `json:"Channel"`
	Dirs      []string           `json:"Dirs"`
	Types     []string           `json:"Types"`
	Order     ConditionOrder     `json:"Order"`
	Redundant string             `json:"Redundant"`
	Events    []string           `json:"Events"`
	StartTime dahuarpc.Timestamp `json:"StartTime"`
	EndTime   dahuarpc.Timestamp `json:"EndTime"`
	Flags     []string           `json:"Flags"`
}

func NewCondtion

func NewCondtion(startTime dahuarpc.Timestamp, endTime dahuarpc.Timestamp) Condition

func (Condition) Picture

func (c Condition) Picture() Condition

func (Condition) Video

func (c Condition) Video() Condition

type ConditionOrder

type ConditionOrder = string
const (
	ConditionOrderAscent  ConditionOrder = "Ascent"
	ConditionOrderDescent ConditionOrder = "Descent"
)

type FindNextFileInfo

type FindNextFileInfo struct {
	Channel     int                `json:"Channel"`
	StartTime   dahuarpc.Timestamp `json:"StartTime"`
	EndTime     dahuarpc.Timestamp `json:"EndTime"`
	Length      int                `json:"Length"`
	Type        string             `json:"Type"`
	FilePath    string             `json:"FilePath"`
	Duration    int                `json:"Duration"`
	Disk        int                `json:"Disk"`
	VideoStream string             `json:"VideoStream"`
	Flags       []string           `json:"Flags"`
	Events      []string           `json:"Events"`
	Cluster     int                `json:"Cluster"`
	Partition   int                `json:"Partition"`
	PicIndex    int                `json:"PicIndex"`
	Repeat      int                `json:"Repeat"`
	// WorkDir is the working directory (e.g. /mnt/dvr/mmc0p2_0).
	WorkDir string `json:"WorkDir"`
	// WorkDirSN is indicates that the WorkDir's name is the Serial Number (e.g ftp://192.168.20.30/test/share/XXXXXXXXXXXXXXX).
	WorkDirSN int `json:"WorkDirSN"`
}

func (FindNextFileInfo) Local

func (f FindNextFileInfo) Local() bool

Local checks if the file is stored directly on disk which allows it to be loaded through RPC_Loadfile.

func (FindNextFileInfo) UniqueTime

func (f FindNextFileInfo) UniqueTime(seed int, deviceLocation *time.Location) (time.Time, time.Time, error)

UniqueTime returns start and end times that do not conflict with other files.

Dahua devices can only handle timestamps that are precise up to the second (e.g. "2006-01-02 15:04:05"), the leftover microseconds (.000_000) are used create a unique time. A seed can optionally be passed to not conflict with other devices.

type FindNextFileResult

type FindNextFileResult struct {
	Found int                `json:"found"`
	Infos []FindNextFileInfo `json:"infos"`
}

func FindNextFile

func FindNextFile(ctx context.Context, c dahuarpc.Conn, object int64, count int) (FindNextFileResult, error)

type Stream

type Stream struct {
	// contains filtered or unexported fields
}

func NewStream

func NewStream(ctx context.Context, c dahuarpc.Conn, condtion Condition) (*Stream, error)

func (*Stream) Close

func (s *Stream) Close(c dahuarpc.Conn)

func (*Stream) Next

func (s *Stream) Next(ctx context.Context, c dahuarpc.Conn) ([]FindNextFileInfo, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL