class_docstr: An audio file decoded by the ffmpeg command-line utility.
class_docstr_tok: ["An","audio","file","decoded","by","the","ffmpeg","command-line","utility","."]
docstr: Read blocks of raw PCM data from the file.
docstr_tok: ["Read","blocks","of","raw","PCM","data","from","the","file","."]
code: def read_data(self, timeout=10.0):
      """Read blocks of raw PCM data from the file."""
      # Read from stdout in a separate thread and consume data from
      # the queue.
      start_time = time.time()
      while True:
          # Wait for data to be available or a timeout.
          data = None
          try:
              data = self.stdout_reader.queue.get(timeout=timeout)
              if data:
                  yield data
              else:
                  # End of file.
                  break
          except queue.Empty:
              # Queue read timed out.
              end_time = time.time()
              if not data:
                  if end_time - start_time >= timeout:
                      # Nothing interesting has happened for a while --
                      # FFmpeg is probably hanging.
                      raise ReadTimeoutError(
                          "ffmpeg output: {}".format(
                              b"".join(self.stderr_reader.queue.queue)
                          )
                      )
                  else:
                      start_time = end_time
                      # Keep waiting.
                      continue
  
imports: import queue
  import re
  import subprocess
  import sys
  import threading
  import time
  from io import DEFAULT_BUFFER_SIZE
  from .exceptions import DecodeError
  from .base import AudioFile
label_desc: Use image node_id 2 for calling the FFmpegAudioFile obj's underlying member method code with example usage: obj.read_data(timeout) without return types