VideoWorker

class VideoWorker(path: str)[source]

Bases: object

Worker class for decoding video frames in a separate thread.

Uses OpenCV to read frames and serves them as QImages for display. Maintains synchronization with real-time based on the video’s FPS.

__init__(path: str) None[source]

Initializes the VideoWorker.

Parameters:

path (str) – Path to the video file.

Methods

Attributes

finished = <MockSignal object>
run() None[source]

Main loop for reading and processing video frames.

get_latest_qimage() <MagicMock name='mock.QImage.__or__()' id='140385431293968'>[source]

Returns the current video frame.

The decode loop paces itself to real time, so the latest decoded frame is the one to show now. paintGL samples this at the vsync rate.

Returns:

The current video frame.

Return type:

Optional[QImage]

play() None[source]

Sets the playback start time so get_latest_qimage starts serving frames.

stop() None[source]

Stops the video decoding loop.