mediamtx/internal/stream/stream_media.go

33 lines
703 B
Go
Raw Normal View History

package stream
import (
2023-08-26 16:54:28 +00:00
"github.com/bluenviron/gortsplib/v4/pkg/description"
"github.com/bluenviron/gortsplib/v4/pkg/format"
"github.com/bluenviron/mediamtx/internal/logger"
)
type streamMedia struct {
2023-08-26 16:54:28 +00:00
formats map[format.Format]*streamFormat
}
func newStreamMedia(udpMaxPayloadSize int,
2023-08-26 16:54:28 +00:00
medi *description.Media,
generateRTPPackets bool,
2023-08-26 21:34:39 +00:00
decodeErrLogger logger.Writer,
) (*streamMedia, error) {
sm := &streamMedia{
2023-08-26 16:54:28 +00:00
formats: make(map[format.Format]*streamFormat),
}
for _, forma := range medi.Formats {
var err error
2023-08-26 21:34:39 +00:00
sm.formats[forma], err = newStreamFormat(udpMaxPayloadSize, forma, generateRTPPackets, decodeErrLogger)
if err != nil {
return nil, err
}
}
return sm, nil
}