api

package
v16.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Overview

Package api provides types for communicating with the REST API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AVstream

type AVstream struct {
	Input       AVstreamIO `json:"input"`
	Output      AVstreamIO `json:"output"`
	Aqueue      uint64     `json:"aqueue"`
	Queue       uint64     `json:"queue"`
	Dup         uint64     `json:"dup"`
	Drop        uint64     `json:"drop"`
	Enc         uint64     `json:"enc"`
	Looping     bool       `json:"looping"`
	Duplicating bool       `json:"duplicating"`
	GOP         string     `json:"gop"`
}

func (*AVstream) Unmarshal

func (a *AVstream) Unmarshal(av *app.AVstream)

type AVstreamIO

type AVstreamIO struct {
	State  string `json:"state" enums:"running,idle" jsonschema:"enum=running,enum=idle"`
	Packet uint64 `json:"packet"`
	Time   uint64 `json:"time"`
	Size   uint64 `json:"size_kb"`
}

func (*AVstreamIO) Unmarshal

func (i *AVstreamIO) Unmarshal(io *app.AVstreamIO)

type About

type About struct {
	App       string   `json:"app"`
	Auths     []string `json:"auths"`
	Name      string   `json:"name"`
	ID        string   `json:"id"`
	CreatedAt string   `json:"created_at"`
	Uptime    uint64   `json:"uptime_seconds"`
	Version   Version  `json:"version"`
}

About is some general information about the API

type Command

type Command struct {
	Command string `` /* 127-byte string literal not displayed */
}

Command is a command to send to a process

type Config

type Config struct {
	CreatedAt time.Time `json:"created_at"`
	LoadedAt  time.Time `json:"loaded_at"`
	UpdatedAt time.Time `json:"updated_at"`

	Config ConfigData `json:"config"`

	Overrides []string `json:"overrides"`
}

Config is the config returned by the API

func (*Config) Unmarshal

func (c *Config) Unmarshal(cfg *config.Config)

Unmarshal converts a config.Config to a RestreamerConfig.

type ConfigData

type ConfigData struct {
	config.Data
}

ConfigData embeds config.Data

type ConfigError

type ConfigError map[string][]string

ConfigError is used to return error messages when uploading a new config

type Error

type Error struct {
	Code    int      `json:"code" jsonschema:"required"`
	Message string   `json:"message" jsonschema:""`
	Details []string `json:"details" jsonschema:""`
}

Error represents an error response of the API

func Err

func Err(code int, message string, args ...interface{}) Error

Err creates a new API error with the given HTTP status code. If message is empty, the default message for the given code is used. If the first entry in args is a string, it is interpreted as a format string for the remaining entries in args, that is used for fmt.Sprintf. Otherwise the args are ignored.

func (Error) Error

func (e Error) Error() string

Error returns the string representation of the error

type FileInfo

type FileInfo struct {
	Name    string `json:"name" jsonschema:"minLength=1"`
	Size    int64  `json:"size_bytes" jsonschema:"minimum=0"`
	LastMod int64  `json:"last_modified" jsonschema:"minimum=0"`
}

FileInfo represents informatiion about a file on a filesystem

type GraphQuery

type GraphQuery struct {
	Query     string      `json:"query"`
	Variables interface{} `json:"variables"`
}

type GraphResponse

type GraphResponse struct {
	Data   interface{}   `json:"data"`
	Errors []interface{} `json:"errors"`
}

type JWT

type JWT struct {
	AccessToken  string `json:"access_token" jsonschema:"minLength=1"`
	RefreshToken string `json:"refresh_token" jsonschema:"minLength=1"`
}

JWT is the JWT token and its expiry date

type JWTRefresh

type JWTRefresh struct {
	AccessToken string `json:"access_token" jsonschema:"minLength=1"`
}

type LogEvent

type LogEvent map[string]interface{}

LogEvent represents a log event from the app

type Login

type Login struct {
	Username string `json:"username" validate:"required" jsonschema:"minLength=1"`
	Password string `json:"password" validate:"required" jsonschema:"minLength=1"`
}

