transcode

package
v1.0.2-0...-fa1a6e9 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package transcoder implements Transcoder based on Muxer/Demuxer and AudioEncoder/AudioDecoder interface.

Index

Constants

This section is empty.

Variables

View Source
var Debug bool

Functions

This section is empty.

Types

type Demuxer

type Demuxer struct {
	av.Demuxer
	Options
	// contains filtered or unexported fields
}

Wrap transcoder and origin Demuxer into new Demuxer. Read this Demuxer will do transcoding automatically.

func (*Demuxer) Close

func (self *Demuxer) Close() (err error)

func (*Demuxer) ReadPacket

func (self *Demuxer) ReadPacket() (pkt av.Packet, err error)

func (*Demuxer) Streams

func (self *Demuxer) Streams() (streams []av.CodecData, err error)

type Muxer

type Muxer struct {
	av.Muxer // origin Muxer
	Options  // transcode options
	// contains filtered or unexported fields
}

Wrap transcoder and origin Muxer into new Muxer. Write to new Muxer will do transcoding automatically.

func (*Muxer) Close

func (self *Muxer) Close() (err error)

func (*Muxer) WriteHeader

func (self *Muxer) WriteHeader(streams []av.CodecData) (err error)

func (*Muxer) WritePacket

func (self *Muxer) WritePacket(pkt av.Packet) (err error)

type Options

type Options struct {
	// check if transcode is needed, and create the AudioDecoder and AudioEncoder.
	FindAudioDecoderEncoder func(codec av.AudioCodecData, i int) (
		need bool, dec av.AudioDecoder, enc av.AudioEncoder, err error,
	)
}

type Transcoder

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

func NewTranscoder

func NewTranscoder(streams []av.CodecData, options Options) (_self *Transcoder, err error)

func (*Transcoder) Close

func (self *Transcoder) Close() (err error)

Close transcoder, close related encoder and decoders.

func (*Transcoder) Do

func (self *Transcoder) Do(pkt av.Packet) (out []av.Packet, err error)

Do the transcode.

In audio transcoding one Packet may transcode into many Packets packet time will be adjusted automatically.

func (*Transcoder) Streams

func (self *Transcoder) Streams() (streams []av.CodecData, err error)

Get CodecDatas after transcoding.

Jump to

Keyboard shortcuts

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