gotheora

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

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 10 Imported by: 0

README

GoTheora

These are golang bindings and a wrapper around Theora library. Theora is a free and open video compression format from the Xiph.org Foundation. Like all Xiph multimedia technologies, it can be used to distribute movies and videos online and on discs without royalties and royalties or vendor binding associated with other formats.

Usage

Use go get -u to download and install the prebuilt package.

go get -u github.com/ilya2ik/googg
go get -u github.com/ilya2ik/gotheora
Example for usage

You can find an example of using the encoder here

Documents

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ETheoraDecBadPacketException = errTheoraDecBadPacketException{}
View Source
var ETheoraDecException = errTheoraDecException{}
View Source
var ETheoraEncCompletedException = errTheoraEncCompletedException{}
View Source
var ETheoraEncDifferException = errTheoraEncDifferException{}
View Source
var ETheoraEncException = errTheoraEncException{}
View Source
var ETheoraEncNotPackReadyException = errTheoraEncPackNotReadyException{}
View Source
var ETheoraEncNotReadyException = errTheoraEncNotReadyException{}
View Source
var ETheoraException = errTheoraException{0}
View Source
var ETheoraOutOfMemory = errTheoraOutOfMemory{nil}

Functions

func Version

func Version() string

func VersionNumber

func VersionNumber() uint32

Types

type Colorspace

type Colorspace int
const (
	Unspec Colorspace = iota
	ITURec470M
	ITURec470BG
	NSpaces
)

type ITheoraComment

type ITheoraComment interface {
	Ref() *C.theora_comment

	Init()
	Done()

	GetVendor() string
	SetVendor(s string)

	Add(comment string)
	AddTag(tag, value string)
	TagsCount() int
	GetTag(index int) string
	Query(tag string, index int) string
	QueryCount(tag string) int
}

func NewTheoraComment

func NewTheoraComment() (ITheoraComment, error)

type ITheoraDecoder

type ITheoraDecoder interface {
	Header(cc ITheoraComment, op OGG.IOGGPacket) error
	PacketIn(op OGG.IOGGPacket) error
	YUVout(yuv ITheoraYUVbuffer) error
}

func NewTheoraDecoder

func NewTheoraDecoder(inf ITheoraInfo) (ITheoraDecoder, error)

type ITheoraEncoder

type ITheoraEncoder interface {
	Header(op OGG.IOGGPacket) error
	PacketOut(last_p bool, op OGG.IOGGPacket) error
	DoPacketOut(last_p bool) (OGG.IOGGPacket, error)
	YUVin(yuv ITheoraYUVbuffer) error
	Comment(tc ITheoraComment, op OGG.IOGGPacket) error
	Tables(op OGG.IOGGPacket) error

	Control(req int, buf []byte) int

	SaveDefHeadersToStream() error
	SaveCustomHeadersToStream(tc ITheoraComment) error
	SaveYUVBufferToStream(buf ITheoraYUVbuffer, is_last bool) error
	Flush() error
	Close() error
}

func NewTheoraEncoder

func NewTheoraEncoder(inf ITheoraInfo, str io.Writer) (ITheoraEncoder, error)

type ITheoraInfo

