Forward keyframe and extradata_bytes counter to API

This commit is contained in:
Ingo Oppermann
2023-04-11 08:59:24 +02:00
parent 507b4f4b9a
commit b96672e308
3 changed files with 26 additions and 17 deletions

View File

@@ -765,7 +765,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,"packet":11,"size_kb":226}],"outputs":[{"index":0,"stream":0,"frame":7,"packet":0,"q":0.0,"size_kb":0},{"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(`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":""}}`)
progress := parser.Progress()
@@ -781,10 +781,11 @@ func TestParserProgressPlayout(t *testing.T) {
Codec: "h264",
Coder: "h264",
Frame: 7,
Keyframe: 1,
FPS: 0,
Packet: 11,
PPS: 0,
Size: 231424,
Size: 42,
Bitrate: 0,
Pixfmt: "yuvj420p",
Quantizer: 0,
@@ -798,13 +799,13 @@ func TestParserProgressPlayout(t *testing.T) {
State: "running",
Packet: 148,
Time: 5,
Size: 1529,
Size: 1565696,
},
Output: AVstreamIO{
State: "running",
Packet: 8,
Time: 1,
Size: 128,
Size: 131072,
},
Aqueue: 0,
Queue: 140,
@@ -827,11 +828,13 @@ func TestParserProgressPlayout(t *testing.T) {
Codec: "h264",
Coder: "libx264",
Frame: 7,
Keyframe: 1,
FPS: 0,
Packet: 0,
PPS: 0,
Size: 0,
Size: 5,
Bitrate: 0,
Extradata: 32,
Pixfmt: "yuvj420p",
Quantizer: 0,
Width: 1280,

View File

@@ -250,11 +250,13 @@ type ProgressIO struct {
Codec string
Coder string
Frame uint64
Keyframe uint64
FPS float64
Packet uint64
PPS float64
Size uint64 // bytes
Bitrate float64 // bit/s
Extradata uint64 // bytes
// Video
Pixfmt string

View File

@@ -1331,11 +1331,13 @@ func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress)
Codec: pinput.Codec,
Coder: pinput.Coder,
Frame: pinput.Frame,
Keyframe: pinput.Keyframe,
FPS: pinput.FPS,
Packet: pinput.Packet,
PPS: pinput.PPS,
Size: pinput.Size,
Bitrate: pinput.Bitrate,
Extradata: pinput.Extradata,
Pixfmt: pinput.Pixfmt,
Quantizer: pinput.Quantizer,
Width: pinput.Width,
@@ -1386,11 +1388,13 @@ func convertProgressFromParser(progress *app.Progress, pprogress parse.Progress)
Codec: poutput.Codec,
Coder: poutput.Coder,
Frame: poutput.Frame,
Keyframe: poutput.Keyframe,
FPS: poutput.FPS,
Packet: poutput.Packet,
PPS: poutput.PPS,
Size: poutput.Size,
Bitrate: poutput.Bitrate,
Extradata: poutput.Extradata,
Pixfmt: poutput.Pixfmt,
Quantizer: poutput.Quantizer,
Width: poutput.Width,