avformat

package
Version: v0.0.0-...-6bf952d Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: MIT Imports: 7 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAllocationError     = errors.New("allocation error")
	ErrInvalidArgumentSize = errors.New("invalid argument size")
)

Functions

func FormatNumberedSequence

func FormatNumberedSequence(format string, num int) (string, error)

func NumberedSequenceFormat

func NumberedSequenceFormat(format string) bool

func RegisterAll

func RegisterAll()

func Version

func Version() (int, int, int)

Types

type AvoidFlags

type AvoidFlags int
const (
	AvoidFlagNegTSAuto            AvoidFlags = C.AVFMT_AVOID_NEG_TS_AUTO
	AvoidFlagNegTSMakeNonNegative AvoidFlags = C.AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE
	AvoidFlagNegTSMakeZero        AvoidFlags = C.AVFMT_AVOID_NEG_TS_MAKE_ZERO
)

type CodecTagList

type CodecTagList struct {
	CAVCodecTag **C.struct_AVCodecTag
}

func NewCodecTagListFromC

func NewCodecTagListFromC(cCodecTag unsafe.Pointer) *CodecTagList

func (*CodecTagList) IDByTag

func (ctm *CodecTagList) IDByTag(tag uint) avcodec.CodecID

func (*CodecTagList) TagByID

func (ctm *CodecTagList) TagByID(id avcodec.CodecID) uint

type Context

type Context struct {
	CAVFormatContext *C.AVFormatContext
}

func NewContextForInput

func NewContextForInput() (*Context, error)

func NewContextForOutput

func NewContextForOutput(output *Output) (*Context, error)

func NewContextFromC

func NewContextFromC(cCtx unsafe.Pointer) *Context

func (*Context) AudioCodecID

func (ctx *Context) AudioCodecID() avcodec.CodecID

func (*Context) BitRate

func (ctx *Context) BitRate() int64

func (*Context) Class

func (ctx *Context) Class() *avutil.Class

func (*Context) CloseInput

func (ctx *Context) CloseInput()

func (*Context) DataCodecID

func (ctx *Context) DataCodecID() avcodec.CodecID

func (*Context) Dump

func (ctx *Context) Dump(streamIndex int, url string, isOutput bool)

func (*Context) Duration

func (ctx *Context) Duration() int64

func (*Context) ExtraFlags

func (ctx *Context) ExtraFlags() ContextExtraFlags

func (*Context) FileName

func (ctx *Context) FileName() string

func (*Context) FindStreamInfo

func (ctx *Context) FindStreamInfo(options []*avutil.Dictionary) error

func (*Context) Flags

func (ctx *Context) Flags() ContextFlags

func (*Context) Free

func (ctx *Context) Free()

func (*Context) GuessFrameRate

func (ctx *Context) GuessFrameRate(stream *Stream, frame *avutil.Frame) *avutil.Rational

func (*Context) IOCloseCallback

func (ctx *Context) IOCloseCallback() unsafe.Pointer

func (*Context) IOContext

func (ctx *Context) IOContext() *IOContext

func (*Context) IOOpenCallback

func (ctx *Context) IOOpenCallback() unsafe.Pointer

func (*Context) Input

func (ctx *Context) Input() *Input

func (*Context) InterleavedWriteFrame

func (ctx *Context) InterleavedWriteFrame(pkt *avcodec.Packet) error

func (*Context) MaxDelay

func (ctx *Context) MaxDelay() int

func (*Context) MetaData

func (ctx *Context) MetaData() *avutil.Dictionary

func (*Context) NewStream

func (ctx *Context) NewStream() (*Stream, error)

func (*Context) NewStreamWithCodec

func (ctx *Context) NewStreamWithCodec(codec *avcodec.Codec) (*Stream, error)

func (*Context) NumberOfStreams

func (ctx *Context) NumberOfStreams() uint

func (*Context) OpenInput

func (ctx *Context) OpenInput(fileName string, input *Input, options *avutil.Dictionary) error

func (*Context) Output

func (ctx *Context) Output() *Output

func (*Context) ReadFrame

func (ctx *Context) ReadFrame(pkt *avcodec.Packet) (bool, error)

func (*Context) SeekToTimestamp

func (ctx *Context) SeekToTimestamp(streamIndex int, min, target, max int64, flags SeekFlags) error

func (*Context) SetDuration

func (ctx *Context) SetDuration(duration int64)

func (*Context) SetFileName

func (ctx *Context) SetFileName(fileName string)

func (*Context) SetFlags

func (ctx *Context) SetFlags(flags ContextFlags)

func (*Context) SetIOCloseCallback

