class_docstr: VideoManager object for getting frames from video source for inference
  using multithreading for read and write frames.
class_docstr_tok: ["VideoManager","object","for","getting","frames","from","video","source","for","inference","using","multithreading","for","read","and","write","frames","."]
code: def get_fn(self):
      while not self.stopped:
          with self.put_id_lock:
              put_id = self.put_id
              not_end = self.not_end
  
          with self.write_lock:
              # If video ended and we have display all frames.
              if not not_end and self.get_id == put_id:
                  break
              # If the next frames are not available, wait.
              if (
                  len(self.write_queue) == 0
                  or self.write_queue.get(self.get_id + 1) is None
              ):
                  time.sleep(0.02)
                  continue
              else:
                  self.get_id += 1
                  was_read, task = self.write_queue[self.get_id]
                  del self.write_queue[self.get_id]
  
          with self.output_lock:
              for frame in task.frames[task.num_buffer_frames :]:
                  if self.output_file is None:
                      cv2.imshow("SlowFast", frame)
                      time.sleep(1 / self.output_fps)
                  else:
                      self.output_file.write(frame)
  
imports: import atexit
  import copy
  import queue
  import threading
  import time
  import cv2
  import slowfast.utils.logging
  from slowfast.visualization.utils import TaskInfo
label_desc: Use image node_id 6 for calling the ThreadVideoManager obj's underlying member method code with example usage: obj.get_fn() without return types