Login are the requires login credentials

type Metadata

type Metadata interface{}

Metadata represents arbitrary metadata for a process of for the app

func NewMetadata

func NewMetadata(data interface{}) Metadata

NewMetadata takes an interface and converts it to a Metadata type.

type MetricsQuery

type MetricsQuery struct {
	Timerange int64                `json:"timerange_sec"`
	Interval  int64                `json:"interval_sec"`
	Metrics   []MetricsQueryMetric `json:"metrics"`
}

type MetricsQueryMetric

type MetricsQueryMetric struct {
	Name   string            `json:"name"`
	Labels map[string]string `json:"labels"`
}

type MetricsResponse

type MetricsResponse struct {
	Timerange int64                   `json:"timerange_sec"`
	Interval  int64                   `json:"interval_sec"`
	Metrics   []MetricsResponseMetric `json:"metrics"`
}

func (*MetricsResponse) Unmarshal

func (m *MetricsResponse) Unmarshal(data []monitor.HistoryMetrics, timerange, interval time.Duration)

type MetricsResponseMetric

type MetricsResponseMetric struct {
	Name   string                 `json:"name"`
	Labels map[string]string      `json:"labels"`
	Values []MetricsResponseValue `json:"values"`
}

type MetricsResponseValue

type MetricsResponseValue struct {
	TS    time.Time `json:"ts"`
	Value float64   `json:"value"`
}

func (MetricsResponseValue) MarshalJSON

func (v MetricsResponseValue) MarshalJSON() ([]byte, error)

MarshalJSON marshals a MetricsResponseValue to JSON

type MinimalAbout

type MinimalAbout struct {
	App     string         `json:"app"`
	Auths   []string       `json:"auths"`
	Version VersionMinimal `json:"version"`
}

MinimalAbout is the minimal information about the API

type PlayoutStatus

type PlayoutStatus struct {
	ID          string            `json:"id"`
	Address     string            `json:"url"`
	Stream      uint64            `json:"stream"`
	Queue       uint64            `json:"queue"`
	AQueue      uint64            `json:"aqueue"`
	Dup         uint64            `json:"dup"`
	Drop        uint64            `json:"drop"`
	Enc         uint64            `json:"enc"`
	Looping     bool              `json:"looping"`
	Duplicating bool              `json:"duplicating"`
	GOP         string            `json:"gop"`
	Debug       interface{}       `json:"debug"`
	Input       PlayoutStatusIO   `json:"input"`
	Output      PlayoutStatusIO   `json:"output"`
	Swap        PlayoutStatusSwap `json:"swap"`
}

func (*PlayoutStatus) Unmarshal

func (s *PlayoutStatus) Unmarshal(status playout.Status)

type PlayoutStatusIO

type PlayoutStatusIO struct {
	State  string `json:"state" enums:"running,idle" jsonschema:"enum=running,enum=idle"`
	Packet uint64 `json:"packet"`
	Time   uint64 `json:"time"`
	Size   uint64 `json:"size_kb"`
}

func (*PlayoutStatusIO) Unmarshal

func (i *PlayoutStatusIO) Unmarshal(io playout.StatusIO)

type PlayoutStatusSwap

type PlayoutStatusSwap struct {
	Address     string `json:"url"`
	Status      string `json:"status"`
	LastAddress string `json:"lasturl"`
	LastError   string `json:"lasterror"`
}

func (*PlayoutStatusSwap) Unmarshal

func (s *PlayoutStatusSwap) Unmarshal(swap playout.StatusSwap)

type Probe

type Probe struct {
	Streams []ProbeIO `json:"streams"`
	Log     []string  `json:"log"`
}

Probe represents the result of probing a file. It has a list of detected streams and a list of log lone from the probe process.

func (*Probe) Unmarshal

func (probe *Probe) Unmarshal(p *app.Probe)

Unmarshal converts a restreamer Probe to a Probe in API representation

type ProbeIO

type ProbeIO struct {
	// common
	Address  string      `json:"url"`
	Format   string      `json:"format"`
	Index    uint64      `json:"index"`
	Stream   uint64      `json:"stream"`
	Language string      `json:"language"`
	Type     string      `json:"type"`
	Codec    string      `json:"codec"`
	Coder    string      `json:"coder"`
	Bitrate  json.Number `json:"bitrate_kbps" swaggertype:"number" jsonschema:"type=number"`
	Duration json.Number `json:"duration_sec"  swaggertype:"number" jsonschema:"type=number"`

	// video
	FPS    json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
	Pixfmt string      `json:"pix_fmt"`
	Width  uint64      `json:"width"`
	Height uint64      `json:"height"`

	// audio
	Sampling uint64 `json:"sampling_hz"`
	Layout   string `json:"layout"`
	Channels uint64 `json:"channels"`
}

ProbeIO represents a stream of a probed file

func (*ProbeIO) Unmarshal

func (i *ProbeIO) Unmarshal(io *app.ProbeIO)

type Process

type Process struct {
	ID        string         `json:"id" jsonschema:"minLength=1"`
	Type      string         `json:"type" jsonschema:"enum=ffmpeg"`
	Reference string         `json:"reference"`
	CreatedAt int64          `json:"created_at" jsonschema:"minimum=0"`
	Config    *ProcessConfig `json:"config,omitempty"`
	State     *ProcessState  `json:"state,omitempty"`
	Report    *ProcessReport `json:"report,omitempty"`
	Metadata  Metadata       `json:"metadata,omitempty"`
}

Process represents all information on a process

type ProcessConfig

type ProcessConfig struct {
	ID             string              `json:"id"`
	Type           string              `json:"type" validate:"oneof='ffmpeg' ''" jsonschema:"enum=ffmpeg,enum="`
	Reference      string              `json:"reference"`
	Input          []ProcessConfigIO   `json:"input" validate:"required"`
	Output         []ProcessConfigIO   `json:"output" validate:"required"`
	Options        []string            `json:"options"`
	Reconnect      bool                `json:"reconnect"`
	ReconnectDelay uint64              `json:"reconnect_delay_seconds"`
	Autostart      bool                `json:"autostart"`
	StaleTimeout   uint64              `json:"stale_timeout_seconds"`
	Limits         ProcessConfigLimits `json:"limits"`
}

ProcessConfig represents the configuration of an ffmpeg process

func (*ProcessConfig) Marshal

func (cfg *ProcessConfig) Marshal() *app.Config

Marshal converts a process config in API representation to a restreamer process config

func (*ProcessConfig) Unmarshal

func (cfg *ProcessConfig) Unmarshal(c *app.Config)

Unmarshal converts a restream process config to a process config in API representation

type ProcessConfigIO

type ProcessConfigIO struct {
	ID      string                   `json:"id"`
	Address string                   `json:"address" validate:"required" jsonschema:"minLength=1"`
	Options []string                 `json:"options"`
	Cleanup []ProcessConfigIOCleanup `json:"cleanup,omitempty"`
}

ProcessConfigIO represents an input or output of an ffmpeg process config

type ProcessConfigIOCleanup

type ProcessConfigIOCleanup struct {
	Pattern       string `json:"pattern" validate:"required"`
	MaxFiles      uint   `json:"max_files"`
	MaxFileAge    uint   `json:"max_file_age_seconds"`
	PurgeOnDelete bool   `json:"purge_on_delete"`
}

type ProcessConfigLimits

type ProcessConfigLimits struct {
	CPU     float64 `json:"cpu_usage" jsonschema:"minimum=0,maximum=100"`
	Memory  uint64  `json:"memory_mbytes" jsonschema:"minimum=0"`
	WaitFor uint64  `json:"waitfor_seconds" jsonschema:"minimum=0"`
}

type ProcessReport

type ProcessReport struct {
	ProcessReportHistoryEntry
	History []ProcessReportHistoryEntry `json:"history"`
}

ProcessReport represents the current log and the logs of previous runs of a restream process

func (*ProcessReport) Unmarshal

func (report *ProcessReport) Unmarshal(l *app.Log)

