From f34aec00be3c744f6a6b9868abe2ec01a6614e23 Mon Sep 17 00:00:00 2001 From: Wang Hangjie Date: Thu, 26 Sep 2024 22:43:45 -0700 Subject: [PATCH] [ffmpeg-qsv] add jpeg encode playback_seek test case Signed-off-by: Wang Hangjie --- lib/parameters.py | 13 +++++++++++++ test/ffmpeg-qsv/encode/jpeg.py | 15 +++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/lib/parameters.py b/lib/parameters.py index 34fb1223..a7a9accb 100755 --- a/lib/parameters.py +++ b/lib/parameters.py @@ -750,6 +750,19 @@ def gen_jpeg_cqp_parameters(spec): params = gen_jpeg_cqp_variants(spec) return keys, params +def gen_jpeg_seek_variants(spec): + for case, params in spec.items(): + variants = params.get("variants", dict()).get("seek", []) + for variant in variants: + yield [ + case, variant.get("fps", 25), variant.get("seek", 1) + ] + +def gen_jpeg_seek_parameters(spec): + keys = ("case", "fps", "seek") + params = gen_jpeg_seek_variants(spec) + return keys, params + def gen_vp8_cqp_variants(spec): for case, params in spec.items(): variants = params.get("variants", dict()).get("cqp", None) diff --git a/test/ffmpeg-qsv/encode/jpeg.py b/test/ffmpeg-qsv/encode/jpeg.py index fae31c7c..02e72682 100644 --- a/test/ffmpeg-qsv/encode/jpeg.py +++ b/test/ffmpeg-qsv/encode/jpeg.py @@ -31,3 +31,18 @@ def test_r2r(self, case, quality): self.init(spec_r2r, case, quality) vars(self).setdefault("r2r", 5) self.encode() + +class seek(JPEGEncoderTest): + def init(self, tspec, case, fps, seek): + vars(self).update(tspec[case].copy()) + vars(self).update( + case = case, + rcmode = "cqp", + fps = fps, + seek = seek, + ) + + @slash.parametrize(*gen_jpeg_seek_parameters(spec)) + def test(self, case, fps, seek): + self.init(spec, case, fps, seek) + self.encode()