deliver

package
v0.0.0-...-6470968 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrFrameSourceClosed          = errors.New("frame source closed")
	ErrFrameDestinationClosed     = errors.New("frame destination closed")
	ErrFrameDestinationExists     = errors.New("frame destination exists")
	ErrCodecNotSupported          = errors.New("codec not supported")
	ErrFrameSourceAudioNotSupport = errors.New("audio not support")
	ErrFrameSourceVideoNotSupport = errors.New("video not support")
)

Functions

func AddDestination

func AddDestination[SRC FrameSource, DEST FrameDestination](src SRC, dest DEST) error

Types

type Attributes

type Attributes map[interface{}]interface{}

func (Attributes) Get

func (a Attributes) Get(key interface{}) interface{}

Get returns the attribute associated with key.

func (Attributes) Set

func (a Attributes) Set(key interface{}, val interface{})

Set sets the attribute associated with key to the given value.

type AudioFrameSpecificInfo

type AudioFrameSpecificInfo struct {
	NbSamples  uint32 `json:"nbSamples"`
	SampleRate uint32 `json:"sampleRate"`
	Channels   uint8  `json:"channels"`
	Voice      uint8  `json:"voice"`
	AudioLevel uint8  `json:"audioLevel"`
}

func (*AudioFrameSpecificInfo) String

func (afsi *AudioFrameSpecificInfo) String() string

type AudioMetadata

type AudioMetadata struct {
	Codec          string    `json:"codec"`
	CodecType      CodecType `json:"codecType"`
	SampleRate     uint32    `json:"sampleRate"`
	Channels       uint8     `json:"channels"`
	RtpPayloadType uint8     `json:"rtpPayloadType"`
}

type CodecType

type CodecType int
const (
	CodecTypeNone CodecType = 0 + iota
	CodecTypeI420
	CodecTypeVP8
	CodecTypeVP9
	CodecTypeH264
	CodecTypeH265
	CodecTypeAV1
	CodecTypeMSDK
	CodecTypePCM_48000_2
	CodecTypePCMU
	CodecTypePCMA
	CodecTypeOpus
	CodecTypeISAC16
	CodecTypeISAC32
	CodecTypeILBC
	CodecTypeG722_16000_1
	CodecTypeG722_16000_2
	CodecTypeAAC
	CodecTypeAAC_48000_2
	CodecTypeAC3
	CodecTypeNellymoser
)

func ConvCodecType

func ConvCodecType(str string) CodecType

func (CodecType) IsAudio

func (fc CodecType) IsAudio() bool

func (CodecType) IsData

func (fc CodecType) IsData() bool

func (CodecType) IsVideo

func (fc CodecType) IsVideo() bool

func (CodecType) String

func (fc CodecType) String() string

type Context

type Context interface {
	Context() context.Context
	ID() string
}

type DataMetadata

type DataMetadata struct {
	Codec string     `json:"codec"`
	Type  PacketType `json:"type"`
}

type DestinationInfo

type DestinationInfo struct {
	HasAudio bool
	HasVideo bool
	HasData  bool
}

type EnableClose

type EnableClose interface {
	Close()
}

type EnableMetaData

type EnableMetaData interface {
	Metadata() *Metadata
}

type FeedbackCmd

type FeedbackCmd int
const (
	FeedbackCmdUnknown FeedbackCmd = 0 + iota
	FeedbackCmdKeyFrame
	FeedbackCmdNack
	FeedbackCmdPLI
	FeedbackCmdFIR
	FeedbackCmdSLI
	FeedbackCmdRPSI
)

type FeedbackMsg

type FeedbackMsg struct {
	Type FeedbackType
	Cmd  FeedbackCmd
}

type FeedbackType

type FeedbackType int
const (
	FeedbackTypeUnknown FeedbackType = 0 + iota
	FeedbackTypeAudio
	FeedbackTypeVideo
	FeedbackTypeData
)