type ITheoraInfo interface {
	Ref() *C.theora_info

	Init()
	Done()

	GetAspectDenominator() int
	GetAspectNumerator() int
	GetCodecSetup() unsafe.Pointer
	GetColorspace() Colorspace
	GetDropFrames() bool
	GetFPSDenominator() int
	GetFPSNumerator() int
	GetFrameHeight() int
	GetFrameWidth() int
	GetHeight() int
	GetKeyframeAuto() bool
	GetKeyframeAutoThreshold() int
	GetKeyframeDataTargetBitrate() int
	GetKeyframeFrequency() int
	GetKeyframeFrequencyForce() int
	GetKeyframeMindistance() int
	GetNoiseSensitivity() int
	GetOffsetX() int
	GetOffsetY() int
	GetPixelFormat() image.YCbCrSubsampleRatio
	GetQuality() int
	GetQuick() bool
	GetSharpness() int
	GetTargetBitrate() int
	GetWidth() int

	GetVersionMajor() byte
	GetVersionMinor() byte
	GetVersionSubminor() byte
	SetAspectDenominator(AValue int)
	SetAspectNumerator(AValue int)
	SetCodecSetup(AValue unsafe.Pointer)
	SetColorspace(AValue Colorspace)
	SetDropFrames(AValue bool)
	SetFPSDenominator(AValue int)
	SetFPSNumerator(AValue int)
	SetFrameHeight(AValue int)
	SetFrameWidth(AValue int)
	SetHeight(AValue int)
	SetKeyframeAuto(AValue bool)
	SetKeyframeAutoThreshold(AValue int)
	SetKeyframeDataTargetBitrate(AValue int)
	SetKeyframeFrequency(AValue int)
	SetKeyframeFrequencyForce(AValue int)
	SetKeyframeMindistance(AValue int)
	SetNoiseSensitivity(AValue int)
	SetOffsetX(AValue int)
	SetOffsetY(AValue int)
	SetPixelFormat(AValue image.YCbCrSubsampleRatio)
	SetQuality(AValue int)
	SetQuick(AValue bool)
	SetSharpness(AValue int)
	SetTargetBitrate(AValue int)
	SetWidth(AValue int)

	GranuleShift() int
}

func NewTheoraInfo

func NewTheoraInfo() (ITheoraInfo, error)

type ITheoraState

type ITheoraState interface {
	Ref() *C.theora_state

	Init(inf ITheoraInfo)
	Done()

	Info() ITheoraInfo
	GetGranulePos() int64
	SetGranulePos(value int64)

	GranuleFrame(granulepos int64) int64
	GranuleTime(granulepos int64) float64
}

func NewTheoraState

func NewTheoraState() (ITheoraState, error)

type ITheoraYUVbuffer

type ITheoraYUVbuffer interface {
	Ref() *C.yuv_buffer

	Done()

	GetYWidth() int
	SetYWidth(value int)
	GetYHeight() int
	SetYHeight(value int)
	GetYStride() int
	SetYStride(value int)

	GetUVWidth() int
	SetUVWidth(value int)
	GetUVHeight() int
	SetUVHeight(value int)
	GetUVStride() int
	SetUVStride(value int)

	GetYData() []byte
	SetYData(value []byte)
	GetUData() []byte
	SetUData(value []byte)
	GetVData() []byte
	SetVData(value []byte)

	GetOwnData() bool
	SetOwnData(value bool)

	ConvertFromRasterImage(chroma_format image.YCbCrSubsampleRatio, aData image.Image) bool
}

func NewTheoraYUVbuffer

func NewTheoraYUVbuffer() (ITheoraYUVbuffer, error)

type TheoraComment

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

func (*TheoraComment) Add

func (v *TheoraComment) Add(comment string)

func (*TheoraComment) AddTag

func (v *TheoraComment) AddTag(tag string, value string)

func (*TheoraComment) Done

func (v *TheoraComment) Done()

func (*TheoraComment) GetTag

func (v *TheoraComment) GetTag(index int) string

func (*TheoraComment) GetVendor

func (v *TheoraComment) GetVendor() string

func (*TheoraComment) Init

func (v *TheoraComment) Init()

func (*TheoraComment) Query

func (v *TheoraComment) Query(tag string, index int) string

func (*TheoraComment) QueryCount

func (v *TheoraComment) QueryCount(tag string) int

func (*TheoraComment) Ref

func (v *TheoraComment) Ref() *C.theora_comment

func (*TheoraComment) SetVendor

func (v *TheoraComment) SetVendor(s string)

func (*TheoraComment) TagsCount

func (v *TheoraComment) TagsCount() int

type TheoraDecoder

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

func (*TheoraDecoder) Header

func (v *TheoraDecoder) Header(cc ITheoraComment, op OGG.IOGGPacket) error

func (*TheoraDecoder) PacketIn

func (v *TheoraDecoder) PacketIn(op OGG.IOGGPacket) error

func (*TheoraDecoder) State

func (v *TheoraDecoder) State() ITheoraState

func (*TheoraDecoder) YUVout

