media

package
v2.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: MIT Imports: 10 Imported by: 24

Documentation

Overview

Package media contains the media stream definition.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Direction added in v2.1.0

type Direction string

Direction is the direction of a media stream.

const (
	DirectionSendonly Direction = "sendonly"
	DirectionRecvonly Direction = "recvonly"
	DirectionSendrecv Direction = "sendrecv"
)

standard directions.

type Media

type Media struct {
	// Media type.
	Type Type

	// Direction of the stream.
	Direction Direction

	// Control attribute.
	Control string

	// Formats contained into the media.
	Formats []format.Format
}

Media is a media stream. It contains one or more formats.

func (Media) FindFormat

func (m Media) FindFormat(forma interface{}) bool

FindFormat finds a certain format among all the formats in the media.

func (Media) Marshal

func (m Media) Marshal() *psdp.MediaDescription

Marshal encodes the media in SDP format.

func (Media) URL

func (m Media) URL(contentBase *url.URL) (*url.URL, error)

URL returns the absolute URL of the media.

type Medias

type Medias []*Media

Medias is a list of media streams.

func (Medias) FindFormat

func (ms Medias) FindFormat(forma interface{}) *Media

FindFormat finds a certain format among all the formats in all the medias. If the format is found, it is inserted into forma, and its media is returned.

func (Medias) Marshal

func (ms Medias) Marshal(multicast bool) *sdp.SessionDescription

Marshal encodes the medias in SDP format.

func (Medias) SetControls

func (ms Medias) SetControls()

SetControls sets the control attribute of all medias in the list.

func (*Medias) Unmarshal

func (ms *Medias) Unmarshal(mds []*psdp.MediaDescription) error

Unmarshal decodes medias from the SDP format.

type Type

type Type string

Type is the type of a media stream.

const (
	TypeVideo       Type = "video"
	TypeAudio       Type = "audio"
	TypeApplication Type = "application"
)

standard media stream types.

Jump to

Keyboard shortcuts

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