base_input
Base input transport implementation for Pipecat.
This module provides the BaseInputTransport class which handles audio and video input processing.
- class pipecat.transports.base_input.BaseInputTransport(params: TransportParams, **kwargs)[source]
Bases:
FrameProcessorBase class for input transport implementations.
Handles audio and video input processing including Voice Activity Detection, turn analysis, audio filtering, and user interaction management. Supports interruption handling and provides hooks for transport-specific implementations.
- __init__(params: TransportParams, **kwargs)[source]
Initialize the base input transport.
- Parameters:
params – Transport configuration parameters.
**kwargs – Additional arguments passed to parent class.
- enable_audio_in_stream_on_start(enabled: bool) None[source]
Enable or disable audio streaming on transport start.
- Parameters:
enabled – Whether to start audio streaming immediately on transport start.
- async start_audio_in_streaming()[source]
Start audio input streaming.
Override in subclasses to implement transport-specific audio streaming.
- property sample_rate: int
Get the current audio sample rate.
- Returns:
The sample rate in Hz.
- async start(frame: StartFrame)[source]
Start the input transport and initialize components.
- Parameters:
frame – The start frame containing initialization parameters.
- async stop(frame: EndFrame)[source]
Stop the input transport and cleanup resources.
- Parameters:
frame – The end frame signaling transport shutdown.
- async pause(frame: StopFrame)[source]
Pause the input transport temporarily.
- Parameters:
frame – The stop frame signaling transport pause.
- async cancel(frame: CancelFrame)[source]
Cancel the input transport and stop all processing.
- Parameters:
frame – The cancel frame signaling immediate cancellation.
- async set_transport_ready(frame: StartFrame)[source]
Called when the transport is ready to stream.
- Parameters:
frame – The start frame containing initialization parameters.
- async push_video_frame(frame: InputImageRawFrame)[source]
Push a video frame downstream if video input is enabled.
- Parameters:
frame – The input video frame to process.
- async push_audio_frame(frame: InputAudioRawFrame)[source]
Push an audio frame to the processing queue if audio input is enabled.
- Parameters:
frame – The input audio frame to process.
- async process_frame(frame: Frame, direction: FrameDirection)[source]
Process incoming frames and handle transport-specific logic.
- Parameters:
frame – The frame to process.
direction – The direction of frame flow in the pipeline.