decoder

package
v0.0.0-...-d7093dc Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2020 License: MIT Imports: 6 Imported by: 2

Documentation

Overview

Package decoder is responsible for split the video or gif to frames

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder interface {
	// Decode decode a file into multi frames
	Decode(r io.Reader, progress chan<- int) (frames []image.Image, err error)
	DecodeFromFile(filename string, progress chan<- int) (frames []image.Image, err error)
}

Decoder interface define the basic operation to decode the gif or video

func NewDecoder

func NewDecoder(filename string) (decoder Decoder, supported bool)

NewDecoder is factory method to create the player base on file type

func NewGifDeCoder

func NewGifDeCoder() Decoder

NewGifDeCoder create a new gif decoder

func NewImageDecoder

func NewImageDecoder() Decoder

NewImageDecoder create a new ImageDecoder

type GifDecoder

type GifDecoder struct {
}

GifDecoder responsible for decoding the gif and implement the Decoder interface

func (*GifDecoder) Decode

func (gifDecoder *GifDecoder) Decode(reader io.Reader, progress chan<- int) (frames []image.Image, err error)

Decode for GifDeCoder decode the gif file to multi frames

func (*GifDecoder) DecodeFromFile

func (gifDecoder *GifDecoder) DecodeFromFile(gifFilename string, progress chan<- int) (frames []image.Image, err error)

DecodeFromFile decode the gif file by filename to multi frames

type ImageDecoder

type ImageDecoder struct {
}

ImageDecoder is responsible for decoding image

func (*ImageDecoder) Decode

func (decoder *ImageDecoder) Decode(reader io.Reader, progress chan<- int) (frames []image.Image, err error)

Decode for ImageDecoder decoding a image and return a frame slice that only contain one frame.

func (*ImageDecoder) DecodeFromFile

func (decoder *ImageDecoder) DecodeFromFile(filename string, progress chan<- int) (frames []image.Image, err error)

DecodeFromFile decode the file to frames by filename

Jump to

Keyboard shortcuts

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