func (v *TheoraDecoder) YUVout(yuv ITheoraYUVbuffer) error

type TheoraEncoder

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

func (*TheoraEncoder) Close

func (v *TheoraEncoder) Close() error

func (*TheoraEncoder) Comment

func (v *TheoraEncoder) Comment(tc ITheoraComment, op OGG.IOGGPacket) error

func (*TheoraEncoder) Control

func (v *TheoraEncoder) Control(req int, buf []byte) int

func (*TheoraEncoder) DoPacketOut

func (v *TheoraEncoder) DoPacketOut(last_p bool) (OGG.IOGGPacket, error)

func (*TheoraEncoder) Flush

func (v *TheoraEncoder) Flush() error

func (*TheoraEncoder) Header

func (v *TheoraEncoder) Header(op OGG.IOGGPacket) error

func (*TheoraEncoder) PacketOut

func (v *TheoraEncoder) PacketOut(last_p bool, op OGG.IOGGPacket) error

func (*TheoraEncoder) SaveCustomHeadersToStream

func (v *TheoraEncoder) SaveCustomHeadersToStream(tc ITheoraComment) error

func (*TheoraEncoder) SaveDefHeadersToStream

func (v *TheoraEncoder) SaveDefHeadersToStream() error

func (*TheoraEncoder) SaveYUVBufferToStream

func (v *TheoraEncoder) SaveYUVBufferToStream(buf ITheoraYUVbuffer, is_last bool) error

func (*TheoraEncoder) State

func (v *TheoraEncoder) State() ITheoraState

func (*TheoraEncoder) Stream

func (v *TheoraEncoder) Stream() OGG.IOGGStreamState

func (*TheoraEncoder) Tables

func (v *TheoraEncoder) Tables(op OGG.IOGGPacket) error

func (*TheoraEncoder) YUVin

func (v *TheoraEncoder) YUVin(yuv ITheoraYUVbuffer) error

type TheoraInfo

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

func (*TheoraInfo) Done

func (v *TheoraInfo) Done()

func (*TheoraInfo) GetAspectDenominator

func (v *TheoraInfo) GetAspectDenominator() int

func (*TheoraInfo) GetAspectNumerator

func (v *TheoraInfo) GetAspectNumerator() int

func (*TheoraInfo) GetCodecSetup

func (v *TheoraInfo) GetCodecSetup() unsafe.Pointer

func (*TheoraInfo) GetColorspace

func (v *TheoraInfo) GetColorspace() Colorspace

func (*TheoraInfo) GetDropFrames

func (v *TheoraInfo) GetDropFrames() bool

func (*TheoraInfo) GetFPSDenominator

func (v *TheoraInfo) GetFPSDenominator() int

func (*TheoraInfo) GetFPSNumerator

func (v *TheoraInfo) GetFPSNumerator() int

func (*TheoraInfo) GetFrameHeight

func (v *TheoraInfo) GetFrameHeight() int

func (*TheoraInfo) GetFrameWidth

func (v *TheoraInfo) GetFrameWidth() int

func (*TheoraInfo) GetHeight

func (v *TheoraInfo) GetHeight() int

func (*TheoraInfo) GetKeyframeAuto

func (v *TheoraInfo) GetKeyframeAuto() bool

func (*TheoraInfo) GetKeyframeAutoThreshold

func (v *TheoraInfo) GetKeyframeAutoThreshold() int

func (*TheoraInfo) GetKeyframeDataTargetBitrate

func (v *TheoraInfo) GetKeyframeDataTargetBitrate() int

func (*TheoraInfo) GetKeyframeFrequency

func (v *TheoraInfo) GetKeyframeFrequency() int

func (*TheoraInfo) GetKeyframeFrequencyForce

func (v *TheoraInfo) GetKeyframeFrequencyForce() int

func (*TheoraInfo) GetKeyframeMindistance

func (v *TheoraInfo) GetKeyframeMindistance() int

func (*TheoraInfo) GetNoiseSensitivity

func (v *TheoraInfo) GetNoiseSensitivity() int

func (*TheoraInfo) GetOffsetX

