Add initialized field in progress data

This commit is contained in:
Ingo Oppermann
2024-04-12 15:18:47 +02:00
parent 423e0453de
commit a6375da911
8 changed files with 56 additions and 49 deletions

View File

@@ -4887,9 +4887,6 @@ const docTemplate = `{
"leader": { "leader": {
"$ref": "#/definitions/api.ClusterAboutLeader" "$ref": "#/definitions/api.ClusterAboutLeader"
}, },
"node_id": {
"type": "string"
},
"nodes": { "nodes": {
"type": "array", "type": "array",
"items": { "items": {
@@ -6834,6 +6831,9 @@ const docTemplate = `{
"type": "integer", "type": "integer",
"format": "uint64" "format": "uint64"
}, },
"initialized": {
"type": "boolean"
},
"inputs": { "inputs": {
"type": "array", "type": "array",
"items": { "items": {

View File

@@ -4879,9 +4879,6 @@
"leader": { "leader": {
"$ref": "#/definitions/api.ClusterAboutLeader" "$ref": "#/definitions/api.ClusterAboutLeader"
}, },
"node_id": {
"type": "string"
},
"nodes": { "nodes": {
"type": "array", "type": "array",
"items": { "items": {
@@ -6826,6 +6823,9 @@
"type": "integer", "type": "integer",
"format": "uint64" "format": "uint64"
}, },
"initialized": {
"type": "boolean"
},
"inputs": { "inputs": {
"type": "array", "type": "array",
"items": { "items": {

View File

@@ -78,8 +78,6 @@ definitions:
type: string type: string
leader: leader:
$ref: '#/definitions/api.ClusterAboutLeader' $ref: '#/definitions/api.ClusterAboutLeader'
node_id:
type: string
nodes: nodes:
items: items:
$ref: '#/definitions/api.ClusterNode' $ref: '#/definitions/api.ClusterNode'
@@ -1389,6 +1387,8 @@ definitions:
frame: frame:
format: uint64 format: uint64
type: integer type: integer
initialized:
type: boolean
inputs: inputs:
items: items:
$ref: '#/definitions/api.ProgressIO' $ref: '#/definitions/api.ProgressIO'

View File

@@ -655,6 +655,8 @@ func (p *parser) Progress() Progress {
progress.Input[i].AVstream = av.export() progress.Input[i].AVstream = av.export()
} }
progress.Initialized = p.stats.initialized
return progress return progress
} }

View File

@@ -450,20 +450,21 @@ type ProgressIO struct {
} }
type Progress struct { type Progress struct {
Input []ProgressIO Initialized bool
Output []ProgressIO Input []ProgressIO
Mapping StreamMapping Output []ProgressIO
Frame uint64 Mapping StreamMapping
Packet uint64 Frame uint64
FPS float64 Packet uint64
PPS float64 FPS float64
Quantizer float64 PPS float64
Size uint64 // bytes Quantizer float64
Time float64 Size uint64 // bytes
Bitrate float64 // bit/s Time float64
Speed float64 Bitrate float64 // bit/s
Drop uint64 Speed float64
Dup uint64 Drop uint64
Dup uint64
} }
type AVstreamIO struct { type AVstreamIO struct {

View File

@@ -91,19 +91,20 @@ func (i *ProgressIO) Unmarshal(io *app.ProgressIO) {
// Progress represents the progress of an ffmpeg process // Progress represents the progress of an ffmpeg process
type Progress struct { type Progress struct {
Input []ProgressIO `json:"inputs"` Initialized bool `json:"initialized"`
Output []ProgressIO `json:"outputs"` Input []ProgressIO `json:"inputs"`
Mapping StreamMapping `json:"mapping"` Output []ProgressIO `json:"outputs"`
Frame uint64 `json:"frame" format:"uint64"` Mapping StreamMapping `json:"mapping"`
Packet uint64 `json:"packet" format:"uint64"` Frame uint64 `json:"frame" format:"uint64"`
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"` Packet uint64 `json:"packet" format:"uint64"`
Quantizer json.Number `json:"q" swaggertype:"number" jsonschema:"type=number"` FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
Size uint64 `json:"size_kb" format:"uint64"` // kbytes Quantizer json.Number `json:"q" swaggertype:"number" jsonschema:"type=number"`
Time json.Number `json:"time" 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 Time json.Number `json:"time" swaggertype:"number" jsonschema:"type=number"`
Speed json.Number `json:"speed" swaggertype:"number" jsonschema:"type=number"` Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
Drop uint64 `json:"drop" format:"uint64"` Speed json.Number `json:"speed" swaggertype:"number" jsonschema:"type=number"`
Dup uint64 `json:"dup" format:"uint64"` Drop uint64 `json:"drop" format:"uint64"`
Dup uint64 `json:"dup" format:"uint64"`
} }
// Unmarshal converts a restreamer Progress to a Progress in API representation // Unmarshal converts a restreamer Progress to a Progress in API representation
@@ -115,6 +116,7 @@ func (progress *Progress) Unmarshal(p *app.Progress) {
return return
} }
progress.Initialized = p.Initialized
progress.Input = make([]ProgressIO, len(p.Input)) progress.Input = make([]ProgressIO, len(p.Input))
progress.Output = make([]ProgressIO, len(p.Output)) progress.Output = make([]ProgressIO, len(p.Output))
progress.Frame = p.Frame progress.Frame = p.Frame

View File

@@ -41,20 +41,21 @@ type ProgressIO struct {
} }
type Progress struct { type Progress struct {
Input []ProgressIO Initialized bool
Output []ProgressIO Input []ProgressIO
Mapping StreamMapping Output []ProgressIO
Frame uint64 // counter Mapping StreamMapping
Packet uint64 // counter Frame uint64 // counter
FPS float64 // rate, frames per second Packet uint64 // counter
PPS float64 // rate, packets per second FPS float64 // rate, frames per second
Quantizer float64 // gauge PPS float64 // rate, packets per second
Size uint64 // bytes Quantizer float64 // gauge
Time float64 // seconds with fractions Size uint64 // bytes
Bitrate float64 // bit/s Time float64 // seconds with fractions
Speed float64 // gauge Bitrate float64 // bit/s
Drop uint64 // counter Speed float64 // gauge
Dup uint64 // counter Drop uint64 // counter
Dup uint64 // counter
} }
type GraphElement struct { type GraphElement struct {

View File

@@ -1624,6 +1624,7 @@ func (r *restream) GetProcessState(id app.ProcessID) (*app.State, error) {
// convertProgressFromParser converts a ffmpeg/parse.Progress type into a restream/app.Progress type. // convertProgressFromParser converts a ffmpeg/parse.Progress type into a restream/app.Progress type.
func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress) { func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress) {
progress.Initialized = pprogress.Initialized
progress.Frame = pprogress.Frame progress.Frame = pprogress.Frame
progress.Packet = pprogress.Packet progress.Packet = pprogress.Packet
progress.FPS = pprogress.FPS progress.FPS = pprogress.FPS