mirror of
https://github.com/datarhei/core.git
synced 2025-12-24 13:07:56 +08:00
Add speed and q value to progress events
This commit is contained in:
@@ -7899,6 +7899,9 @@ const docTemplate = `{
|
||||
"$ref": "#/definitions/api.ProcessProgressOutput"
|
||||
}
|
||||
},
|
||||
"speed": {
|
||||
"type": "number"
|
||||
},
|
||||
"time": {
|
||||
"type": "number"
|
||||
}
|
||||
@@ -7959,6 +7962,9 @@ const docTemplate = `{
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"q": {
|
||||
"type": "number"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -7892,6 +7892,9 @@
|
||||
"$ref": "#/definitions/api.ProcessProgressOutput"
|
||||
}
|
||||
},
|
||||
"speed": {
|
||||
"type": "number"
|
||||
},
|
||||
"time": {
|
||||
"type": "number"
|
||||
}
|
||||
@@ -7952,6 +7955,9 @@
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"q": {
|
||||
"type": "number"
|
||||
},
|
||||
"type": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -1587,6 +1587,8 @@ definitions:
|
||||
items:
|
||||
$ref: '#/definitions/api.ProcessProgressOutput'
|
||||
type: array
|
||||
speed:
|
||||
type: number
|
||||
time:
|
||||
type: number
|
||||
type: object
|
||||
@@ -1626,6 +1628,8 @@ definitions:
|
||||
type: number
|
||||
id:
|
||||
type: string
|
||||
q:
|
||||
type: number
|
||||
type:
|
||||
type: string
|
||||
type: object
|
||||
|
||||
@@ -101,6 +101,7 @@ type ProcessProgressOutput struct {
|
||||
Type string
|
||||
Bitrate float64
|
||||
FPS float64
|
||||
Quality float64
|
||||
}
|
||||
|
||||
func (p *ProcessProgressOutput) Clone() ProcessProgressOutput {
|
||||
@@ -110,6 +111,7 @@ func (p *ProcessProgressOutput) Clone() ProcessProgressOutput {
|
||||
Type: p.Type,
|
||||
Bitrate: p.Bitrate,
|
||||
FPS: p.FPS,
|
||||
Quality: p.Quality,
|
||||
}
|
||||
|
||||
return c
|
||||
@@ -119,6 +121,7 @@ type ProcessProgress struct {
|
||||
Input []ProcessProgressInput
|
||||
Output []ProcessProgressOutput
|
||||
Time float64
|
||||
Speed float64
|
||||
}
|
||||
|
||||
func (p *ProcessProgress) Clone() *ProcessProgress {
|
||||
@@ -133,6 +136,7 @@ func (p *ProcessProgress) Clone() *ProcessProgress {
|
||||
}
|
||||
|
||||
c.Time = p.Time
|
||||
c.Speed = p.Speed
|
||||
|
||||
return &c
|
||||
}
|
||||
|
||||
@@ -469,7 +469,8 @@ func (p *parser) Parse(line []byte) uint64 {
|
||||
|
||||
progress := p.assembleProgress()
|
||||
evt := &event.ProcessProgress{
|
||||
Time: progress.Time,
|
||||
Time: progress.Time,
|
||||
Speed: progress.Speed,
|
||||
}
|
||||
|
||||
for _, io := range progress.Input {
|
||||
@@ -504,6 +505,7 @@ func (p *parser) Parse(line []byte) uint64 {
|
||||
Type: io.Type,
|
||||
Bitrate: io.Bitrate,
|
||||
FPS: io.FPS,
|
||||
Quality: io.Quantizer,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -301,6 +301,7 @@ type ProcessProgressOutput struct {
|
||||
Type string `json:"type"`
|
||||
Bitrate json.Number `json:"bitrate" swaggertype:"number" jsonschema:"type=number"`
|
||||
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
|
||||
Quality json.Number `json:"q" swaggertype:"number" jsonschema:"type=number"`
|
||||
}
|
||||
|
||||
func (p *ProcessProgressOutput) Marshal() event.ProcessProgressOutput {
|
||||
@@ -317,6 +318,10 @@ func (p *ProcessProgressOutput) Marshal() event.ProcessProgressOutput {
|
||||
o.FPS = x
|
||||
}
|
||||
|
||||
if x, err := p.Quality.Float64(); err == nil {
|
||||
o.Quality = x
|
||||
}
|
||||
|
||||
return o
|
||||
}
|
||||
|
||||
@@ -324,6 +329,7 @@ type ProcessProgress struct {
|
||||
Input []ProcessProgressInput `json:"input"`
|
||||
Output []ProcessProgressOutput `json:"output"`
|
||||
Time json.Number `json:"time" swaggertype:"number" jsonschema:"type=number"`
|
||||
Speed json.Number `json:"speed" swaggertype:"number" jsonschema:"type=number"`
|
||||
}
|
||||
|
||||
func (p *ProcessProgress) Unmarshal(e *event.ProcessProgress) {
|
||||
@@ -345,10 +351,12 @@ func (p *ProcessProgress) Unmarshal(e *event.ProcessProgress) {
|
||||
Type: io.Type,
|
||||
Bitrate: json.ToNumber(io.Bitrate),
|
||||
FPS: json.ToNumber(io.FPS),
|
||||
Quality: json.ToNumber(io.Quality),
|
||||
})
|
||||
}
|
||||
|
||||
p.Time = json.ToNumber(e.Time)
|
||||
p.Speed = json.ToNumber(e.Speed)
|
||||
}
|
||||
|
||||
func (p *ProcessProgress) Marshal() *event.ProcessProgress {
|
||||
@@ -358,6 +366,10 @@ func (p *ProcessProgress) Marshal() *event.ProcessProgress {
|
||||
e.Time = x
|
||||
}
|
||||
|
||||
if x, err := p.Speed.Float64(); err == nil {
|
||||
e.Speed = x
|
||||
}
|
||||
|
||||
for _, input := range p.Input {
|
||||
e.Input = append(e.Input, input.Marshal())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user