-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathabstract.py
More file actions
50 lines (36 loc) · 1.63 KB
/
Copy pathabstract.py
File metadata and controls
50 lines (36 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from abc import ABC, abstractmethod
from typing import Any
from vstools import vs
from ...data.parse import WobblyParser
from ...types import FilteringPositionEnum
__all__ = [
'AbstractProcessingStrategy',
]
class AbstractProcessingStrategy(ABC):
"""
Abstract base class for processing strategies.
To write your own strategy, inherit from this class and implement
the `apply` method and the `position` property.
:param kwargs: Additional keyword arguments.
These will be passed to the strategy when it is applied.
"""
def __init__(self, **kwargs: Any) -> None:
self._kwargs = kwargs
@abstractmethod
def apply(self, clip: vs.VideoNode, wobbly_parsed: WobblyParser) -> vs.VideoNode:
"""
Apply the strategy to the given frames.
:param clip: The clip to process.
:param wobbly_parsed: The parsed wobbly file. See the `WobblyParser` class for more information,
including all the data that is available.
:return: Clip with the processing applied to the selected frames.
"""
# It's recommended to use `replace_ranges` to apply your strategy.
# This is gonna be the fastest and most straightforward way to do it,
# and allows you to easily access surrounding frames if necessary.
# See the implementations in this library for examples.
@property
@abstractmethod
def position(self) -> FilteringPositionEnum:
"""When to apply the strategy."""
return FilteringPositionEnum.POST_DECIMATE