Rename Initialized to Started

This commit is contained in:
Ingo Oppermann
2024-04-15 14:46:05 +02:00
parent 6ebe008010
commit 18bf51d334
9 changed files with 86 additions and 86 deletions

View File

@@ -6831,9 +6831,6 @@ const docTemplate = `{
"type": "integer", "type": "integer",
"format": "uint64" "format": "uint64"
}, },
"initialized": {
"type": "boolean"
},
"inputs": { "inputs": {
"type": "array", "type": "array",
"items": { "items": {
@@ -6864,6 +6861,9 @@ const docTemplate = `{
"speed": { "speed": {
"type": "number" "type": "number"
}, },
"started": {
"type": "boolean"
},
"time": { "time": {
"type": "number" "type": "number"
} }

View File

@@ -6823,9 +6823,6 @@
"type": "integer", "type": "integer",
"format": "uint64" "format": "uint64"
}, },
"initialized": {
"type": "boolean"
},
"inputs": { "inputs": {
"type": "array", "type": "array",
"items": { "items": {
@@ -6856,6 +6853,9 @@
"speed": { "speed": {
"type": "number" "type": "number"
}, },
"started": {
"type": "boolean"
},
"time": { "time": {
"type": "number" "type": "number"
} }

View File

@@ -1387,8 +1387,6 @@ 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'
@@ -1410,6 +1408,8 @@ definitions:
type: integer type: integer
speed: speed:
type: number type: number
started:
type: boolean
time: time:
type: number type: number
type: object type: object

View File

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

View File

@@ -184,16 +184,16 @@ func TestParserLogHistory(t *testing.T) {
d, _ := time.ParseDuration("3m58s440ms") d, _ := time.ParseDuration("3m58s440ms")
require.Equal(t, Progress{ require.Equal(t, Progress{
Initialized: true, Started: true,
Frame: 5968, Frame: 5968,
FPS: 0, // is calculated with averager FPS: 0, // is calculated with averager
Quantizer: 19.4, Quantizer: 19.4,
Size: 453632, Size: 453632,
Time: d.Seconds(), Time: d.Seconds(),
Bitrate: 0, // is calculated with averager Bitrate: 0, // is calculated with averager
Speed: 0.999, Speed: 0.999,
Drop: 3522, Drop: 3522,
Dup: 87463, Dup: 87463,
}, history[i].Progress) }, history[i].Progress)
if i != 0 { if i != 0 {
@@ -251,16 +251,16 @@ func TestParserLogMinimalHistoryLength(t *testing.T) {
d, _ := time.ParseDuration("3m58s440ms") d, _ := time.ParseDuration("3m58s440ms")
require.Equal(t, Progress{ require.Equal(t, Progress{
Initialized: true, Started: true,
Frame: 5968, Frame: 5968,
FPS: 0, // is calculated with averager FPS: 0, // is calculated with averager
Quantizer: 19.4, Quantizer: 19.4,
Size: 453632, Size: 453632,
Time: d.Seconds(), Time: d.Seconds(),
Bitrate: 0, // is calculated with averager Bitrate: 0, // is calculated with averager
Speed: 0.999, Speed: 0.999,
Drop: 3522, Drop: 3522,
Dup: 87463, Dup: 87463,
}, history[i].Progress) }, history[i].Progress)
} }
@@ -269,16 +269,16 @@ func TestParserLogMinimalHistoryLength(t *testing.T) {
d, _ := time.ParseDuration("3m58s440ms") d, _ := time.ParseDuration("3m58s440ms")
require.Equal(t, Progress{ require.Equal(t, Progress{
Initialized: true, Started: true,
Frame: 5968, Frame: 5968,
FPS: 0, // is calculated with averager FPS: 0, // is calculated with averager
Quantizer: 19.4, Quantizer: 19.4,
Size: 453632, Size: 453632,
Time: d.Seconds(), Time: d.Seconds(),
Bitrate: 0, // is calculated with averager Bitrate: 0, // is calculated with averager
Speed: 0.999, Speed: 0.999,
Drop: 3522, Drop: 3522,
Dup: 87463, Dup: 87463,
}, history[i].Progress) }, history[i].Progress)
} }
} }
@@ -813,7 +813,7 @@ func TestParserProgressPlayout(t *testing.T) {
progress := parser.Progress() progress := parser.Progress()
require.Equal(t, Progress{ require.Equal(t, Progress{
Initialized: true, Started: true,
Input: []ProgressIO{ Input: []ProgressIO{
{ {
Address: "playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8", Address: "playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8",

View File

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

View File

@@ -91,20 +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 {
Initialized bool `json:"initialized"` Started bool `json:"started"`
Input []ProgressIO `json:"inputs"` Input []ProgressIO `json:"inputs"`
Output []ProgressIO `json:"outputs"` Output []ProgressIO `json:"outputs"`
Mapping StreamMapping `json:"mapping"` Mapping StreamMapping `json:"mapping"`
Frame uint64 `json:"frame" format:"uint64"` Frame uint64 `json:"frame" format:"uint64"`
Packet uint64 `json:"packet" format:"uint64"` Packet uint64 `json:"packet" format:"uint64"`
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"` FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
Quantizer json.Number `json:"q" swaggertype:"number" jsonschema:"type=number"` Quantizer json.Number `json:"q" swaggertype:"number" jsonschema:"type=number"`
Size uint64 `json:"size_kb" format:"uint64"` // kbytes Size uint64 `json:"size_kb" format:"uint64"` // kbytes
Time json.Number `json:"time" swaggertype:"number" jsonschema:"type=number"` Time json.Number `json:"time" swaggertype:"number" jsonschema:"type=number"`
Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s Bitrate json.Number `json:"bitrate_kbit" swaggertype:"number" jsonschema:"type=number"` // kbit/s
Speed json.Number `json:"speed" swaggertype:"number" jsonschema:"type=number"` Speed json.Number `json:"speed" swaggertype:"number" jsonschema:"type=number"`
Drop uint64 `json:"drop" format:"uint64"` Drop uint64 `json:"drop" format:"uint64"`
Dup uint64 `json:"dup" 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
@@ -116,7 +116,7 @@ func (progress *Progress) Unmarshal(p *app.Progress) {
return return
} }
progress.Initialized = p.Initialized progress.Started = p.Started
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,21 +41,21 @@ type ProgressIO struct {
} }
type Progress struct { type Progress struct {
Initialized bool Started bool
Input []ProgressIO Input []ProgressIO
Output []ProgressIO Output []ProgressIO
Mapping StreamMapping Mapping StreamMapping
Frame uint64 // counter Frame uint64 // counter
Packet uint64 // counter Packet uint64 // counter
FPS float64 // rate, frames per second FPS float64 // rate, frames per second
PPS float64 // rate, packets per second PPS float64 // rate, packets per second
Quantizer float64 // gauge Quantizer float64 // gauge
Size uint64 // bytes Size uint64 // bytes
Time float64 // seconds with fractions Time float64 // seconds with fractions
Bitrate float64 // bit/s Bitrate float64 // bit/s
Speed float64 // gauge Speed float64 // gauge
Drop uint64 // counter Drop uint64 // counter
Dup uint64 // counter Dup uint64 // counter
} }
type GraphElement struct { type GraphElement struct {

View File

@@ -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. // 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.Started = pprogress.Started
progress.Frame = pprogress.Frame progress.Frame = pprogress.Frame
progress.Packet = pprogress.Packet progress.Packet = pprogress.Packet
progress.FPS = pprogress.FPS progress.FPS = pprogress.FPS