func (v *TheoraInfo) GetOffsetX() int

func (*TheoraInfo) GetOffsetY

func (v *TheoraInfo) GetOffsetY() int

func (*TheoraInfo) GetPixelFormat

func (v *TheoraInfo) GetPixelFormat() image.YCbCrSubsampleRatio

func (*TheoraInfo) GetQuality

func (v *TheoraInfo) GetQuality() int

func (*TheoraInfo) GetQuick

func (v *TheoraInfo) GetQuick() bool

func (*TheoraInfo) GetSharpness

func (v *TheoraInfo) GetSharpness() int

func (*TheoraInfo) GetTargetBitrate

func (v *TheoraInfo) GetTargetBitrate() int

func (*TheoraInfo) GetVersionMajor

func (v *TheoraInfo) GetVersionMajor() byte

func (*TheoraInfo) GetVersionMinor

func (v *TheoraInfo) GetVersionMinor() byte

func (*TheoraInfo) GetVersionSubminor

func (v *TheoraInfo) GetVersionSubminor() byte

func (*TheoraInfo) GetWidth

func (v *TheoraInfo) GetWidth() int

func (*TheoraInfo) GranuleShift

func (v *TheoraInfo) GranuleShift() int

func (*TheoraInfo) Init

func (v *TheoraInfo) Init()

func (*TheoraInfo) Ref

func (v *TheoraInfo) Ref() *C.theora_info

func (*TheoraInfo) SetAspectDenominator

func (v *TheoraInfo) SetAspectDenominator(AValue int)

func (*TheoraInfo) SetAspectNumerator

func (v *TheoraInfo) SetAspectNumerator(AValue int)

func (*TheoraInfo) SetCodecSetup

func (v *TheoraInfo) SetCodecSetup(AValue unsafe.Pointer)

func (*TheoraInfo) SetColorspace

func (v *TheoraInfo) SetColorspace(AValue Colorspace)

func (*TheoraInfo) SetDropFrames

func (v *TheoraInfo) SetDropFrames(AValue bool)

func (*TheoraInfo) SetFPSDenominator

func (v *TheoraInfo) SetFPSDenominator(AValue int)

func (*TheoraInfo) SetFPSNumerator

func (v *TheoraInfo) SetFPSNumerator(AValue int)

func (*TheoraInfo) SetFrameHeight

func (v *TheoraInfo) SetFrameHeight(AValue int)

func (*TheoraInfo) SetFrameWidth

func (v *TheoraInfo) SetFrameWidth(AValue int)

func (*TheoraInfo) SetHeight

func (v *TheoraInfo) SetHeight(AValue int)

func (*TheoraInfo) SetKeyframeAuto

func (v *TheoraInfo) SetKeyframeAuto(AValue bool)

func (*TheoraInfo) SetKeyframeAutoThreshold

func (v *TheoraInfo) SetKeyframeAutoThreshold(AValue int)

func (*TheoraInfo) SetKeyframeDataTargetBitrate

func (v *TheoraInfo) SetKeyframeDataTargetBitrate(AValue int)

func (*TheoraInfo) SetKeyframeFrequency

func (v *TheoraInfo) SetKeyframeFrequency(AValue int)

func (*TheoraInfo) SetKeyframeFrequencyForce

func (v *TheoraInfo) SetKeyframeFrequencyForce(AValue int)

func (*TheoraInfo) SetKeyframeMindistance

func (v *TheoraInfo) SetKeyframeMindistance(AValue int)

func (*TheoraInfo) SetNoiseSensitivity

func (v *TheoraInfo) SetNoiseSensitivity(AValue int)

func (*TheoraInfo) SetOffsetX

func (v *TheoraInfo) SetOffsetX(AValue int)

func (*TheoraInfo) SetOffsetY

func (v *TheoraInfo) SetOffsetY(AValue int)

func (*TheoraInfo) SetPixelFormat

func (v *TheoraInfo) SetPixelFormat(AValue image.YCbCrSubsampleRatio)

func (*TheoraInfo) SetQuality

func (v *TheoraInfo) SetQuality(AValue int)

func (*TheoraInfo) SetQuick

