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

View File

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

View File

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

View File

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

View File

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

View File

@@ -91,19 +91,20 @@ func (i *ProgressIO) Unmarshal(io *app.ProgressIO) {
// Progress represents the progress of an ffmpeg process
type Progress struct {
Input []ProgressIO `json:"inputs"`
Output []ProgressIO `json:"outputs"`
Mapping StreamMapping `json:"mapping"`
Frame uint64 `json:"frame" format:"uint64"`
Packet uint64 `json:"packet" format:"uint64"`
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" format:"uint64"` // 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" format:"uint64"`
Dup uint64 `json:"dup" format:"uint64"`
Initialized bool `json:"initialized"`
Input []ProgressIO `json:"inputs"`
Output []ProgressIO `json:"outputs"`
Mapping StreamMapping `json:"mapping"`
Frame uint64 `json:"frame" format:"uint64"`
Packet uint64 `json:"packet" format:"uint64"`
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" format:"uint64"` // 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" format:"uint64"`
Dup uint64 `json:"dup" format:"uint64"`
}
// Unmarshal converts a restreamer Progress to a Progress in API representation
@@ -115,6 +116,7 @@ func (progress *Progress) Unmarshal(p *app.Progress) {
return
}
progress.Initialized = p.Initialized
progress.Input = make([]ProgressIO, len(p.Input))
progress.Output = make([]ProgressIO, len(p.Output))
progress.Frame = p.Frame

View File

@@ -41,20 +41,21 @@ type ProgressIO struct {
}
type Progress struct {
Input []ProgressIO
Output []ProgressIO
Mapping StreamMapping
Frame uint64 // counter
Packet uint64 // counter
FPS float64 // rate, frames per second
PPS float64 // rate, packets per second
Quantizer float64 // gauge
Size uint64 // bytes
Time float64 // seconds with fractions
Bitrate float64 // bit/s
Speed float64 // gauge
Drop uint64 // counter
Dup uint64 // counter
Initialized bool
Input []ProgressIO
Output []ProgressIO
Mapping StreamMapping
Frame uint64 // counter
Packet uint64 // counter
FPS float64 // rate, frames per second
PPS float64 // rate, packets per second
Quantizer float64 // gauge
Size uint64 // bytes
Time float64 // seconds with fractions
Bitrate float64 // bit/s
Speed float64 // gauge
Drop uint64 // counter
Dup uint64 // counter
}
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.
func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress) {
progress.Initialized = pprogress.Initialized
progress.Frame = pprogress.Frame
progress.Packet = pprogress.Packet
progress.FPS = pprogress.FPS