preview

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrVipsNewImage = errors.New("failed init new image")
	ErrImageResize  = errors.New("failed to resize the 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")
)
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")

	ErrPullSnapshot = errors.New("failed to pull snapshot")
	ErrImageDecode  = errors.New("failed to decode image")
	ErrImageEncode  = errors.New("failed to encode image")
	ErrImageScale   = errors.New("failed to scale image")
	ErrBufferCopy   = errors.New("failed to copy buffer")
)

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

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) Pull added in v1.1.0

func (p Previewer) Pull(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
}

Jump to

Keyboard shortcuts

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