Use extra object for avstream data

This commit is contained in:
Ingo Oppermann
2025-12-03 16:27:13 +01:00
parent 690d2d6f95
commit 36f156e4ed
3 changed files with 47 additions and 22 deletions

View File

@@ -46,22 +46,36 @@ func NewProcessProgressEvent(progress *ProcessProgress) *ProcessEvent {
}
type ProcessProgressInput struct {
Bitrate float64
FPS float64
Looping bool
Enc uint64
Drop uint64
Dup uint64
Bitrate float64
FPS float64
AVstream ProcessProgressInputAVstream
}
func (p *ProcessProgressInput) Clone() ProcessProgressInput {
c := ProcessProgressInput{
Bitrate: p.Bitrate,
FPS: p.FPS,
Bitrate: p.Bitrate,
FPS: p.FPS,
AVstream: p.AVstream.Clone(),
}
return c
}
type ProcessProgressInputAVstream struct {
Looping bool
Enc uint64
Drop uint64
Dup uint64
Time uint64
}
func (p *ProcessProgressInputAVstream) Clone() ProcessProgressInputAVstream {
c := ProcessProgressInputAVstream{
Looping: p.Looping,
Enc: p.Enc,
Drop: p.Drop,
Dup: p.Dup,
Time: p.Time,
}
return c

View File

@@ -479,10 +479,13 @@ func (p *parser) Parse(line []byte) uint64 {
}
if io.AVstream != nil {
input.Looping = io.AVstream.Looping
input.Enc = io.AVstream.Enc
input.Drop = io.AVstream.Drop
input.Dup = io.AVstream.Dup
input.AVstream = event.ProcessProgressInputAVstream{
Looping: io.AVstream.Looping,
Enc: io.AVstream.Enc,
Drop: io.AVstream.Drop,
Dup: io.AVstream.Dup,
Time: io.AVstream.Input.Time,
}
}
evt.Input = append(evt.Input, input)

View File

@@ -195,12 +195,17 @@ type ProcessEvent struct {
}
type ProcessProgressInput struct {
Bitrate json.Number `json:"bitrate" swaggertype:"number" jsonschema:"type=number"`
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
Looping bool `json:"looping"`
Enc uint64 `json:"enc"`
Drop uint64 `json:"drop"`
Dup uint64 `json:"dup"`
Bitrate json.Number `json:"bitrate" swaggertype:"number" jsonschema:"type=number"`
FPS json.Number `json:"fps" swaggertype:"number" jsonschema:"type=number"`
AVstream ProcessProgressInputAVstream `json:"avstream"`
}
type ProcessProgressInputAVstream struct {
Looping bool `json:"looping"`
Enc uint64 `json:"enc"`
Drop uint64 `json:"drop"`
Dup uint64 `json:"dup"`
Time uint64 `json:"time"`
}
type ProcessProgressOutput struct {
@@ -219,10 +224,13 @@ func (p *ProcessProgress) Unmarshal(e *event.ProcessProgress) {
p.Input = append(p.Input, ProcessProgressInput{
Bitrate: json.ToNumber(io.Bitrate),
FPS: json.ToNumber(io.FPS),
Looping: io.Looping,
Enc: io.Enc,
Drop: io.Drop,
Dup: io.Dup,
AVstream: ProcessProgressInputAVstream{
Looping: io.AVstream.Looping,
Enc: io.AVstream.Enc,
Drop: io.AVstream.Drop,
Dup: io.AVstream.Dup,
Time: io.AVstream.Time,
},
})
}