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

__init__(path)

Initializes the VideoWorker.

get_latest_qimage()

Returns the most appropriate video frame for the current time.

run()

Main loop for reading and processing video frames.

stop()

Stops the video decoding loop.

Attributes

finished = <MockSignal object>
cap: cv2.VideoCapture | None
run() None[source]

Main loop for reading and processing video frames.

get_latest_qimage() <MagicMock name='mock.QImage' id='140286155962256'> | None[source]

Returns the most appropriate video frame for the current time.

Calculates the target frame based on elapsed time since start.

Returns:

The current video frame.

Return type:

Optional[QImage]

stop() None[source]

Stops the video decoding loop.