Unmarshal converts a restream log to a report

type ProcessReportHistoryEntry

type ProcessReportHistoryEntry struct {
	CreatedAt int64       `json:"created_at"`
	Prelude   []string    `json:"prelude"`
	Log       [][2]string `json:"log"`
}

ProcessReportHistoryEntry represents the logs of a run of a restream process

type ProcessState

type ProcessState struct {
	Order     string      `json:"order" jsonschema:"enum=start,enum=stop"`
	State     string      `json:"exec" jsonschema:"enum=finished,enum=starting,enum=running,enum=finishing,enum=killed,enum=failed"`
	Runtime   int64       `json:"runtime_seconds" jsonschema:"minimum=0"`
	Reconnect int64       `json:"reconnect_seconds"`
	LastLog   string      `json:"last_logline"`
	Progress  *Progress   `json:"progress"`
	Memory    uint64      `json:"memory_bytes"`
	CPU       json.Number `json:"cpu_usage" swaggertype:"number" jsonschema:"type=number"`
	Command   []string    `json:"command"`
}

ProcessState represents the current state of an ffmpeg process

func (*ProcessState) Unmarshal

func (s *ProcessState) Unmarshal(state *app.State)

Unmarshal converts a restreamer ffmpeg process state to a state in API representation

type Progress