type FormatSettings

type FormatSettings struct {
	AudioCandidates []AudioMetadata `json:"audioCandidates"`
	VideoCandidates []VideoMetadata `json:"videoCandidates"`
	DataCandidates  []DataMetadata  `json:"dataCandidates"`
	PacketType      PacketType      `json:"packetType"`
}

type Frame

type Frame struct {
	Codec          CodecType
	PacketType     PacketType
	Payload        []byte
	RawPacket      interface{}
	Length         int
	TimeStamp      uint32
	AdditionalInfo FrameSpecificInfo
}

type FrameDestinationDeliver

type FrameDestinationDeliver interface {
	DeliverFeedback(fb FeedbackMsg) error
	OnSource(src FrameSource) error
	// contains filtered or unexported methods
}

type FrameDestinationImpl

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

func (*FrameDestinationImpl) Close

func (fd *FrameDestinationImpl) Close()

func (*FrameDestinationImpl) Context

func (fd *FrameDestinationImpl) Context() context.Context

func (*FrameDestinationImpl) DeliverFeedback

func (fd *FrameDestinationImpl) DeliverFeedback(fb FeedbackMsg) error

func (*FrameDestinationImpl) Format

func (fd *FrameDestinationImpl) Format() string

func (*FrameDestinationImpl) FormatSettings

func (fd *FrameDestinationImpl) FormatSettings() FormatSettings

func (*FrameDestinationImpl) ID

func (fd *FrameDestinationImpl) ID() string

func (*FrameDestinationImpl) Metadata

func (fd *FrameDestinationImpl) Metadata() *Metadata

func (*FrameDestinationImpl) OnFrame

func (fd *FrameDestinationImpl) OnFrame(frame Frame, attr Attributes)

func (*FrameDestinationImpl) OnMetaData

func (fd *FrameDestinationImpl) OnMetaData(metadata *Metadata)

func (*FrameDestinationImpl) OnSource

func (fd *FrameDestinationImpl) OnSource(src FrameSource) error

type FrameDestinationReceiver

type FrameDestinationReceiver interface {
	OnFrame(frame Frame, attr Attributes)
	OnMetaData(metadata *Metadata)
}

type FrameFormat

type FrameFormat interface {
	Format() string
	FormatSettings() FormatSettings
}

type FrameSourceDeliver

type FrameSourceDeliver interface {
	DeliverFrame(frame Frame, attr Attributes) error
	DeliverMetaData(metadata Metadata) error
	DestinationCount() int
	AddDestination(dest FrameDestination) error
	RemoveDestination(dest FrameDestination) error
	// contains filtered or unexported methods
}

type FrameSourceImpl

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

func (*FrameSourceImpl) AddDestination

func (fs *FrameSourceImpl) AddDestination(dest FrameDestination) error

func (*FrameSourceImpl) Close

func (fs *FrameSourceImpl) Close()

func (*FrameSourceImpl) Context

func (fs *FrameSourceImpl) Context() context.Context

func (*FrameSourceImpl) DeliverFrame

func (fs *FrameSourceImpl) DeliverFrame(frame Frame, attr Attributes) error

func (*FrameSourceImpl) DeliverMetaData

func (fs *FrameSourceImpl) DeliverMetaData(metadata Metadata) error

func (*FrameSourceImpl) DestinationCount

func (fs *FrameSourceImpl) DestinationCount() int

func (*FrameSourceImpl) Format

func (fs *FrameSourceImpl) Format() string

func (*FrameSourceImpl) FormatSettings

func (fs *FrameSourceImpl) FormatSettings() FormatSettings

func (*FrameSourceImpl) ID

func (fs *FrameSourceImpl) ID() string

func (*FrameSourceImpl) Metadata

func (fs *FrameSourceImpl) Metadata() *Metadata

func (*FrameSourceImpl) OnFeedback

