media

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package media provides high-level media services for multiplexing, extracting and transcoding audio and video.

Index

Constants

View Source
const (
	AV_LOG_PANIC   = LogLevel(ffmpeg.AV_LOG_PANIC)
	AV_LOG_FATAL   = LogLevel(ffmpeg.AV_LOG_FATAL)
	AV_LOG_ERROR   = LogLevel(ffmpeg.AV_LOG_ERROR)
	AV_LOG_WARNING = LogLevel(ffmpeg.AV_LOG_WARNING)
	AV_LOG_INFO    = LogLevel(ffmpeg.AV_LOG_INFO)
	AV_LOG_VERBOSE = LogLevel(ffmpeg.AV_LOG_VERBOSE)
	AV_LOG_DEBUG   = LogLevel(ffmpeg.AV_LOG_DEBUG)
	AV_LOG_TRACE   = LogLevel(ffmpeg.AV_LOG_TRACE)
)

Variables

View Source
var (
	DefaultConfig = Config{Debug: false}
)

Functions

func NewMediaError

func NewMediaError(level ffmpeg.AVLogLevel, message string) error

func ParseTrackDisc

func ParseTrackDisc(value string) (uint, uint)

func Version

func Version() string

Types

type Codec

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

func NewCodec

func NewCodec(ctx *ffmpeg.AVCodec) *Codec

func NewCodecWithParameters

func NewCodecWithParameters(ctx *ffmpeg.AVCodecParameters) *Codec

func (*Codec) Description

func (c *Codec) Description() string

func (*Codec) Flags

func (c *Codec) Flags() MediaFlag

func (*Codec) Name

func (c *Codec) Name() string

func (*Codec) Release

func (c *Codec) Release() error

func (*Codec) String

func (c *Codec) String() string

type Config

type Config struct {
	// Debug will output debug messages on error channel
	Debug bool `yaml:"debug"`
}

type Format

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

func NewInputFormat

func NewInputFormat(ctx *ffmpeg.AVInputFormat) *Format

func NewOutputFormat

func NewOutputFormat(ctx *ffmpeg.AVOutputFormat) *Format

func (*Format) Description

func (f *Format) Description() string

func (*Format) Ext

func (f *Format) Ext() string

func (*Format) Flags

func (f *Format) Flags() MediaFlag

func (*Format) MimeType

func (f *Format) MimeType() string

func (*Format) Name

func (f *Format) Name() string

func (*Format) Release

func (f *Format) Release() error

func (*Format) String

func (f *Format) String() string

type LogLevel

type LogLevel ffmpeg.AVLogLevel

type Manager

type Manager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewManagerWithConfig

func NewManagerWithConfig(cfg Config, err chan<- error) (*Manager, error)

func (*Manager) Close

func (mgr *Manager) Close() error

func (*Manager) CodecByName

func (this *Manager) CodecByName(name string) *Codec

func (*Manager) Codecs

func (this *Manager) Codecs(f ...MediaFlag) []*Codec

func (*Manager) CreateFile

func (mgr *Manager) CreateFile(path string) (*MediaOutput, error)

func (*Manager) Formats

func (mgr *Manager) Formats(f ...MediaFlag) []*Format

func (*Manager) Open

func (mgr *Manager) Open(r io.Reader, bufsize int) (*MediaInput, error)

Open a stream for input

func (*Manager) OpenFile

func (mgr *Manager) OpenFile(path string) (*MediaInput, error)

func (*Manager) OpenURL

func (mgr *Manager) OpenURL(url *url.URL) (*MediaInput, error)

func (*Manager) Release

func (mgr *Manager) Release(f Media) error

func (*Manager) ReleaseInput

func (mgr *Manager) ReleaseInput(f *MediaInput) error

func (*Manager) ReleaseOutput

func (mgr *Manager) ReleaseOutput(f *MediaOutput) error

func (*Manager) String

func (mgr *Manager) String() string

type MediaError

type MediaError struct {
	Level   LogLevel
	Message string
}

func (MediaError) Error

func (e MediaError) Error() string

type MediaInput

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

func NewMediaInput

func NewMediaInput(ctx *ffmpeg.AVFormatContext) *MediaInput

func (*MediaInput) CustomIO

func (m *MediaInput) CustomIO() bool

func (*MediaInput) Flags

func (m *MediaInput) Flags() MediaFlag

func (*MediaInput) Metadata

func (m *MediaInput) Metadata() *Metadata

func (*MediaInput) Read

func (m *MediaInput) Read(ctx context.Context, streams []int, fn DecodeIteratorFunc) error

Iterate over packets in the input stream

func (*MediaInput) Release

func (m *MediaInput) Release() error

func (*MediaInput) StreamForIndex

func (m *MediaInput) StreamForIndex(i int) *Stream

func (*MediaInput) Streams

func (m *MediaInput) Streams() []*Stream

func (*MediaInput) StreamsForFlag

func (m *MediaInput) StreamsForFlag(flag MediaFlag) []int

func (*MediaInput) String

func (m *MediaInput) String() string

func (*MediaInput) URL

func (m *MediaInput) URL() *url.URL

type MediaOutput

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

func NewMediaOutput

func NewMediaOutput(ctx *ffmpeg.AVFormatContext) *MediaOutput

func (*MediaOutput) Flags

func (m *MediaOutput) Flags() MediaFlag

func (*MediaOutput) IsFile

func (m *MediaOutput) IsFile() bool

func (*MediaOutput) Metadata

func (m *MediaOutput) Metadata() *Metadata

func (*MediaOutput) Release

func (m *MediaOutput) Release() error

func (*MediaOutput) StreamForIndex

func (m *MediaOutput) StreamForIndex(i int) *Stream

func (*MediaOutput) Streams

func (m *MediaOutput) Streams() []*Stream

func (*MediaOutput) String

func (m *MediaOutput) String() string

func (*MediaOutput) URL

func (m *MediaOutput) URL() *url.URL

type Metadata

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

func NewMetadata

func NewMetadata(dict *ffmpeg.AVDictionary) *Metadata

func (*Metadata) Keys

func (m *Metadata) Keys() []MediaKey

func (*Metadata) Release

func (m *Metadata) Release() error

func (*Metadata) String

func (m *Metadata) String() string

func (*Metadata) Value

func (m *Metadata) Value(key MediaKey) interface{}

type Stream

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

func NewStream

func NewStream(ctx *ffmpeg.AVStream, source *Stream) *Stream

func (*Stream) Artwork

func (s *Stream) Artwork() []byte

func (*Stream) Codec

func (s *Stream) Codec() *Codec

func (*Stream) Flags

func (s *Stream) Flags() MediaFlag

func (*Stream) Index

func (s *Stream) Index() int

func (*Stream) Release

func (s *Stream) Release() error

func (*Stream) String

func (s *Stream) String() string

type StreamMap

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

func NewStreamMap

func NewStreamMap() *StreamMap

func (*StreamMap) Get

func (m *StreamMap) Get(k int) *Stream

func (*StreamMap) Set

func (m *StreamMap) Set(s *Stream) error

Jump to

Keyboard shortcuts

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