(self, timeout=10.0)
Read blocks of raw PCM data from the file.
Read blocks of raw PCM data from the file.
Read blocks of raw PCM data from the file .
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(
                            ''.join(self.stderr_reader.queue.queue)
                        ))
                    else:
                        start_time = end_time
                        # Keep waiting.
                        continue
def read_data ( self , timeout = 10.0 ) : # 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 ( '' . join ( self . stderr_reader . queue . queue ) ) ) else : start_time = end_time # Keep waiting. continue