func (fs *FrameSourceImpl) OnFeedback(fb FeedbackMsg)

func (*FrameSourceImpl) RemoveDestination

func (fs *FrameSourceImpl) RemoveDestination(dest FrameDestination) error

type FrameSourceReceiver

type FrameSourceReceiver interface {
	OnFeedback(fb FeedbackMsg)
}

type FrameSpecificInfo

type FrameSpecificInfo interface {
	String() string
}

type MediaFramePipeImpl

type MediaFramePipeImpl struct {
	FrameDestination
	FrameSource
	// contains filtered or unexported fields
}

func (*MediaFramePipeImpl) AddDestination

func (m *MediaFramePipeImpl) AddDestination(dest FrameDestination) error

func (*MediaFramePipeImpl) Close

func (m *MediaFramePipeImpl) Close()

func (*MediaFramePipeImpl) Context

func (m *MediaFramePipeImpl) Context() context.Context

func (*MediaFramePipeImpl) Format

func (m *MediaFramePipeImpl) Format() string

func (*MediaFramePipeImpl) FormatSettings

func (m *MediaFramePipeImpl) FormatSettings() FormatSettings

func (*MediaFramePipeImpl) ID

func (m *MediaFramePipeImpl) ID() string

func (*MediaFramePipeImpl) Metadata

func (m *MediaFramePipeImpl) Metadata() *Metadata

func (*MediaFramePipeImpl) OnFeedback

func (m *MediaFramePipeImpl) OnFeedback(fb FeedbackMsg)

func (*MediaFramePipeImpl) OnFrame

func (m *MediaFramePipeImpl) OnFrame(frame Frame, attr Attributes)

func (*MediaFramePipeImpl) OnMetaData

func (m *MediaFramePipeImpl) OnMetaData(metadata *Metadata)

type Metadata

type Metadata struct {
	Audio      *AudioMetadata `json:"audio"`
	Video      *VideoMetadata `json:"video"`
	Data       *DataMetadata  `json:"data"`
	PacketType PacketType     `json:"packetType"`
}

func (*Metadata) EqualAudioCodec

func (md *Metadata) EqualAudioCodec(md2 *Metadata) bool

func (*Metadata) EqualVideoCodec

func (md *Metadata) EqualVideoCodec(md2 *Metadata) bool

func (*Metadata) FormatName

func (md *Metadata) FormatName() string

func (*Metadata) HasAudio

func (md *Metadata) HasAudio() bool

func (*Metadata) HasData

func (md *Metadata) HasData() bool

func (*Metadata) HasVideo

func (md *Metadata) HasVideo() bool

func (*Metadata) MatchFormat

func (md *Metadata) MatchFormat(md2 *Metadata) bool

func (*Metadata) String

func (md *Metadata) String() string

func (*Metadata) ToFormatSettings

func (md *Metadata) ToFormatSettings() FormatSettings

type PacketType

type PacketType int
const (
	PacketTypeUnknown PacketType = 0 + iota
	PacketTypeRtp
	PacketTypeRaw
	PacketTypeFlv
	PacketTypeRtmp
	PacketTypeTs
)

func (PacketType) String

func (pt PacketType) String() string

type VideoFrameSpecificInfo

type VideoFrameSpecificInfo struct {
	Width      uint16 `json:"width"`
	Height     uint16 `json:"height"`
	IsKeyFrame bool   `json:"isKeyFrame"`
}

func (*VideoFrameSpecificInfo) String

func (vfsi *VideoFrameSpecificInfo) String() string

type VideoMetadata

type VideoMetadata struct {
	Codec          string    `json:"codec"`
	CodecType      CodecType `json:"codecType"`
	Width          int       `json:"width"`
	Height         int       `json:"height"`
	FPS            int       `json:"fps"`
	RtpPayloadType uint8     `json:"rtpPayloadType"`
	ClockRate      uint32    `json:"clockRate"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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