func (ctx *Context) SetIOCloseCallback(callback unsafe.Pointer)

func (*Context) SetIOContext

func (ctx *Context) SetIOContext(ioCtx *IOContext)

func (*Context) SetIOOpenCallback

func (ctx *Context) SetIOOpenCallback(callback unsafe.Pointer)

func (*Context) SetMaxDelay

func (ctx *Context) SetMaxDelay(maxDelay int)

func (*Context) SetMetaData

func (ctx *Context) SetMetaData(metaData *avutil.Dictionary)

func (*Context) StartTime

func (ctx *Context) StartTime() int64

func (*Context) Streams

func (ctx *Context) Streams() []*Stream

func (*Context) SubtitleCodecID

func (ctx *Context) SubtitleCodecID() avcodec.CodecID

func (*Context) VideoCodecID

func (ctx *Context) VideoCodecID() avcodec.CodecID

func (*Context) WriteFrame

func (ctx *Context) WriteFrame(pkt *avcodec.Packet) error

func (*Context) WriteHeader

func (ctx *Context) WriteHeader(options *avutil.Dictionary) error

func (*Context) WriteTrailer

func (ctx *Context) WriteTrailer() error

type ContextExtraFlags

type ContextExtraFlags int
const (
	ContextExtraFlagNoHeader ContextExtraFlags = C.AVFMTCTX_NOHEADER
)

type ContextFlags

type ContextFlags int
const (
	ContextFlagGenPTS         ContextFlags = C.AVFMT_FLAG_GENPTS
	ContextFlagIgnoreIndex    ContextFlags = C.AVFMT_FLAG_IGNIDX
	ContextFlagNonBlock       ContextFlags = C.AVFMT_FLAG_NONBLOCK
	ContextFlagIgnoreDTS      ContextFlags = C.AVFMT_FLAG_IGNDTS
	ContextFlagNoFillin       ContextFlags = C.AVFMT_FLAG_NOFILLIN
	ContextFlagNoParse        ContextFlags = C.AVFMT_FLAG_NOPARSE
	ContextFlagNoBuffer       ContextFlags = C.AVFMT_FLAG_NOBUFFER
	ContextFlagCustomIO       ContextFlags = C.AVFMT_FLAG_CUSTOM_IO
	ContextFlagDiscardCorrupt ContextFlags = C.AVFMT_FLAG_DISCARD_CORRUPT
	ContextFlagFlushPackets   ContextFlags = C.AVFMT_FLAG_FLUSH_PACKETS
	ContextFlagBitExact       ContextFlags = C.AVFMT_FLAG_BITEXACT
	ContextFlagMP4ALATM       ContextFlags = C.AVFMT_FLAG_MP4A_LATM
	ContextFlagSortDTS        ContextFlags = C.AVFMT_FLAG_SORT_DTS
	ContextFlagPrivOpt        ContextFlags = C.AVFMT_FLAG_PRIV_OPT
	ContextFlagKeepSideData   ContextFlags = C.AVFMT_FLAG_KEEP_SIDE_DATA
	ContextFlagFastSeek       ContextFlags = C.GO_AVFMT_FLAG_FAST_SEEK
)

type Disposition

type Disposition int
const (
	DispositionDefault         Disposition = C.AV_DISPOSITION_DEFAULT
	DispositionDub             Disposition = C.AV_DISPOSITION_DUB
	DispositionOriginal        Disposition = C.AV_DISPOSITION_ORIGINAL
	DispositionComment         Disposition = C.AV_DISPOSITION_COMMENT
	DispositionLyrics          Disposition = C.AV_DISPOSITION_LYRICS
	DispositionKaraoke         Disposition = C.AV_DISPOSITION_KARAOKE
	DispositionForced          Disposition = C.AV_DISPOSITION_FORCED
	DispositionHearingImpaired Disposition = C.AV_DISPOSITION_HEARING_IMPAIRED
	DispositionVisualImpaired  Disposition = C.AV_DISPOSITION_VISUAL_IMPAIRED
	DispositionCleanEffects    Disposition = C.AV_DISPOSITION_CLEAN_EFFECTS
	DispositionAttachedPic     Disposition = C.AV_DISPOSITION_ATTACHED_PIC
	DispositionCaptions        Disposition = C.AV_DISPOSITION_CAPTIONS
	DispositionDescriptions    Disposition = C.AV_DISPOSITION_DESCRIPTIONS
	DispositionMetadata        Disposition = C.AV_DISPOSITION_METADATA
)

type EventFlags

type EventFlags int
const (
	EventFlagMetadataUpdated EventFlags = C.AVFMT_EVENT_FLAG_METADATA_UPDATED
)

