o
    prj                     @   s   d dl Z d dlZd dlmZ eddG dd dZe Zdedefd	d
ZdddededefddZ	dede
fddZde
defddZdS )    N)	dataclassT)frozenc                   @   s>   e Zd ZU dZeed< dZeed< dZeed< dZ	eed< d	S )
McubeAudioSpeczaudio/x-mulawencodingi>  sample_rate   sample_width_bytes   num_channelsN)
__name__
__module____qualname__r   str__annotations__r   intr   r
    r   r   V/var/www/html/livekitdocker/backend/agent_runtime/src/mcube_integration/mcube_codec.pyr      s
   
 r   pcm16_bytesreturnc                 C   s   t | tjS )z.PCM16 (linear signed int16 LE) -> mulaw bytes.)audiooplin2ulawMCUBE_AUDIO_SPECr   )r   r   r   r   pcm16_to_mulaw   s   r   r   )width_bytesmulaw_bytesr   c                C   s   t | |S )z.mulaw bytes -> PCM16 (linear signed int16 LE).)r   ulaw2lin)r   r   r   r   r   mulaw_to_pcm16   s   r   rawc                 C   s   t | dS )Nascii)base64	b64encodedecode)r   r   r   r   to_base64_bytes   s   r"   b64c                 C   s
   t | S )N)r   	b64decode)r#   r   r   r   from_base64_str!   s   
r%   )r   r   dataclassesr   r   r   bytesr   r   r   r   r"   r%   r   r   r   r   <module>   s    