Advertisement
Guest User

Untitled

a guest
Feb 8th, 2023
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.80 KB | None | 0 0
  1. class Stream(Generic[T]):
  2.     def __init__(self, source: StreamSource[T]):
  3.         self._source = source
  4.    
  5.     async def get_length(self) -> float:
  6.         return await self._source.get_length()
  7.    
  8.     def slice(self, start=0, end=float('inf')):
  9.         self._source = SliceSource(self._source, start, end)
  10.  
  11.  
  12. class VideoStream(Stream[Frame]):
  13.     def __init__(self, source: VideoSource):
  14.         super().__init__(source)
  15.  
  16.         self._video_metadata_source = source
  17.  
  18.     async def get_resolution(self) -> Tuple[int, int]:
  19.         return await self._video_metadata_source.get_resolution()
  20.    
  21.     def crop(self, x, y, w, h):
  22.         self._source = self._video_metadata_source = CropSource(
  23.             self._source,
  24.             self._video_metadata_source,
  25.             x, y, w, h,
  26.         )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement