preview

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BigVideosQueueSize                 = 4
	BigVideoSizeB                      = 500 * 1024 * 1024
	BigVideoThrottleMaxOccupiedPercent = 0.9
	BigVideoThrottleMaxWaiting         = time.Duration(5) * time.Second
)
View Source
const (
	VideoPreviewCollageItems = 5
)

Variables

View Source
var (
	ErrCommandNotFound          = errors.New("not found")
	ErrIncorrectFFmpegVersion   = errors.New("can't be parsed")
	ErrOutdatedFFmpegVersion    = errors.New("is outdated")
	ErrMetaInfoUnmarshal        = errors.New("failed to decode file's meta information")
	ErrMetaInfoFramesCountParse = errors.New("failed to parse frames count from meta information")
	ErrMetaInfoDurationParse    = errors.New("failed to parse duration from meta information")
	ErrVideoStreamNotFound      = errors.New("video stream not found")
	ErrParseFrameRate           = errors.New("failed to parse frame rate")
	ErrNoSupportedCodecs        = errors.New("there are no supported codecs")
)
View Source
var (
	ErrVipsLoadImage = errors.New("failed load image")
	ErrImageExport   = errors.New("failed export the image")
)
View Source
var (
	ErrVideoPreview               = errors.New("failed create preview for video")
	ErrImagePreview               = errors.New("failed create preview for image")
	ErrFFmpegCudaDecodersNotFound = errors.New("cuda decoders not found in ffmpeg")
	ErrFFmpegCudaProbe            = errors.New("failed probe cuda decoders in ffmpeg")
)
View Source
var (
	ErrPullSnapshot = errors.New("failed to pull snapshot")
)

Functions

This section is empty.

Types

type Data

type Data interface {
	Data() []byte
	Duration() time.Duration
	Resolution() (int, int)
}

type Option added in v1.1.0

type Option func(*Previewer)

func WithExcludedFiles added in v1.1.0

func WithExcludedFiles(files map[string]struct{}) Option

files = map[FilePath]struct{}.

func WithImage added in v1.1.0

func WithImage(param bool) Option

func WithMaxFileSize added in v1.1.0

func WithMaxFileSize(param int64) Option

func WithMaxImages added in v1.1.0

func WithMaxImages(param int64) Option

func WithMaxVideos added in v1.1.0

func WithMaxVideos(param int64) Option

func WithTimeout added in v1.1.0

func WithTimeout(param time.Duration) Option

func WithVideo added in v1.1.0

func WithVideo(param bool) Option

func WithVideoAccel added in v1.6.0

func WithVideoAccel(param VideoProcessingAccelType) Option

type Previewer added in v1.1.0

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

func NewPreviewer added in v1.1.0

func NewPreviewer(opts ...Option) (*Previewer, error)

func (Previewer) Close added in v1.6.0

func (p Previewer) Close()

func (Previewer) Pull added in v1.1.0

func (p Previewer) Pull(ctx context.Context, src Source) (Data, error)

type Source added in v1.1.0

type Source interface {
	IsImage() bool
	IsVideo() bool
	IsAnimatedImage() bool
	Path() string
	Size() int64
}

type VideoParams added in v1.1.0

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

type VideoProcessingAccelType added in v1.6.0

type VideoProcessingAccelType string
const (
	Auto     VideoProcessingAccelType = "auto"
	Software VideoProcessingAccelType = "software"
	Hardware VideoProcessingAccelType = "hardware"
)

Jump to

Keyboard shortcuts

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