Documentation
¶
Index ¶
- type VideoEngine
- func (e *VideoEngine) DetectByExtension(path string) bool
- func (e *VideoEngine) DetectByHeuristic(path string, header []byte) bool
- func (e *VideoEngine) DetectByMagic(header []byte) bool
- func (e *VideoEngine) Diff(ctx context.Context, oldPath string, oldReader io.Reader, newPath string, ...) (string, error)
- func (e *VideoEngine) Metadata() *core.FileMetadata
- func (e *VideoEngine) Name() string
- func (e *VideoEngine) Preview(header []byte, size int64, reader io.Reader, maxLines int) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type VideoEngine ¶
type VideoEngine struct {
chunker.DefaultSelector
}
VideoEngine handles common video container formats (MP4, MOV, AVI, MKV, WebM). Detection is purely byte-based; no third-party codecs are used.
func (*VideoEngine) DetectByExtension ¶
func (e *VideoEngine) DetectByExtension(path string) bool
DetectByExtension checks if the path's extension is a known video type.
func (*VideoEngine) DetectByHeuristic ¶
func (e *VideoEngine) DetectByHeuristic(path string, header []byte) bool
DetectByHeuristic returns false; videos are not sniffed heuristically.
func (*VideoEngine) DetectByMagic ¶
func (e *VideoEngine) DetectByMagic(header []byte) bool
DetectByMagic checks file header signatures for known video container magic bytes.
func (*VideoEngine) Diff ¶
func (e *VideoEngine) Diff(ctx context.Context, oldPath string, oldReader io.Reader, newPath string, newReader io.Reader) (string, error)
Diff compares two video files by size only, streaming both readers to count bytes rather than buffering either file in memory. Video container internals are not parsed to avoid pulling in heavyweight decoding dependencies. Identical sizes short-circuit to an empty diff.
drift only invokes video Diff on explicitly diffed files, never on bulk snapshot diffs. The readers are consumed entirely because the byte count is the comparison signal.
func (*VideoEngine) Metadata ¶
func (e *VideoEngine) Metadata() *core.FileMetadata
Metadata returns the file metadata for video files. The MIME type is a generic octet-stream placeholder; per-container refinement (video/mp4, etc.) is a future enhancement tracked separately.
func (*VideoEngine) Preview ¶
func (e *VideoEngine) Preview(header []byte, size int64, reader io.Reader, maxLines int) (string, error)
Preview returns a short, human-readable summary of a video file. Format: "<FORMAT> <WxH> <SIZE>" when dimensions are available, otherwise "<FORMAT> <SIZE>". Only MP4/MOV containers expose dimensions; for other formats the size-only form is returned.
Only the header is inspected (format detection and, for MP4, a best-effort scan of the leading boxes for a tkhd) and size is taken from the caller. The content reader is never read, so previewing a 500 MB video stays in constant memory. Files larger than maxVideoPreviewSize skip dimension parsing entirely since the moov atom is unlikely to be in the header.