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","."]
docstr: Grabbing frames from VideoCapture.
docstr_tok: ["Grabbing","frames","from","VideoCapture","."]
code: def put_fn(self):
      """
      Grabbing frames from VideoCapture.
      """
      was_read = True
      while was_read and not self.stopped:
          task = TaskInfo()
  
          task.img_height = self.display_height
          task.img_width = self.display_width
          task.crop_size = self.test_crop_size
          task.clip_vis_size = self.clip_vis_size
          frames = []
          if len(self.buffer) != 0:
              frames = self.buffer
          self.input_lock.acquire()
          while was_read and len(frames) < self.seq_length:
              was_read, frame = self.cap.read()
              if was_read:
                  frames.append(frame)
          self.input_lock.release()
          if was_read:
              self.buffer = frames[-self.buffer_size :]
  
          task.add_frames(self.put_id + 1, frames)
          task.num_buffer_frames = (
              0 if self.put_id == -1 else self.buffer_size
          )
          with self.put_id_lock:
              self.put_id += 1
              self.not_end = was_read
          # If mode is to read the most recent clip or we reach task
          # index that is not supposed to be skipped.
          if self.num_skip == 0 or self.put_id % self.num_skip == 0:
              self.read_queue.put((was_read, copy.deepcopy(task)))
          else:
              with self.write_lock:
                  self.write_queue[task.id] = (
                      was_read,
                      copy.deepcopy(task),
                  )
  
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 4 for calling the ThreadVideoManager obj's underlying member method code with example usage: obj.put_fn() without return types