func (v *TheoraInfo) SetQuick(AValue bool)

func (*TheoraInfo) SetSharpness

func (v *TheoraInfo) SetSharpness(AValue int)

func (*TheoraInfo) SetTargetBitrate

func (v *TheoraInfo) SetTargetBitrate(AValue int)

func (*TheoraInfo) SetWidth

func (v *TheoraInfo) SetWidth(AValue int)

type TheoraState

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

func (*TheoraState) Done

func (v *TheoraState) Done()

func (*TheoraState) GetGranulePos

func (v *TheoraState) GetGranulePos() int64

func (*TheoraState) GranuleFrame

func (v *TheoraState) GranuleFrame(granulepos int64) int64

func (*TheoraState) GranuleTime

func (v *TheoraState) GranuleTime(granulepos int64) float64

func (*TheoraState) Info

func (v *TheoraState) Info() ITheoraInfo

func (*TheoraState) Init

func (v *TheoraState) Init(inf ITheoraInfo)

func (*TheoraState) Ref

func (v *TheoraState) Ref() *C.theora_state

func (*TheoraState) SetGranulePos

func (v *TheoraState) SetGranulePos(value int64)

type TheoraYUVbuffer

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

func (*TheoraYUVbuffer) ConvertFromRasterImage

func (v *TheoraYUVbuffer) ConvertFromRasterImage(chroma_format image.YCbCrSubsampleRatio, aData image.Image) bool

func (*TheoraYUVbuffer) Done

func (v *TheoraYUVbuffer) Done()

func (*TheoraYUVbuffer) GetOwnData

func (v *TheoraYUVbuffer) GetOwnData() bool

func (*TheoraYUVbuffer) GetUData

func (v *TheoraYUVbuffer) GetUData() []byte

func (*TheoraYUVbuffer) GetUVHeight

func (v *TheoraYUVbuffer) GetUVHeight() int

func (*TheoraYUVbuffer) GetUVStride

func (v *TheoraYUVbuffer) GetUVStride() int

func (*TheoraYUVbuffer) GetUVWidth

func (v *TheoraYUVbuffer) GetUVWidth() int

func (*TheoraYUVbuffer) GetVData

func (v *TheoraYUVbuffer) GetVData() []byte

func (*TheoraYUVbuffer) GetYData

func (v *TheoraYUVbuffer) GetYData() []byte

func (*TheoraYUVbuffer) GetYHeight

func (v *TheoraYUVbuffer) GetYHeight() int

func (*TheoraYUVbuffer) GetYStride

func (v *TheoraYUVbuffer) GetYStride() int

func (*TheoraYUVbuffer) GetYWidth

func (v *TheoraYUVbuffer) GetYWidth() int

func (*TheoraYUVbuffer) Ref

func (v *TheoraYUVbuffer) Ref() *C.yuv_buffer

func (*TheoraYUVbuffer) SetOwnData

func (v *TheoraYUVbuffer) SetOwnData(value bool)

func (*TheoraYUVbuffer) SetUData

func (v *TheoraYUVbuffer) SetUData(value []byte)

func (*TheoraYUVbuffer) SetUVHeight

func (v *TheoraYUVbuffer) SetUVHeight(value int)

func (*TheoraYUVbuffer) SetUVStride

func (v *TheoraYUVbuffer) SetUVStride(value int)

func (*TheoraYUVbuffer) SetUVWidth

func (v *TheoraYUVbuffer) SetUVWidth(value int)

func (*TheoraYUVbuffer) SetVData

func (v *TheoraYUVbuffer) SetVData(value []byte)

func (*TheoraYUVbuffer) SetYData

func (v *TheoraYUVbuffer) SetYData(value []byte)

func (*TheoraYUVbuffer) SetYHeight

func (v *TheoraYUVbuffer) SetYHeight(value int)

func (*TheoraYUVbuffer) SetYStride

func (v *TheoraYUVbuffer) SetYStride(value int)

func (*TheoraYUVbuffer) SetYWidth

func (v *TheoraYUVbuffer) SetYWidth(value int)

Jump to

Keyboard shortcuts

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