Skip to content

Commit

Permalink
Add expose 'mode' from avstream progress
Browse files Browse the repository at this point in the history
  • Loading branch information
ioppermann committed Sep 20, 2023
1 parent 20f7a5c commit 48cc454
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 8 deletions.
14 changes: 14 additions & 0 deletions cluster/docs/ClusterAPI_docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions cluster/docs/ClusterAPI_swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,20 @@
}
}
},
"backup": {
"type": "object",
"properties": {
"dir": {
"type": "string"
},
"patterns": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"max_size_mbytes": {
"type": "integer",
"format": "int64"
Expand Down
9 changes: 9 additions & 0 deletions cluster/docs/ClusterAPI_swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,15 @@ definitions:
description: Deprecated, use IAM
type: string
type: object
backup:
properties:
dir:
type: string
patterns:
items:
type: string
type: array
type: object
max_size_mbytes:
format: int64
type: integer
Expand Down
31 changes: 31 additions & 0 deletions docs/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -4571,6 +4571,9 @@
"type": "integer",
"format": "uint64"
},
"mode": {
"type": "string"
},
"output": {
"$ref": "#/definitions/api.AVstreamIO"
},
Expand Down Expand Up @@ -5410,6 +5413,20 @@
}
}
},
"backup": {
"type": "object",
"properties": {
"dir": {
"type": "string"
},
"patterns": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"max_size_mbytes": {
"type": "integer",
"format": "int64"
Expand Down Expand Up @@ -7686,6 +7703,20 @@
}
}
},
"backup": {
"type": "object",
"properties": {
"dir": {
"type": "string"
},
"patterns": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"max_size_mbytes": {
"type": "integer",
"format": "int64"
Expand Down
20 changes: 20 additions & 0 deletions docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ definitions:
looping_runtime:
format: uint64
type: integer
mode:
type: string
output:
$ref: '#/definitions/api.AVstreamIO'
queue:
Expand Down Expand Up @@ -590,6 +592,15 @@ definitions:
description: Deprecated, use IAM
type: string
type: object
backup:
properties:
dir:
type: string
patterns:
items:
type: string
type: array
type: object
max_size_mbytes:
format: int64
type: integer
Expand Down Expand Up @@ -2195,6 +2206,15 @@ definitions:
description: Deprecated, use IAM
type: string
type: object
backup:
properties:
dir:
type: string
patterns:
items:
type: string
type: array
type: object
max_size_mbytes:
format: int64
type: integer
Expand Down
17 changes: 9 additions & 8 deletions ffmpeg/parse/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ func TestParserProgressPlayout(t *testing.T) {
parser.Parse(`ffmpeg.inputs:[{"url":"playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8","format":"playout","index":0,"stream":0,"type":"video","codec":"h264","coder":"h264","bitrate_kbps":0,"duration_sec":0.000000,"language":"und","fps":20.666666,"pix_fmt":"yuvj420p","width":1280,"height":720}]`)
parser.Parse(`ffmpeg.outputs:[{"url":"/dev/null","format":"flv","index":0,"stream":0,"type":"video","codec":"h264","coder":"libx264","bitrate_kbps":0,"duration_sec":0.000000,"language":"und","fps":25.000000,"pix_fmt":"yuvj420p","width":1280,"height":720},{"url":"/dev/null","format":"mp4","index":1,"stream":0,"type":"video","codec":"h264","coder":"copy","bitrate_kbps":0,"duration_sec":0.000000,"language":"und","fps":20.666666,"pix_fmt":"yuvj420p","width":1280,"height":720}]`)
parser.Parse(`ffmpeg.progress:{"inputs":[{"index":0,"stream":0,"frame":7,"keyframe":1,"packet":11,"size_kb":226,"size_bytes":42}],"outputs":[{"index":0,"stream":0,"frame":7,"keyframe":1,"packet":0,"q":0.0,"size_kb":0,"size_bytes":5,"extradata_size_bytes":32},{"index":1,"stream":0,"frame":11,"packet":11,"q":-1.0,"size_kb":226}],"frame":7,"packet":0,"q":0.0,"size_kb":226,"time":"0h0m0.56s","speed":0.4,"dup":0,"drop":0}`)
parser.Parse(`avstream.progress:{"id":"playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8","url":"https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8","stream":0,"queue":140,"aqueue":0,"dup":0,"drop":0,"enc":0,"looping":false,"duplicating":false,"gop":"none","input":{"state":"running","packet":148,"size_kb":1529,"time":5},"output":{"state":"running","packet":8,"size_kb":128,"time":1},"swap":{"url":"","status":"waiting","lasturl":"","lasterror":""}}`)
parser.Parse(`avstream.progress:{"id":"playout:https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8","url":"https://cdn.livespotting.com/vpu/e9slfpe3/z60wzayk.m3u8","stream":0,"queue":140,"aqueue":42,"dup":5,"drop":8,"enc":7,"looping":true,"duplicating":true,"gop":"key","mode":"live","input":{"state":"running","packet":148,"size_kb":1529,"time":5},"output":{"state":"running","packet":8,"size_kb":128,"time":1},"swap":{"url":"","status":"waiting","lasturl":"","lasterror":""}}`)

progress := parser.Progress()

Expand Down Expand Up @@ -846,14 +846,15 @@ func TestParserProgressPlayout(t *testing.T) {
Time: 1,
Size: 131072,
},
Aqueue: 0,
Aqueue: 42,
Queue: 140,
Dup: 0,
Drop: 0,
Enc: 0,
Looping: false,
Duplicating: false,
GOP: "none",
Dup: 5,
Drop: 8,
Enc: 7,
Looping: true,
Duplicating: true,
GOP: "key",
Mode: "live",
},
},
},
Expand Down
3 changes: 3 additions & 0 deletions ffmpeg/parse/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type ffmpegAVstream struct {
LoopingRuntime uint64 `json:"looping_runtime"`
Duplicating bool `json:"duplicating"`
GOP string `json:"gop"`
Mode string `json:"mode"`
}

func (av *ffmpegAVstream) export() *AVstream {
Expand All @@ -84,6 +85,7 @@ func (av *ffmpegAVstream) export() *AVstream {
LoopingRuntime: av.LoopingRuntime,
Duplicating: av.Duplicating,
GOP: av.GOP,
Mode: av.Mode,
Input: av.Input.export(),
Output: av.Output.export(),
}
Expand Down Expand Up @@ -323,6 +325,7 @@ type AVstream struct {
LoopingRuntime uint64
Duplicating bool
GOP string
Mode string
}

type Usage struct {
Expand Down
2 changes: 2 additions & 0 deletions http/api/avstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type AVstream struct {
LoopingRuntime uint64 `json:"looping_runtime" format:"uint64"`
Duplicating bool `json:"duplicating"`
GOP string `json:"gop"`
Mode string `json:"mode"`
}

func (a *AVstream) Unmarshal(av *app.AVstream) {
Expand All @@ -50,6 +51,7 @@ func (a *AVstream) Unmarshal(av *app.AVstream) {
a.LoopingRuntime = av.LoopingRuntime
a.Duplicating = av.Duplicating
a.GOP = av.GOP
a.Mode = av.Mode

a.Input.Unmarshal(&av.Input)
a.Output.Unmarshal(&av.Output)
Expand Down
1 change: 1 addition & 0 deletions restream/app/avstream.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ type AVstream struct {
LoopingRuntime uint64 // sec
Duplicating bool
GOP string
Mode string // "file" or "live"
}
1 change: 1 addition & 0 deletions restream/restream.go
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,7 @@ func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress)
LoopingRuntime: pinput.AVstream.LoopingRuntime,
Duplicating: pinput.AVstream.Duplicating,
GOP: pinput.AVstream.GOP,
Mode: pinput.AVstream.Mode,
}

input.AVstream = avstream
Expand Down

0 comments on commit 48cc454

Please sign in to comment.