From 18bf51d334a580027653c89e09422a939f0e497a Mon Sep 17 00:00:00 2001 From: Ingo Oppermann Date: Mon, 15 Apr 2024 14:46:05 +0200 Subject: [PATCH] Rename Initialized to Started --- docs/docs.go | 6 ++-- docs/swagger.json | 6 ++-- docs/swagger.yaml | 4 +-- ffmpeg/parse/parser.go | 2 +- ffmpeg/parse/parser_test.go | 62 ++++++++++++++++++------------------- ffmpeg/parse/types.go | 30 +++++++++--------- http/api/progress.go | 30 +++++++++--------- restream/app/progress.go | 30 +++++++++--------- restream/restream.go | 2 +- 9 files changed, 86 insertions(+), 86 deletions(-) diff --git a/docs/docs.go b/docs/docs.go index 161bbdf2..e8fc9e01 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -6831,9 +6831,6 @@ const docTemplate = `{ "type": "integer", "format": "uint64" }, - "initialized": { - "type": "boolean" - }, "inputs": { "type": "array", "items": { @@ -6864,6 +6861,9 @@ const docTemplate = `{ "speed": { "type": "number" }, + "started": { + "type": "boolean" + }, "time": { "type": "number" } diff --git a/docs/swagger.json b/docs/swagger.json index e6847824..de3940f2 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -6823,9 +6823,6 @@ "type": "integer", "format": "uint64" }, - "initialized": { - "type": "boolean" - }, "inputs": { "type": "array", "items": { @@ -6856,6 +6853,9 @@ "speed": { "type": "number" }, + "started": { + "type": "boolean" + }, "time": { "type": "number" } diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 15df7e26..c5597b7c 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -1387,8 +1387,6 @@ definitions: frame: format: uint64 type: integer - initialized: - type: boolean inputs: items: $ref: '#/definitions/api.ProgressIO' @@ -1410,6 +1408,8 @@ definitions: type: integer speed: type: number + started: + type: boolean time: type: number type: object diff --git a/ffmpeg/parse/parser.go b/ffmpeg/parse/parser.go index eb8e83f3..c4d131b2 100644 --- a/ffmpeg/parse/parser.go +++ b/ffmpeg/parse/parser.go @@ -655,7 +655,7 @@ func (p *parser) Progress() Progress { progress.Input[i].AVstream = av.export() } - progress.Initialized = p.stats.initialized + progress.Started = p.stats.initialized return progress } diff --git a/ffmpeg/parse/parser_test.go b/ffmpeg/parse/parser_test.go index 0481615b..ee67ee26 100644 --- a/ffmpeg/parse/parser_test.go +++ b/ffmpeg/parse/parser_test.go @@ -184,16 +184,16 @@ func TestParserLogHistory(t *testing.T) { d, _ := time.ParseDuration("3m58s440ms") require.Equal(t, Progress{ - Initialized: true, - Frame: 5968, - FPS: 0, // is calculated with averager - Quantizer: 19.4, - Size: 453632, - Time: d.Seconds(), - Bitrate: 0, // is calculated with averager - Speed: 0.999, - Drop: 3522, - Dup: 87463, + Started: true, + Frame: 5968, + FPS: 0, // is calculated with averager + Quantizer: 19.4, + Size: 453632, + Time: d.Seconds(), + Bitrate: 0, // is calculated with averager + Speed: 0.999, + Drop: 3522, + Dup: 87463, }, history[i].Progress) if i != 0 { @@ -251,16 +251,16 @@ func TestParserLogMinimalHistoryLength(t *testing.T) { d, _ := time.ParseDuration("3m58s440ms") require.Equal(t, Progress{ - Initialized: true, - Frame: 5968, - FPS: 0, // is calculated with averager - Quantizer: 19.4, - Size: 453632, - Time: d.Seconds(), - Bitrate: 0, // is calculated with averager - Speed: 0.999, - Drop: 3522, - Dup: 87463, + Started: true, + Frame: 5968, + FPS: 0, // is calculated with averager + Quantizer: 19.4, + Size: 453632, + Time: d.Seconds(), + Bitrate: 0, // is calculated with averager + Speed: 0.999, + Drop: 3522, + Dup: 87463, }, history[i].Progress) } @@ -269,16 +269,16 @@ func TestParserLogMinimalHistoryLength(t *testing.T) { d, _ := time.ParseDuration("3m58s440ms") require.Equal(t, Progress{ - Initialized: true, - Frame: 5968, - FPS: 0, // is calculated with averager - Quantizer: 19.4, - Size: 453632, - Time: d.Seconds(), - Bitrate: 0, // is calculated with averager - Speed: 0.999, - Drop: 3522, - Dup: 87463, + Started: true, + Frame: 5968, + FPS: 0, // is calculated with averager + Quantizer: 19.4, + Size: 453632, + Time: d.Seconds(), + Bitrate: 0, // is calculated with averager + Speed: 0.999, + Drop: 3522, + Dup: 87463, }, history[i].Progress) } } @@ -813,7 +813,7 @@ func TestParserProgressPlayout(t *testing.T) { progress := parser.Progress() require.Equal(t, Progress{ - Initialized: true, + Started: true, Input: []ProgressIO{ { Address: "playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8", diff --git a/ffmpeg/parse/types.go b/ffmpeg/parse/types.go index 1266f81f..014d20a5 100644 --- a/ffmpeg/parse/types.go +++ b/ffmpeg/parse/types.go @@ -450,21 +450,21 @@ type ProgressIO struct { } type Progress struct { - 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 + Started 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 { diff --git a/http/api/progress.go b/http/api/progress.go index b814e5a0..fe0c04d8 100644 --- a/http/api/progress.go +++ b/http/api/progress.go @@ -91,20 +91,20 @@ func (i *ProgressIO) Unmarshal(io *app.ProgressIO) { // Progress represents the progress of an ffmpeg process type Progress struct { - 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"` + Started bool `json:"started"` + 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 @@ -116,7 +116,7 @@ func (progress *Progress) Unmarshal(p *app.Progress) { return } - progress.Initialized = p.Initialized + progress.Started = p.Started progress.Input = make([]ProgressIO, len(p.Input)) progress.Output = make([]ProgressIO, len(p.Output)) progress.Frame = p.Frame diff --git a/restream/app/progress.go b/restream/app/progress.go index bed6461b..b59b5db8 100644 --- a/restream/app/progress.go +++ b/restream/app/progress.go @@ -41,21 +41,21 @@ type ProgressIO struct { } type Progress struct { - 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 + Started 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 { diff --git a/restream/restream.go b/restream/restream.go index fbdf392b..603c919c 100644 --- a/restream/restream.go +++ b/restream/restream.go @@ -1624,7 +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.Started = pprogress.Started progress.Frame = pprogress.Frame progress.Packet = pprogress.Packet progress.FPS = pprogress.FPS