mirror of
https://github.com/datarhei/core.git
synced 2025-09-26 20:11:29 +08:00
Add support for input framerate data from jsonstats patch
This commit is contained in:
@@ -7,26 +7,33 @@ import (
|
||||
"github.com/datarhei/core/v16/restream/app"
|
||||
)
|
||||
|
||||
type ProgressIOFramerate struct {
|
||||
Min json.Number `json:"min" swaggertype:"number" jsonschema:"type=number"`
|
||||
Max json.Number `json:"max" swaggertype:"number" jsonschema:"type=number"`
|
||||
Average json.Number `json:"avg" swaggertype:"number" jsonschema:"type=number"`
|
||||
}
|
||||
|
||||
// ProgressIO represents the progress of an ffmpeg input or output
|
||||
type ProgressIO struct {
|
||||
ID string `json:"id" jsonschema:"minLength=1"`
|
||||
Address string `json:"address" jsonschema:"minLength=1"`
|
||||
|
||||
// General
|
||||
Index uint64 `json:"index" format:"uint64"`
|
||||
Stream uint64 `json:"stream" format:"uint64"`
|
||||
Format string `json:"format"`
|
||||
Type string `json:"type"`
|
||||
Codec string `json:"codec"`
|
||||
Coder string `json:"coder"`
|
||||
Frame uint64 `json:"frame" format:"uint64"`
|
||||
Keyframe uint64 `json:"keyframe" format:"uint64"`
|
||||
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
|
||||
Packet uint64 `json:"packet" format:"uint64"`
|
||||
PPS json.Number `json:"pps" swaggertype:"number" jsonschema:"type=number"`
|
||||
Size uint64 `json:"size_kb" format:"uint64"` // kbytes
|
||||
Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
|
||||
Extradata uint64 `json:"extradata_size_bytes" format:"uint64"` // bytes
|
||||
Index uint64 `json:"index" format:"uint64"`
|
||||
Stream uint64 `json:"stream" format:"uint64"`
|
||||
Format string `json:"format"`
|
||||
Type string `json:"type"`
|
||||
Codec string `json:"codec"`
|
||||
Coder string `json:"coder"`
|
||||
Frame uint64 `json:"frame" format:"uint64"`
|
||||
Keyframe uint64 `json:"keyframe" format:"uint64"`
|
||||
Framerate ProgressIOFramerate `json:"framerate"`
|
||||
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
|
||||
Packet uint64 `json:"packet" format:"uint64"`
|
||||
PPS json.Number `json:"pps" swaggertype:"number" jsonschema:"type=number"`
|
||||
Size uint64 `json:"size_kb" format:"uint64"` // kbytes
|
||||
Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
|
||||
Extradata uint64 `json:"extradata_size_bytes" format:"uint64"` // bytes
|
||||
|
||||
// Video
|
||||
Pixfmt string `json:"pix_fmt,omitempty"`
|
||||
@@ -59,6 +66,9 @@ func (i *ProgressIO) Unmarshal(io *app.ProgressIO) {
|
||||
i.Coder = io.Coder
|
||||
i.Frame = io.Frame
|
||||
i.Keyframe = io.Keyframe
|
||||
i.Framerate.Min = json.Number(fmt.Sprintf("%.3f", io.Framerate.Min))
|
||||
i.Framerate.Max = json.Number(fmt.Sprintf("%.3f", io.Framerate.Max))
|
||||
i.Framerate.Average = json.Number(fmt.Sprintf("%.3f", io.Framerate.Average))
|
||||
i.FPS = json.Number(fmt.Sprintf("%.3f", io.FPS))
|
||||
i.Packet = io.Packet
|
||||
i.PPS = json.Number(fmt.Sprintf("%.3f", io.PPS))
|
||||
|
Reference in New Issue
Block a user