o
    i                      @   s   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 deZG dd deZdS )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                   @   s  e Zd ZU dZed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 B  ed< eed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dZ0ee ed/< dZ1eed0< dZ2eed1< dZ3ee4 ed2< dZ5ee6 ed3< dS )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
                `vad_analyzer` parameter, or `VADProcessor` if no `LLMUserAggregator`
                is needed.

        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-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r   r:   r    rE   rE   U/home/ubuntu/.local/lib/python3.10/site-packages/pipecat/transports/base_transport.pyr      sN   
 
e r   c                       sh   e Zd ZdZdddddee dee dee f fddZed	efd
dZ	ed	efddZ
  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_namerH   rI   rJ   c                   s   t  j|d || _|| _dS )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.
        )rH   N)super__init___input_name_output_name)selfrH   rI   rJ   	__class__rE   rF   rL      s   
zBaseTransport.__init__returnc                 C      dS )zGet the input frame processor for this transport.

        Returns:
            The frame processor that handles incoming frames.
        NrE   rO   rE   rE   rF   input      zBaseTransport.inputc                 C   rS   )zGet the output frame processor for this transport.

        Returns:
            The frame processor that handles outgoing frames.
        NrE   rT   rE   rE   rF   output   rV   zBaseTransport.output)r;   r<   r=   r>   r   rC   rL   r   r   rU   rW   __classcell__rE   rE   rP   rF   rG      s     	rG   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   rG   rE   rE   rE   rF   <module>   s    