type Flags

type Flags int
const (
	FlagNoFile       Flags = C.AVFMT_NOFILE
	FlagNeedNumber   Flags = C.AVFMT_NEEDNUMBER
	FlagShowIDs      Flags = C.AVFMT_SHOW_IDS
	FlagRawPicture   Flags = C.AVFMT_RAWPICTURE
	FlagGlobalHeader Flags = C.AVFMT_GLOBALHEADER
	FlagNoTimestamps Flags = C.AVFMT_NOTIMESTAMPS
	FlagGenericIndex Flags = C.AVFMT_GENERIC_INDEX
	FlagTSDiscont    Flags = C.AVFMT_TS_DISCONT
	FlagVariableFPS  Flags = C.AVFMT_VARIABLE_FPS
	FlagNoDimensions Flags = C.AVFMT_NODIMENSIONS
	FlagNoStreams    Flags = C.AVFMT_NOSTREAMS
	FlagNoBinSearch  Flags = C.AVFMT_NOBINSEARCH
	FlagNoGenSearch  Flags = C.AVFMT_NOGENSEARCH
	FlagNoByteSeek   Flags = C.AVFMT_NO_BYTE_SEEK
	FlagAllowFlush   Flags = C.AVFMT_ALLOW_FLUSH
	FlagTSNonStrict  Flags = C.AVFMT_TS_NONSTRICT
	FlagTSNegative   Flags = C.AVFMT_TS_NEGATIVE
	FlagSeekToPTS    Flags = C.AVFMT_SEEK_TO_PTS
)

type IOContext

type IOContext struct {
	CAVIOContext *C.AVIOContext
}

func NewIOContextFromC

func NewIOContextFromC(cCtx unsafe.Pointer) *IOContext

func OpenIOContext

func OpenIOContext(url string, flags IOFlags, cb *IOInterruptCallback, options *avutil.Dictionary) (*IOContext, error)

func (*IOContext) Close

func (ctx *IOContext) Close() error

func (*IOContext) Size

func (ctx *IOContext) Size() int64

type IOFlags

type IOFlags int
const (
	IOFlagRead      IOFlags = C.AVIO_FLAG_READ
	IOFlagWrite     IOFlags = C.AVIO_FLAG_WRITE
	IOFlagReadWrite IOFlags = C.AVIO_FLAG_READ_WRITE
	IOFlagNonblock  IOFlags = C.AVIO_FLAG_NONBLOCK
	IOFlagDirect    IOFlags = C.AVIO_FLAG_DIRECT
)

type IOInterruptCallback

type IOInterruptCallback struct {
	CAVIOInterruptCB *C.AVIOInterruptCB
}

func NewIOInterruptCallbackFromC

func NewIOInterruptCallbackFromC(cb unsafe.Pointer) *IOInterruptCallback

type Input

type Input struct {
	CAVInputFormat *C.AVInputFormat
}

func FindInputByShortName

func FindInputByShortName(shortName string) *Input

func NewInputFromC

func NewInputFromC(cInput unsafe.Pointer) *Input

func ProbeInput

func ProbeInput(pd *ProbeData, isOpened bool) *Input

func ProbeInputWithScore

func ProbeInputWithScore(pd *ProbeData, isOpened bool, scoreMax int) (*Input, int)

func (*Input) CodecTags

func (f *Input) CodecTags() *CodecTagList

func (*Input) Extensions

func (f *Input) Extensions() []string

func (*Input) Flags

func (f *Input) Flags() Flags

func (*Input) LongName

func (f *Input) LongName() string

func (*Input) LongNameOk

func (f *Input) LongNameOk() (string, bool)

func (*Input) MimeTypes

func (f *Input) MimeTypes() []string

func (*Input) Names

func (f *Input) Names() []string

func (*Input) PrivateClass

func (f *Input) PrivateClass() *avutil.Class

type Output

type Output struct {
	CAVOutputFormat *C.AVOutputFormat
}

func GuessOutputFromFileName

func GuessOutputFromFileName(fileName string) *Output

func GuessOutputFromMimeType

func GuessOutputFromMimeType(mimeType string) *Output

func GuessOutputFromShortName

func GuessOutputFromShortName(shortName string) *Output

func NewOutputFromC

func NewOutputFromC(cOutput unsafe.Pointer) *Output

func (*Output) AudioCodecID

func (f *Output) AudioCodecID() avcodec.CodecID

func (*Output) CodecTags

func (f *Output) CodecTags() *CodecTagList

func (*Output) DataCodecID

func (f *Output) DataCodecID() avcodec.CodecID

