Files
rtsp-simple-server/internal/formatprocessor/processor.go
Alessandro Ros 5b61983fa6
Some checks failed
apidocs
code
mod-tidy
test32
test64
test_highlevel
add option to set max size of outgoing UDP packets (#1588) (#1601)
2023-03-31 11:53:49 +02:00

43 lines
1.0 KiB
Go

// Package formatprocessor contains code to cleanup and normalize streams.
package formatprocessor
import (
"github.com/aler9/gortsplib/v2/pkg/format"
)
// Processor allows to cleanup and normalize streams.
type Processor interface {
// clears and normalizes a data unit.
Process(Unit, bool) error
}
// New allocates a Processor.
func New(
udpMaxPayloadSize int,
forma format.Format,
generateRTPPackets bool,
) (Processor, error) {
switch forma := forma.(type) {
case *format.H264:
return newH264(udpMaxPayloadSize, forma, generateRTPPackets)
case *format.H265:
return newH265(udpMaxPayloadSize, forma, generateRTPPackets)
case *format.VP8:
return newVP8(udpMaxPayloadSize, forma, generateRTPPackets)
case *format.VP9:
return newVP9(udpMaxPayloadSize, forma, generateRTPPackets)
case *format.MPEG4Audio:
return newMPEG4Audio(udpMaxPayloadSize, forma, generateRTPPackets)
case *format.Opus:
return newOpus(udpMaxPayloadSize, forma, generateRTPPackets)
default:
return newGeneric(udpMaxPayloadSize, forma, generateRTPPackets)
}
}