Subclass the mjpegstream descriptor
This commit is contained in:
parent
ad7b0d8da8
commit
f85361ae67
1 changed files with 20 additions and 2 deletions
|
|
@ -250,6 +250,24 @@ class MJPEGStreamWithTimestamp(lt.outputs.MJPEGStream):
|
|||
self.notify_new_frame, entry.index
|
||||
)
|
||||
|
||||
class MJPEGStreamDescriptorWithTimestamp(lt.outputs.MJPEGStreamDescriptor):
|
||||
"""Subclass the Labthings descriptor to return our own class."""
|
||||
|
||||
def __get__(
|
||||
self, obj: Optional[lt.Thing], type: type[lt.Thing] | None = None # noqa: A002
|
||||
) -> MJPEGStreamWithTimestamp | Self:
|
||||
"""Return our own MJPEG Stream with timestamp."""
|
||||
if obj is None:
|
||||
return self
|
||||
try:
|
||||
return obj.__dict__[self.name]
|
||||
except KeyError:
|
||||
obj.__dict__[self.name] = MJPEGStreamWithTimestamp(
|
||||
**self._kwargs,
|
||||
thing_server_interface=obj._thing_server_interface,
|
||||
)
|
||||
return obj.__dict__[self.name]
|
||||
|
||||
|
||||
class BaseCamera(OFMThing, ABC):
|
||||
"""The base class for all cameras. All cameras must directly inherit from this class.
|
||||
|
|
@ -262,8 +280,8 @@ class BaseCamera(OFMThing, ABC):
|
|||
|
||||
_all_background_detectors: Mapping[str, BackgroundDetectAlgorithm] = lt.thing_slot()
|
||||
|
||||
mjpeg_stream = lt.outputs.MJPEGStreamDescriptor()
|
||||
lores_mjpeg_stream = lt.outputs.MJPEGStreamDescriptor()
|
||||
mjpeg_stream = MJPEGStreamDescriptorWithTimestamp()
|
||||
lores_mjpeg_stream = MJPEGStreamDescriptorWithTimestamp()
|
||||
_memory_buffer = CameraMemoryBuffer()
|
||||
supports_focus_fom: bool = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue