
    qi                         d Z ddlmZ ddlmZmZmZ ddlmZm	Z	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ dd
lmZ  G d de      Z G d de      Zy)zBase transport classes for Pipecat.

This module provides the foundation for transport implementations including
parameter configuration and abstract base classes for input/output transport
functionality.
    )abstractmethod)ListMappingOptional)	BaseModel
ConfigDictField)BaseAudioFilter)BaseAudioMixer)BaseTurnAnalyzer)VADAnalyzer)FrameProcessor)
BaseObjectc                      e Zd ZU dZ ed      ZdZeed<   dZ	eed<   dZ
eed<   dZeed	<   d
Zeed<   dZeed<   dZeed<   dZeed<   dZeed<   dZee   ed<   dZeed<   dZeed<   dZeed<   dZeeeee   ef   z     ed<    ee      Zee   ed<   dZeed<   dZ eed <   dZ!ee   ed!<   dZ"eed"<   dZ#ee$   ed#<   dZ%eed$<   dZ&eed%<   dZ'eed&<   dZ(eed'<   dZ)eed(<   dZ*eed)<   d
Z+eed*<   dZ,eed+<   dZ-eed,<   dZ.eed-<   dZ/ee   ed.<    ee      Z0ee   ed/<   dZ1eed0<   dZ2eed1<   dZ3ee4   ed2<   dZ5ee6   ed3<   y)4TransportParamsa  Configuration parameters for transport implementations.

    Parameters:
        camera_in_enabled: Enable camera input (deprecated, use video_in_enabled).

            .. deprecated:: 0.0.66
               The `camera_in_enabled` parameter is deprecated, use
               `video_in_enabled` instead.

        camera_out_enabled: Enable camera output (deprecated, use video_out_enabled).

            .. deprecated:: 0.0.66
               The `camera_out_enabled` parameter is deprecated, use
               `video_out_enabled` instead.

        camera_out_is_live: Enable real-time camera output (deprecated).

            .. deprecated:: 0.0.66
               The `camera_out_is_live` parameter is deprecated, use
               `video_out_is_live` instead.

        camera_out_width: Camera output width in pixels (deprecated).

            .. deprecated:: 0.0.66
               The `camera_out_width` parameter is deprecated, use
               `video_out_width` instead.

        camera_out_height: Camera output height in pixels (deprecated).

            .. deprecated:: 0.0.66
                The `camera_out_height` parameter is deprecated, use
                `video_out_height` instead.

        camera_out_bitrate: Camera output bitrate in bits per second (deprecated).

            .. deprecated:: 0.0.66
                The `camera_out_bitrate` parameter is deprecated, use
                `video_out_bitrate` instead.

        camera_out_framerate: Camera output frame rate in FPS (deprecated).

            .. deprecated:: 0.0.66
                The `camera_out_framerate` parameter is deprecated, use
                `video_out_framerate` instead.

        camera_out_color_format: Camera output color format string (deprecated).

            .. deprecated:: 0.0.66
                The `camera_out_color_format` parameter is deprecated, use
                `video_out_color_format` instead.

        audio_out_enabled: Enable audio output streaming.
        audio_out_sample_rate: Output audio sample rate in Hz.
        audio_out_channels: Number of output audio channels.
        audio_out_bitrate: Output audio bitrate in bits per second.
        audio_out_10ms_chunks: Number of 10ms chunks to buffer for output.
        audio_out_mixer: Audio mixer instance or destination mapping.
        audio_out_destinations: List of audio output destination identifiers.
        audio_out_end_silence_secs: How much silence to send after an EndFrame (0 for no silence).
        audio_in_enabled: Enable audio input streaming.
        audio_in_sample_rate: Input audio sample rate in Hz.
        audio_in_channels: Number of input audio channels.
        audio_in_filter: Audio filter to apply to input audio.
        audio_in_stream_on_start: Start audio streaming immediately on transport start.
        audio_in_passthrough: Pass through input audio frames downstream.
        video_in_enabled: Enable video input streaming.
        video_out_enabled: Enable video output streaming.
        video_out_is_live: Enable real-time video output streaming.
        video_out_width: Video output width in pixels.
        video_out_height: Video output height in pixels.
        video_out_bitrate: Video output bitrate in bits per second.
        video_out_framerate: Video output frame rate in FPS.
        video_out_color_format: Video output color format string.
        video_out_codec: Preferred video codec for output (e.g., 'VP8', 'H264', 'H265').
        video_out_destinations: List of video output destination identifiers.
        vad_enabled: Enable Voice Activity Detection (deprecated).

            .. deprecated:: 0.0.66
               The `vad_enabled` parameter is deprecated, use `audio_in_enabled`
               and `TransportParams.vad_analyzer` instead.

        vad_audio_passthrough: Enable VAD audio passthrough (deprecated).

            .. deprecated:: 0.0.66
                The `vad_audio_passthrough` parameter is deprecated, use `audio_in_passthrough`
                instead.

        vad_analyzer: Voice Activity Detection analyzer instance.

            .. deprecated:: 0.0.101
                The `vad_analyzer` parameter is deprecated, use `LLMUSerAggregator`'s
                new `vad_analyzer` parameter instead.

        turn_analyzer: Turn-taking analyzer instance for conversation management.

            .. deprecated:: 0.0.99
                The `turn_analyzer` parameter is deprecated, use `LLMUSerAggregator`'s
                new `user_turn_strategies` parameter instead.
    T)arbitrary_types_allowedFcamera_in_enabledcamera_out_enabledcamera_out_is_livei   camera_out_widthi   camera_out_heighti 5 camera_out_bitrate   camera_out_framerateRGBcamera_out_color_formataudio_out_enabledNaudio_out_sample_rate   audio_out_channelsi w audio_out_bitrate   audio_out_10ms_chunksaudio_out_mixer)default_factoryaudio_out_destinations   audio_out_end_silence_secsaudio_in_enabledaudio_in_sample_rateaudio_in_channelsaudio_in_filteraudio_in_stream_on_startaudio_in_passthroughvideo_in_enabledvideo_out_enabledvideo_out_is_livevideo_out_widthvideo_out_heightvideo_out_bitratevideo_out_frameratevideo_out_color_formatvideo_out_codecvideo_out_destinationsvad_enabledvad_audio_passthroughvad_analyzerturn_analyzer)7__name__
__module____qualname____doc__r   model_configr   bool__annotations__r   r   r   intr   r   r   r   strr   r   r   r    r!   r#   r$   r   r   r	   listr&   r   r(   r)   r*   r+   r,   r
   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r;   r   r<   r        S/opt/pipecat/venv/lib/python3.12/site-packages/pipecat/transports/base_transport.pyr   r      s   bH d;L#t#$$$$ c  s $$ "#"#(S(#t#+/8C=/"s"!"3"Y]OXnwx}n7T/UUV](-d(CDIC&''"d"*.(3-.s15OXo.5%)d)!%$%"d"#t##t#OSc#s#!!"'C'%)OXc])(-d(CDICK"'4'*.L(;'.04M8,-4rH   r   c                   x     e Zd ZdZdddddee   dee   dee   f fdZedefd	       Z	edefd
       Z
 xZS )BaseTransportzBase class for transport implementations.

    Provides the foundation for transport classes that handle media streaming,
    including input and output frame processors for audio and video data.
    N)name
input_nameoutput_namerL   rM   rN   c                B    t         |   |       || _        || _        y)zInitialize the base transport.

        Args:
            name: Optional name for the transport instance.
            input_name: Optional name for the input processor.
            output_name: Optional name for the output processor.
        )rL   N)super__init___input_name_output_name)selfrL   rM   rN   	__class__s       rI   rQ   zBaseTransport.__init__   s%     	d#%'rH   returnc                      y)zGet the input frame processor for this transport.

        Returns:
            The frame processor that handles incoming frames.
        NrG   rT   s    rI   inputzBaseTransport.input        	rH   c                      y)zGet the output frame processor for this transport.

        Returns:
            The frame processor that handles outgoing frames.
        NrG   rX   s    rI   outputzBaseTransport.output   rZ   rH   )r=   r>   r?   r@   r   rE   rQ   r   r   rY   r\   __classcell__)rU   s   @rI   rK   rK      sx     #$(%)( sm( SM	(
 c]($ ~     rH   rK   N)r@   abcr   typingr   r   r   pydanticr   r   r	   'pipecat.audio.filters.base_audio_filterr
   %pipecat.audio.mixers.base_audio_mixerr   %pipecat.audio.turn.base_turn_analyzerr   pipecat.audio.vad.vad_analyzerr   "pipecat.processors.frame_processorr   pipecat.utils.base_objectr   r   rK   rG   rH   rI   <module>rg      sH     * * 1 1 C @ B 6 = 0J5i J5Z)J )rH   