func (*Output) Extensions

func (f *Output) Extensions() []string

func (*Output) Flags

func (f *Output) Flags() Flags

func (*Output) GuessCodecID

func (f *Output) GuessCodecID(filename string, mediaType avutil.MediaType) avcodec.CodecID

func (*Output) LongName

func (f *Output) LongName() string

func (*Output) LongNameOk

func (f *Output) LongNameOk() (string, bool)

func (*Output) MimeType

func (f *Output) MimeType() string

func (*Output) MimeTypeOk

func (f *Output) MimeTypeOk() (string, bool)

func (*Output) Name

func (f *Output) Name() string

func (*Output) NameOk

func (f *Output) NameOk() (string, bool)

func (*Output) PrivateClass

func (f *Output) PrivateClass() *avutil.Class

func (*Output) QueryCodec

func (f *Output) QueryCodec(codecID avcodec.CodecID) (bool, bool)

func (*Output) QueryCodecWithCompliance

func (f *Output) QueryCodecWithCompliance(codecID avcodec.CodecID, compliance avcodec.Compliance) (bool, bool)

func (*Output) SubtitleCodecID

func (f *Output) SubtitleCodecID() avcodec.CodecID

func (*Output) VideoCodecID

func (f *Output) VideoCodecID() avcodec.CodecID

type ProbeData

type ProbeData struct {
	CAVProbeData C.AVProbeData
}

func NewProbeData

func NewProbeData() *ProbeData

func (*ProbeData) Free

func (pd *ProbeData) Free()

func (*ProbeData) SetBuffer

func (pd *ProbeData) SetBuffer(buffer []byte) error

func (*ProbeData) SetFileName

func (pd *ProbeData) SetFileName(fileName *string) error

func (*ProbeData) SetMimeType

func (pd *ProbeData) SetMimeType(mimeType *string) error

type SeekFlags

type SeekFlags int
const (
	SeekFlagNone     SeekFlags = 0
	SeekFlagBackward SeekFlags = C.AVSEEK_FLAG_BACKWARD
	SeekFlagByte     SeekFlags = C.AVSEEK_FLAG_BYTE
	SeekFlagAny      SeekFlags = C.AVSEEK_FLAG_ANY
	SeekFlagFrame    SeekFlags = C.AVSEEK_FLAG_FRAME
)

type Stream

type Stream struct {
	CAVStream *C.AVStream
}

func NewStreamFromC

func NewStreamFromC(cStream unsafe.Pointer) *Stream

func (*Stream) AverageFrameRate

func (s *Stream) AverageFrameRate() *avutil.Rational

func (*Stream) CodecContext

func (s *Stream) CodecContext() *avcodec.Context

func (*Stream) Disposition

func (s *Stream) Disposition() Disposition

func (*Stream) Duration

func (s *Stream) Duration() time.Duration

func (*Stream) EndPTS

func (s *Stream) EndPTS() int64

func (*Stream) FirstDTS

func (s *Stream) FirstDTS() int64

func (*Stream) ID

func (s *Stream) ID() int

func (*Stream) Index

func (s *Stream) Index() int

func (*Stream) MetaData

func (s *Stream) MetaData() *avutil.Dictionary

func (*Stream) NumberOfFrames

func (s *Stream) NumberOfFrames() int64

func (*Stream) RawDuration

func (s *Stream) RawDuration() int64

func (*Stream) RealFrameRate

func (s *Stream) RealFrameRate() *avutil.Rational

func (*Stream) SampleAspectRatio

func (s *Stream) SampleAspectRatio() *avutil.Rational

func (*Stream) SetAverageFrameRate

func (s *Stream) SetAverageFrameRate(frameRate *avutil.Rational)

func (*Stream) SetDisposition

func (s *Stream) SetDisposition(disposition Disposition)

func (*Stream) SetFirstDTS

func (s *Stream) SetFirstDTS(firstDTS int64)

func (*Stream) SetMetaData

func (s *Stream) SetMetaData(metaData *avutil.Dictionary)

func (*Stream) SetRealFrameRate

func (s *Stream) SetRealFrameRate(frameRate *avutil.Rational)

func (*Stream) SetSampleAspectRatio

func (s *Stream) SetSampleAspectRatio(aspectRatio *avutil.Rational)

func (*Stream) SetTimeBase

func (s *Stream) SetTimeBase(timeBase *avutil.Rational)

func (*Stream) StartTime

func (s *Stream) StartTime() int64

func (*Stream) TimeBase

func (s *Stream) TimeBase() *avutil.Rational

Source Files

Jump to

Keyboard shortcuts

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