The function of the decklinksrc module is to return a constant stream of frames from the default webcam. By providing frames at a fast rate, a video interface can be developed and passed into other functions such as the QR Scanner or Video Display. In a forever loop, frames are repetitively grabbed from an OpenCV VideoCapture() and updated as the function’s parameter.
The decklinkSrcWorker_taxi file contains the decklinkSrc_worker_taxi() method called by main.py that takes pipelineOut as a parameter. Python parameters are pass by reference, so whatever the pipelineOut variable is changed to in the function is also changed in the main program, main.py. In decklinkSrcWorker_taxi(), a DeckLinkSRC object is created and this object has functions that are defined in decklinksrc.py. Using this object, functions from decklinksrc.py are called to store a frame into a variable called curr_frame.
The decklinksrc.py file uses OpenCV to start a webcam video capture for the DeckLinkSRC object, and uses the grab() function to store the current webcam frame and return it to the curr_frame variable in decklinkSrcWorker_taxi. Finally, the parameter pipelineOut is set as the curr_frame. Note that decklinksrc is always used in parallel with other functions such as qr_worker or videoDisplayWorker. The updated pipelineOut parameter becomes passed into the parameter of qr_worker or videoDisplayWorker, and then used to display the camera and call its corresponding functions.