type Progress struct {
	Input     []ProgressIO `json:"inputs"`
	Output    []ProgressIO `json:"outputs"`
	Frame     uint64       `json:"frame"`
	Packet    uint64       `json:"packet"`
	FPS       json.Number  `json:"fps" swaggertype:"number" jsonschema:"type=number"`
	Quantizer json.Number  `json:"q" swaggertype:"number" jsonschema:"type=number"`
	Size      uint64       `json:"size_kb"` // kbytes
	Time      json.Number  `json:"time" swaggertype:"number" jsonschema:"type=number"`
	Bitrate   json.Number  `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
	Speed     json.Number  `json:"speed" swaggertype:"number" jsonschema:"type=number"`
	Drop      uint64       `json:"drop"`
	Dup       uint64       `json:"dup"`
}

Progress represents the progress of an ffmpeg process

func (*Progress) Unmarshal

func (progress *Progress) Unmarshal(p *app.Progress)

Unmarshal converts a restreamer Progress to a Progress in API representation

type ProgressIO

type ProgressIO struct {
	ID      string `json:"id" jsonschema:"minLength=1"`
	Address string `json:"address" jsonschema:"minLength=1"`

	// General
	Index   uint64      `json:"index"`
	Stream  uint64      `json:"stream"`
	Format  string      `json:"format"`
	Type    string      `json:"type"`
	Codec   string      `json:"codec"`
	Coder   string      `json:"coder"`
	Frame   uint64      `json:"frame"`
	FPS     json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
	Packet  uint64      `json:"packet"`
	PPS     json.Number `json:"pps" swaggertype:"number" jsonschema:"type=number"`
	Size    uint64      `json:"size_kb"`                                                    // kbytes
	Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s

	// Video
	Pixfmt    string      `json:"pix_fmt,omitempty"`
	Quantizer json.Number `json:"q,omitempty" swaggertype:"number" jsonschema:"type=number"`
	Width     uint64      `json:"width,omitempty"`
	Height    uint64      `json:"height,omitempty"`

	// Audio
	Sampling uint64 `json:"sampling_hz,omitempty"`
	Layout   string `json:"layout,omitempty"`
	Channels uint64 `json:"channels,omitempty"`

	// avstream
	AVstream *AVstream `json:"avstream"`
}

ProgressIO represents the progress of an ffmpeg input or output

func (*ProgressIO) Unmarshal

func (i *ProgressIO) Unmarshal(io *app.ProgressIO)

Unmarshal converts a restreamer ProgressIO to a ProgressIO in API representation

type RTMPChannel

type RTMPChannel struct {
	Name string `json:"name" jsonschema:"minLength=1"`
}

RTMPChannel represents details about a currently connected RTMP publisher

type SRTChannels

type SRTChannels struct {
	Publisher   map[string]uint32        `json:"publisher"`
	Subscriber  map[string][]uint32      `json:"subscriber"`
	Connections map[uint32]SRTConnection `json:"connections"`
	Log         map[string][]SRTLog      `json:"log"`
}

SRTChannels represents all current SRT connections

func (*SRTChannels) Unmarshal

func (s *SRTChannels) Unmarshal(ss *srt.Channels)

Unmarshal converts the SRT channels into API representation

type SRTConnection

type SRTConnection struct {
	Log   map[string][]SRTLog `json:"log"`
	Stats SRTStatistics       `json:"stats"`
}

SRTConnection represents a SRT connection with statistics and logs

func (*SRTConnection) Unmarshal

func (s *SRTConnection) Unmarshal(ss *srt.Connection)

Unmarshal converts the SRT connection into API representation

type SRTLog

type SRTLog struct {
	Timestamp int64    `json:"ts"`
	Message   []string `json:"msg"`
}

type SRTStatistics

type SRTStatistics struct {
	MsTimeStamp uint64 `json:"timestamp_ms"` // The time elapsed, in milliseconds, since the SRT socket has been created

	PktSent         uint64 `json:"sent_pkt"`           // The total number of sent DATA packets, including retransmitted packets
	PktRecv         uint64 `json:"recv_pkt"`           // The total number of received DATA packets, including retransmitted packets
	PktSentUnique   uint64 `json:"sent_unique_pkt"`    // The total number of unique DATA packets sent by the SRT sender
	PktRecvUnique   uint64 `json:"recv_unique_pkt"`    // The total number of unique original, retransmitted or recovered by the packet filter DATA packets received in time, decrypted without errors and, as a result, scheduled for delivery to the upstream application by the SRT receiver.
	PktSndLoss      uint64 `json:"send_loss_pkt"`      // The total number of data packets considered or reported as lost at the sender side. Does not correspond to the packets detected as lost at the receiver side.
	PktRcvLoss      uint64 `json:"recv_loss_pkt"`      // The total number of SRT DATA packets detected as presently missing (either reordered or lost) at the receiver side
	PktRetrans      uint64 `json:"sent_retrans_pkt"`   // The total number of retransmitted packets sent by the SRT sender
	PktRcvRetrans   uint64 `json:"recv_retran_pkts"`   // The total number of retransmitted packets registered at the receiver side
	PktSentACK      uint64 `json:"sent_ack_pkt"`       // The total number of sent ACK (Acknowledgement) control packets
	PktRecvACK      uint64 `json:"recv_ack_pkt"`       // The total number of received ACK (Acknowledgement) control packets
	PktSentNAK      uint64 `json:"sent_nak_pkt"`       // The total number of sent NAK (Negative Acknowledgement) control packets
	PktRecvNAK      uint64 `json:"recv_nak_pkt"`       // The total number of received NAK (Negative Acknowledgement) control packets
	PktSentKM       uint64 `json:"send_km_pkt"`        // The total number of sent KM (Key Material) control packets
	PktRecvKM       uint64 `json:"recv_km_pkt"`        // The total number of received KM (Key Material) control packets
	UsSndDuration   uint64 `json:"send_duration_us"`   // The total accumulated time in microseconds, during which the SRT sender has some data to transmit, including packets that have been sent, but not yet acknowledged
	PktSndDrop      uint64 `json:"send_drop_pkt"`      // The total number of dropped by the SRT sender DATA packets that have no chance to be delivered in time
	PktRcvDrop      uint64 `json:"recv_drop_pkt"`      // The total number of dropped by the SRT receiver and, as a result, not delivered to the upstream application DATA packets
	PktRcvUndecrypt uint64 `json:"recv_undecrypt_pkt"` // The total number of packets that failed to be decrypted at the receiver side

	ByteSent         uint64 `json:"sent_bytes"`           // Same as pktSent, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteRecv         uint64 `json:"recv_bytes"`           // Same as pktRecv, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteSentUnique   uint64 `json:"sent_unique__bytes"`   // Same as pktSentUnique, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteRecvUnique   uint64 `json:"recv_unique_bytes"`    // Same as pktRecvUnique, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteRcvLoss      uint64 `json:"recv_loss__bytes"`     // Same as pktRcvLoss, but expressed in bytes, including payload and all the headers (IP, TCP, SRT), bytes for the presently missing (either reordered or lost) packets' payloads are estimated based on the average packet size
	ByteRetrans      uint64 `json:"sent_retrans_bytes"`   // Same as pktRetrans, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteSndDrop      uint64 `json:"send_drop_bytes"`      // Same as pktSndDrop, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteRcvDrop      uint64 `json:"recv_drop_bytes"`      // Same as pktRcvDrop, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)
	ByteRcvUndecrypt uint64 `json:"recv_undecrypt_bytes"` // Same as pktRcvUndecrypt, but expressed in bytes, including payload and all the headers (IP, TCP, SRT)

	UsPktSndPeriod       float64 `json:"pkt_send_period_us"`           // Current minimum time interval between which consecutive packets are sent, in microseconds
	PktFlowWindow        uint64  `json:"flow_window_pkt"`              // The maximum number of packets that can be "in flight"
	PktFlightSize        uint64  `json:"flight_size_pkt"`              // The number of packets in flight
	MsRTT                float64 `json:"rtt_ms"`                       // Smoothed round-trip time (SRTT), an exponentially-weighted moving average (EWMA) of an endpoint's RTT samples, in milliseconds
	MbpsBandwidth        float64 `json:"bandwidth_mbit"`               // Estimated bandwidth of the network link, in Mbps
	ByteAvailSndBuf      uint64  `json:"avail_send_buf_bytes"`         // The available space in the sender's buffer, in bytes
	ByteAvailRcvBuf      uint64  `json:"avail_recv_buf_bytes"`         // The available space in the receiver's buffer, in bytes
	MbpsMaxBW            float64 `json:"max_bandwidth_mbit"`           // Transmission bandwidth limit, in Mbps
	ByteMSS              uint64  `json:"mss_bytes"`                    // Maximum Segment Size (MSS), in bytes
	PktSndBuf            uint64  `json:"send_buf_pkt"`                 // The number of packets in the sender's buffer that are already scheduled for sending or even possibly sent, but not yet acknowledged
	ByteSndBuf           uint64  `json:"send_buf_bytes"`               // Instantaneous (current) value of pktSndBuf, but expressed in bytes, including payload and all headers (IP, TCP, SRT)
	MsSndBuf             uint64  `json:"send_buf_ms"`                  // The timespan (msec) of packets in the sender's buffer (unacknowledged packets)
	MsSndTsbPdDelay      uint64  `json:"send_tsbpd_delay_ms"`          // Timestamp-based Packet Delivery Delay value of the peer
	PktRcvBuf            uint64  `json:"recv_buf_pkt"`                 // The number of acknowledged packets in receiver's buffer
	ByteRcvBuf           uint64  `json:"recv_buf_bytes"`               // Instantaneous (current) value of pktRcvBuf, expressed in bytes, including payload and all headers (IP, TCP, SRT)
	MsRcvBuf             uint64  `json:"recv_buf_ms"`                  // The timespan (msec) of acknowledged packets in the receiver's buffer
	MsRcvTsbPdDelay      uint64  `json:"recv_tsbpd_delay_ms"`          // Timestamp-based Packet Delivery Delay value set on the socket via SRTO_RCVLATENCY or SRTO_LATENCY
	PktReorderTolerance  uint64  `json:"reorder_tolerance_pkt"`        // Instant value of the packet reorder tolerance
	PktRcvAvgBelatedTime uint64  `json:"pkt_recv_avg_belated_time_ms"` // Accumulated difference between the current time and the time-to-play of a packet that is received late
}

SRTStatistics represents the statistics of a SRT connection

func (*SRTStatistics) Unmarshal

func (s *SRTStatistics) Unmarshal(ss *gosrt.Statistics)

Unmarshal converts the SRT statistics into API representation

type Session

type Session struct {
	ID        string      `json:"id"`
	Reference string      `json:"reference"`
	CreatedAt int64       `json:"created_at"`
	Location  string      `json:"local"`
	Peer      string      `json:"remote"`
	Extra     string      `json:"extra"`
	RxBytes   uint64      `json:"bytes_rx"`
	TxBytes   uint64      `json:"bytes_tx"`
	RxBitrate json.Number `json:"bandwidth_rx_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
	TxBitrate json.Number `json:"bandwidth_tx_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
}

Session represents an active session

func (*Session) Unmarshal

func (s *Session) Unmarshal(sess session.Session)

type SessionPeers

type SessionPeers struct {
	SessionStats

	Locations map[string]SessionStats `json:"local"`
}

SessionPeers is for the grouping by peers in the summary

type SessionStats

type SessionStats struct {
	TotalSessions uint64 `json:"sessions"`
	TotalRxBytes  uint64 `json:"traffic_rx_mb"`
	TotalTxBytes  uint64 `json:"traffic_tx_mb"`
}

SessionStats are the accumulated numbers for the session summary

type SessionSummary

type SessionSummary struct {
	Active SessionSummaryActive `json:"active"`

	Summary SessionSummarySummary `json:"summary"`
}

SessionSummary is the API representation of a session.Summary

func (*SessionSummary) Unmarshal

func (summary *SessionSummary) Unmarshal(sum session.Summary)

Unmarshal creates a new SessionSummary from a session.Summary

type SessionSummaryActive

type SessionSummaryActive struct {
	SessionList  []Session   `json:"list"`
	Sessions     uint64      `json:"sessions"`
	RxBitrate    json.Number `json:"bandwidth_rx_mbit" swaggertype:"number" jsonschema:"type=number"` // mbit/s
	TxBitrate    json.Number `json:"bandwidth_tx_mbit" swaggertype:"number" jsonschema:"type=number"` // mbit/s
	MaxSessions  uint64      `json:"max_sessions"`
	MaxRxBitrate json.Number `json:"max_bandwidth_rx_mbit" swaggertype:"number" jsonschema:"type=number"` // mbit/s
	MaxTxBitrate json.Number `json:"max_bandwidth_tx_mbit" swaggertype:"number" jsonschema:"type=number"` // mbit/s
}

SessionSummaryActive represents the currently active sessions

type SessionSummarySummary

type SessionSummarySummary struct {
	Peers      map[string]SessionPeers `json:"remote"`
	Locations  map[string]SessionStats `json:"local"`
	References map[string]SessionStats `json:"reference"`
	SessionStats
}

SessionSummarySummary represents the summary (history) of all finished sessions

type SessionsActive

type SessionsActive map[string][]Session

SessionsActive is the API representation of all active sessions

type SessionsSummary

type SessionsSummary map[string]SessionSummary

type SetConfig

type SetConfig struct {
	config.Data
}

SetConfig embeds config.Data. It is used to send a new config to the server.

func NewSetConfig

func NewSetConfig(cfg *config.Config) SetConfig

NewSetConfig converts a config.Config into a RestreamerSetConfig in order to prepopulate a RestreamerSetConfig with the current values. The uploaded config can have missing fields that will be filled with the current values after unmarshalling the JSON.

func (*SetConfig) MergeTo

func (rscfg *SetConfig) MergeTo(cfg *config.Config)

MergeTo merges a sent config into a config.Config

type Skills

type Skills struct {
	FFmpeg struct {
		Version       string          `json:"version"`
		Compiler      string          `json:"compiler"`
		Configuration string          `json:"configuration"`
		Libraries     []SkillsLibrary `json:"libraries"`
	} `json:"ffmpeg"`

	Filters  []SkillsFilter  `json:"filter"`
	HWAccels []SkillsHWAccel `json:"hwaccels"`

	Codecs struct {
		Audio    []SkillsCodec `json:"audio"`
		Video    []SkillsCodec `json:"video"`
		Subtitle []SkillsCodec `json:"subtitle"`
	} `json:"codecs"`

	Devices struct {
		Demuxers []SkillsDevice `json:"demuxers"`
		Muxers   []SkillsDevice `json:"muxers"`
	} `json:"devices"`

	Formats struct {
		Demuxers []SkillsFormat `json:"demuxers"`
		Muxers   []SkillsFormat `json:"muxers"`
	} `json:"formats"`

	Protocols struct {
		Input  []SkillsProtocol `json:"input"`
		Output []SkillsProtocol `json:"output"`
	} `json:"protocols"`
}

Skills represents a set of ffmpeg capabilities

func (*Skills) Unmarshal

func (s *Skills) Unmarshal(skills skills.Skills)

Unmarshal converts skills to their API representation

type SkillsCodec

type SkillsCodec struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Encoders []string `json:"encoders"`
	Decoders []string `json:"decoders"`
}

SkillsCodec represents an ffmpeg codec

func (*SkillsCodec) Unmarshal

func (s *SkillsCodec) Unmarshal(codec skills.Codec)

Unmarshal converts a skills codec to its API representation

type SkillsDevice

type SkillsDevice struct {
	ID      string           `json:"id"`
	Name    string           `json:"name"`
	Devices []SkillsHWDevice `json:"devices"`
}

SkillsDevice represents a group of ffmpeg hardware devices

func (*SkillsDevice) Unmarshal

func (s *SkillsDevice) Unmarshal(device skills.Device)

Unmarshal converts a skills device to its API representation

type SkillsFilter

type SkillsFilter struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SkillsFilter represents an ffmpeg filter

func (*SkillsFilter) Unmarshal

func (s *SkillsFilter) Unmarshal(filter skills.Filter)

Unmarshal converts a skills filter to its API representation

type SkillsFormat

type SkillsFormat struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SkillsFormat represents an ffmpeg format

func (*SkillsFormat) Unmarshal

func (s *SkillsFormat) Unmarshal(format skills.Format)

Unmarshal converts a skills format to its API representation

type SkillsHWAccel

type SkillsHWAccel struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SkillsHWAccel represents an ffmpeg HW accelerator

func (*SkillsHWAccel) Unmarshal

func (s *SkillsHWAccel) Unmarshal(hwaccel skills.HWAccel)

Unmarshal converts a skills HWAccel to its API representation

type SkillsHWDevice

type SkillsHWDevice struct {
	ID    string `json:"id"`
	Name  string `json:"name"`
	Extra string `json:"extra"`
	Media string `json:"media"`
}

SkillsHWDevice represents an ffmpeg hardware device

func (*SkillsHWDevice) Unmarshal

func (s *SkillsHWDevice) Unmarshal(hwdevice skills.HWDevice)

Unmarshal converts a skills HW device to its API representation

type SkillsLibrary

type SkillsLibrary struct {
	Name     string `json:"name"`
	Compiled string `json:"compiled"`
	Linked   string `json:"linked"`
}

SkillsLibrary represents an avlib ffmpeg is compiled and linked with

func (*SkillsLibrary) Unmarshal

func (s *SkillsLibrary) Unmarshal(lib skills.Library)

Unmarshal converts a skills library to its API representation

type SkillsProtocol

type SkillsProtocol struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

SkillsProtocol represents an ffmpeg protocol

func (*SkillsProtocol) Unmarshal

func (s *SkillsProtocol) Unmarshal(proto skills.Protocol)

Unmarshal converts a skills protocol to its API representation

type Version

type Version struct {
	Number   string `json:"number"`
	Commit   string `json:"repository_commit"`
	Branch   string `json:"repository_branch"`
	Build    string `json:"build_date"`
	Arch     string `json:"arch"`
	Compiler string `json:"compiler"`
}

Version is some information about the binary

type VersionMinimal

type VersionMinimal struct {
	Number string `json:"number"`
}

type WidgetProcess

type WidgetProcess struct {
	CurrentSessions uint64 `json:"current_sessions"`
	TotalSessions   uint64 `json:"total_sessions"`
	Uptime          int64  `json:"uptime"`
}

Jump to

Keyboard shortcuts

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