golanggohlsrtmpwebrtcmedia-serverobs-studiortcprtmp-proxyrtmp-serverrtprtsprtsp-proxyrtsp-relayrtsp-serversrtstreamingwebrtc-proxy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.1 KiB
48 lines
1.1 KiB
// Package formatprocessor contains code to cleanup and normalize streams. |
|
package formatprocessor |
|
|
|
import ( |
|
"time" |
|
|
|
"github.com/pion/rtp" |
|
|
|
"github.com/aler9/gortsplib/v2/pkg/format" |
|
) |
|
|
|
// Data is the elementary data unit routed across the server. |
|
type Data interface { |
|
GetRTPPackets() []*rtp.Packet |
|
GetNTP() time.Time |
|
} |
|
|
|
// Processor allows to cleanup and normalize streams. |
|
type Processor interface { |
|
// cleanups and normalizes a data unit. |
|
Process(Data, bool) error |
|
} |
|
|
|
// New allocates a Processor. |
|
func New(forma format.Format, generateRTPPackets bool) (Processor, error) { |
|
switch forma := forma.(type) { |
|
case *format.H264: |
|
return newH264(forma, generateRTPPackets) |
|
|
|
case *format.H265: |
|
return newH265(forma, generateRTPPackets) |
|
|
|
case *format.VP8: |
|
return newVP8(forma, generateRTPPackets) |
|
|
|
case *format.VP9: |
|
return newVP9(forma, generateRTPPackets) |
|
|
|
case *format.MPEG4Audio: |
|
return newMPEG4Audio(forma, generateRTPPackets) |
|
|
|
case *format.Opus: |
|
return newOpus(forma, generateRTPPackets) |
|
|
|
default: |
|
return newGeneric(forma, generateRTPPackets) |
|
} |
|
}
|
|
|