Documentation
¶
Overview ¶
Package api provides types for communicating with the REST API
Index ¶
- type AVstream
- type AVstreamIO
- type About
- type Command
- type Config
- type ConfigData
- type ConfigError
- type Error
- type FileInfo
- type GraphQuery
- type GraphResponse
- type JWT
- type JWTRefresh
- type LogEvent
- type Login
- type Metadata
- type MetricsQuery
- type MetricsQueryMetric
- type MetricsResponse
- type MetricsResponseMetric
- type MetricsResponseValue
- type MinimalAbout
- type PlayoutStatus
- type PlayoutStatusIO
- type PlayoutStatusSwap
- type Probe
- type ProbeIO
- type Process
- type ProcessConfig
- type ProcessConfigIO
- type ProcessConfigIOCleanup
- type ProcessConfigLimits
- type ProcessReport
- type ProcessReportHistoryEntry
- type ProcessState
- type Progress
- type ProgressIO
- type RTMPChannel
- type Session
- type SessionPeers
- type SessionStats
- type SessionSummary
- type SessionSummaryActive
- type SessionSummarySummary
- type SessionsActive
- type SessionsSummary
- type SetConfig
- type Skills
- type SkillsCodec
- type SkillsDevice
- type SkillsFilter
- type SkillsFormat
- type SkillsHWAccel
- type SkillsHWDevice
- type SkillsLibrary
- type SkillsProtocol
- type Version
- type VersionMinimal
- type WidgetProcess
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"` }
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
type ConfigError ¶
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 ¶
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.
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 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 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 ¶
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 ¶
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.
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"` Duration json.Number `json:"duration_sec" swaggertype:"number"` // video FPS json.Number `json:"fps" swaggertype:"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
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 ProcessConfigLimits ¶
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"` 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"` Quantizer json.Number `json:"q" swaggertype:"number"` Size uint64 `json:"size_kb"` // kbytes Time json.Number `json:"time" swaggertype:"number"` Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number"` // kbit/s Speed json.Number `json:"speed" swaggertype:"number"` Drop uint64 `json:"drop"` Dup uint64 `json:"dup"` }
Progress represents the progress of an ffmpeg process
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"` Packet uint64 `json:"packet"` PPS json.Number `json:"pps" swaggertype:"number"` Size uint64 `json:"size_kb"` // kbytes Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number"` // kbit/s // Video Pixfmt string `json:"pix_fmt,omitempty"` Quantizer json.Number `json:"q,omitempty" swaggertype:"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 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"` // kbit/s TxBitrate json.Number `json:"bandwidth_tx_kbit" swaggertype:"number"` // kbit/s }
Session represents an active 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"` // mbit/s TxBitrate json.Number `json:"bandwidth_tx_mbit" swaggertype:"number"` // mbit/s MaxSessions uint64 `json:"max_sessions"` MaxRxBitrate json.Number `json:"max_bandwidth_rx_mbit" swaggertype:"number"` // mbit/s MaxTxBitrate json.Number `json:"max_bandwidth_tx_mbit" swaggertype:"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 ¶
SessionsActive is the API representation of all active sessions
type SessionsSummary ¶
type SessionsSummary map[string]SessionSummary
type SetConfig ¶
SetConfig embeds config.Data. It is used to send a new config to the server.
func NewSetConfig ¶
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.
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
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 ¶
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 ¶
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 ¶
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 ¶
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"`
}