Repository: just-work/fffw

Issue:
Split and concat should validate against any hardware
splitting and concatenation is supported in every hardware acceleration

Discussion:

Patch:
diff --git a/fffw/encoding/filters.py b/fffw/encoding/filters.py
index 1ef1505..43ed444 100644
--- a/fffw/encoding/filters.py
+++ b/fffw/encoding/filters.py
@@ -202,6 +202,10 @@ class Split(AutoFilter):
             return ''
         return str(self.output_count)
 
+    def validate_edge_device(self, edge: base.Edge) -> None:
+        # Any device is supported
+        return
+
 
 @dataclass
 class Trim(AutoFilter):
@@ -351,6 +355,10 @@ class Concat(Filter):
             kwargs['samples'] = samples
         return replace(metadata[0], **kwargs)
 
+    def validate_edge_device(self, edge: base.Edge) -> None:
+        # Any device is supported
+        return
+
 
 @dataclass
 class Overlay(VideoFilter):


Test patch:
diff --git a/tests/test_graph.py b/tests/test_graph.py
index 905464c..6b9bb4c 100644
--- a/tests/test_graph.py
+++ b/tests/test_graph.py
@@ -305,3 +305,17 @@ class FilterGraphTestCase(TestCase):
 
         cuda = meta.Device(hardware='cuda', name='foo')
         self.source.video | Upload(device=cuda) | ScaleCuda(640, 360)
+
+    def test_concat_split_allows_any_hardware(self):
+        """
+        Concat and split filters allow any hardware acceleration.
+        """
+        try:
+            cuda = meta.Device(hardware='cuda', name='foo')
+            hw = self.source.video | Upload(device=cuda)
+            split = hw | Split(VIDEO, output_count=2)
+            concat = Concat(VIDEO, input_count=2)
+            split | concat
+            split | concat
+        except ValueError:  # pragma: no cover
+            self.fail("hardware validation unexpectedly failed")