Files
mediamtx/internal/defs/api_forward.go
T
98ab3009ea support forwarding streams natively (#5558)
It is now possible to define forward destinations for each path configuration. For each destination, the server will create a client that will forward the stream to the intended destination. Supported protocols are RTSP, RTMP, SRT. API and metrics have also been improved to allow monitoring the new forwarding system.

---------

Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com>
2026-08-04 21:57:15 +02:00

50 lines
1.6 KiB
Go

package defs
import (
"time"
"github.com/bluenviron/mediamtx/internal/conf"
"github.com/google/uuid"
)
// APIForwardDestState is the state of a forward destination.
type APIForwardDestState string
// forward states.
const (
APIForwardDestStateIdle APIForwardDestState = "idle"
APIForwardDestStateForwarding APIForwardDestState = "forwarding"
APIForwardDestStateError APIForwardDestState = "error"
)
// APIForwardDestProtocol is the protocol used by a forward destination.
type APIForwardDestProtocol string
// forward protocols.
const (
APIForwardDestProtocolRTMP APIForwardDestProtocol = "rtmp"
APIForwardDestProtocolRTMPS APIForwardDestProtocol = "rtmps"
APIForwardDestProtocolRTSP APIForwardDestProtocol = "rtsp"
APIForwardDestProtocolRTSPS APIForwardDestProtocol = "rtsps"
APIForwardDestProtocolSRT APIForwardDestProtocol = "srt"
)
// APIForwardDest is a forward destination.
type APIForwardDest struct {
ID uuid.UUID `json:"id"`
Pos int `json:"pos"`
Created time.Time `json:"created"`
Conf conf.ForwardDest `json:"conf"`
Protocol APIForwardDestProtocol `json:"protocol"`
State APIForwardDestState `json:"state"`
LastError string `json:"lastError"`
OutboundBytes uint64 `json:"outboundBytes"`
}
// APIForwardDestList is a list of forward destinations.
type APIForwardDestList struct {
ItemCount int `json:"itemCount"`
PageCount int `json:"pageCount"`
Items []APIForwardDest `json:"items"`
}