movieset

package module
v0.0.0-...-f69d0c3 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

README

go-movieset

GoDoc

Define two interfaces: MovieExtractor which supports random access of frames from a sequences of images (a movie or similar); and FrameSource which defines a one-way iterator for a sequence of images.

It includes a set of abstractions which then sit on top off / build on these interfaces.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MultiMovVersion = "0.1"

MultiMovVersion is the semantic version string for the current MultiMov JSON structure.

Functions

This section is empty.

Types

type Chunk

type Chunk struct {
	Name        string
	Description string      `json:",omitempty"`
	Start       uint64      `json:",omitempty"`
	End         uint64      `json:",omitempty"`
	Frames      UInt64Slice `json:",omitempty"`
}

func (Chunk) HasFrames

func (c Chunk) HasFrames() bool

func (Chunk) Min

func (c Chunk) Min() uint64

type FrameSet

type FrameSet struct {
	Source    string
	Chunks    SliceOfChunks `json:",omitempty"`
	ImageName string
	NumFrames uint64 `json:",omitempty"`
	// contains filtered or unexported fields
}

func LoadFrameSet

func LoadFrameSet(path string) (*FrameSet, error)

LoadFrameSet reads a FrameSet...

func (*FrameSet) ChunkNames

func (fs *FrameSet) ChunkNames() []string

func (*FrameSet) MovFromChunk

func (fs *FrameSet) MovFromChunk(name string) (VirtualMov, error)

func (FrameSet) MovieExtractor

func (set FrameSet) MovieExtractor() (MovieExtractor, error)

type FrameSetSequential

type FrameSetSequential struct {
	*FrameSet
	Movie MovieExtractor
	// contains filtered or unexported fields
}

func MakeFrameSetSequential

func MakeFrameSetSequential(set *FrameSet) (*FrameSetSequential, error)

func (*FrameSetSequential) Advance

func (source *FrameSetSequential) Advance()

func (*FrameSetSequential) Next

func (source *FrameSetSequential) Next() (image.Image, uint64, error)

func (*FrameSetSequential) Valid

func (source *FrameSetSequential) Valid() error

type MovHash

type MovHash uint32

A MovHash is a 32-bit hash handle to a given movie

type MovRecord

type MovRecord struct {
	ShortName string        `json:",omitempty"`
	Relapath  string        `json:",omitempty"`
	NumFrames uint64        `json:",omitempty"`
	StartTime time.Time     `json:",omitempty"`
	Duration  time.Duration `json:",omitempty"`
	// contains filtered or unexported fields
}

MovRecord stores filepath and meta-information about a single Mov within a Multimov

func MovRecordFromLqt

func MovRecordFromLqt(lqt *lazyquicktime.LazyQuicktime) MovRecord

MovRecordFromLqt creates a MovRecord given a LazyQuicktime

type MovieExtractor

type MovieExtractor interface {
	NumFrames() uint64
	Duration() time.Duration
	ExtractFrame(frame uint64) (image.Image, error)
}

MovieExtractor is the abstract interface to a quicktime movie.

func OpenMovieExtractor

func OpenMovieExtractor(path string) (MovieExtractor, error)

type MovieSequential

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

Thin wrapper around a MovieExtractor which implements Sequental interface

func MakeMovieSequential

func MakeMovieSequential(ext MovieExtractor) (*MovieSequential, error)

func (*MovieSequential) Next

func (source *MovieSequential) Next() (image.Image, uint64, error)

type MultiMov

type MultiMov struct {
	Version  string
	BaseDir  string `json:",omitempty"`
	Movies   map[MovHash]MovRecord
	Sequence Sequence
}

MultiMov is the top-level container representing a MultiMov

func LoadMultiMov

func LoadMultiMov(path string) (*MultiMov, error)

LoadMultiMov reads a MultiMov from the a path to a given JSON file. Returns a pointer to a new MultiMov if successful, or nil and an error if unsuccessful

func NewMultiMov

func NewMultiMov() MultiMov

NewMultiMov instantiates a new MultiMov

func (*MultiMov) AppendMovie

func (mm *MultiMov) AppendMovie(mov MovRecord)

AppendMovie adds the given MovRecord to the end of the sequence in the MultiMov

func (MultiMov) Duration

func (mm MultiMov) Duration() time.Duration

Duration calculates the total continuous duration within a MultiMov. The sum of all movie durations, does account for time gaps

func (MultiMov) ExtractFrame

func (mm MultiMov) ExtractFrame(frame uint64) (image.Image, error)

ExtractFrame extracts the specified frame from a MultiMov

func (MultiMov) MovPath

func (mm MultiMov) MovPath(hash MovHash) string

MovPath converts a movie handle to a movie file path

func (MultiMov) NumFrames

func (mm MultiMov) NumFrames() uint64

NumFrames returns the total number of frames in a MultiMov -- the sum of the number of frames in all movies within the MultiMov

func (MultiMov) NumMovies

func (mm MultiMov) NumMovies() int

NumMovies lists the number of in the MultiMov

func (MultiMov) Offset

func (mm MultiMov) Offset(frame uint64) (MovHash, uint64, error)

Offset gives the movie handle (hash) and offset given a frame. The hash is absolute position of the 1st frame in the movie ... it's up to the user to subtract the offset from frame.

type NotAFrameSetError

type NotAFrameSetError struct{}

func (NotAFrameSetError) Error

func (f NotAFrameSetError) Error() string

type Sequence

type Sequence []SequenceElement

Sequence is a convenience type representing a slice of SequenceElements

type SequenceElement

type SequenceElement struct {
	FrameOffset uint64
	Hash        MovHash
}

A SequenceElement represents one movie within a sequence

type Sequential

type Sequential interface {
	Next() (image.Image, uint64, error)
}

A Sequential is a generic one-function interface which provides a sequence of images.

func OpenSequential

func OpenSequential(path string) (Sequential, error)

type SliceOfChunks

type SliceOfChunks []Chunk

func (SliceOfChunks) Len

func (p SliceOfChunks) Len() int

Makes SliceOfChunks sortable

func (SliceOfChunks) Less

func (p SliceOfChunks) Less(i, j int) bool

func (SliceOfChunks) Swap

func (p SliceOfChunks) Swap(i, j int)

type UInt64Slice

type UInt64Slice []uint64

func (UInt64Slice) Len

func (p UInt64Slice) Len() int

func (UInt64Slice) Less

func (p UInt64Slice) Less(i, j int) bool

func (UInt64Slice) Swap

func (p UInt64Slice) Swap(i, j int)

type VirtualMov

type VirtualMov struct {
	Offset, Length uint64
	Mov            MovieExtractor
}

func CreateVirtualMov

func CreateVirtualMov(mov MovieExtractor, offset uint64, length uint64) (VirtualMov, error)

func (VirtualMov) Duration

func (vm VirtualMov) Duration() time.Duration

func (VirtualMov) ExtractFrame

func (vm VirtualMov) ExtractFrame(frame uint64) (image.Image, error)

func (VirtualMov) NumFrames

func (vm VirtualMov) NumFrames() uint64

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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