def _callback_recycle(self, port, buf): """ Recycles the buffer on behalf of the encoder callback function """ mmal.mmal_buffer_header_release(buf) if port[0].is_enabled: new_buf = mmal.mmal_queue_get(self.pool[0].queue) if not new_buf: raise PiCameraError( "Unable to get a buffer to return to the encoder port") mmal_check(mmal.mmal_port_send_buffer(port, new_buf), prefix="Unable to return a buffer to the encoder port")
def _callback_recycle(self, port, buf): """ Recycles the buffer on behalf of the encoder callback function """ mmal.mmal_buffer_header_release(buf) if port[0].is_enabled: new_buf = mmal.mmal_queue_get(self.pool[0].queue) if not new_buf: raise PiCameraError( "Unable to get a buffer to return to the encoder port") mmal_check( mmal.mmal_port_send_buffer(port, new_buf), prefix="Unable to return a buffer to the encoder port")
def _callback(self, port, buf): """ The encoder's main callback function """ if self.stopped: mmal.mmal_buffer_header_release(buf) else: stop = False try: try: stop = self._callback_write(buf) finally: mmal.mmal_buffer_header_release(buf) self._callback_recycle(port, buf) except Exception as e: stop = True self.exception = e if stop: self.stopped = True self.event.set()
def _overlay_callback(port, buf): mmal.mmal_buffer_header_release(buf)