§
    ÜóÉj  ã                   ót   — d dl Z d dlmZ d dlmZ e j        e j         G d„ d¦  «        ¦   «         ¦   «         ZdS )é    N)Úalloc_audio_frame)Ú	err_checkc                   ó"  — e Zd ZdZd„ Zd„ Zej        dedz  fd„¦   «         Z	ej        dd	ej
        d
ej        fd„¦   «         Zej        dd	ej
        d
ej        fd„¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         Zed„ ¦   «         ZdS )Ú	AudioFifoz7A simple audio sample FIFO (First In First Out) buffer.c                 óî   — 	 d| j         j        › d| j        › d| j        › d| j        › d| j        › dt          | ¦  «        d›d�}n1# t          $ r$ d| j         j        › dt          | ¦  «        d›d�}Y nw xY w|S )	Nz<av.ú z samples of zhz z at 0xÚxú>z, uninitialized, use fifo.write(frame), at 0x)Ú	__class__Ú__name__ÚsamplesÚsample_rateÚlayoutÚformatÚidÚAttributeError)ÚselfÚresults     úr/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/av/audio/fifo.pyÚ__repr__zAudioFifo.__repr__   sç   € ð		ðW�t”~Ô.ð Wð W°´ð Wð WØÔ#ðWð WØ(,¬ðWð WØ6:´kðWð WÝIKÈDÉÌÐVðWð Wð Wð ˆFøõ ð 	ð 	ð 	ð'�t”~Ô.ð 'ð 'Ý˜D™œÐ&ð'ð 'ð 'ð ˆFˆFð	øøøð
 ˆs   ‚AA Á+A2Á1A2c                 óV   — | j         r!t                               | j         ¦  «         d S d S )N)ÚptrÚlibÚav_audio_fifo_free©r   s    r   Ú__dealloc__zAudioFifo.__dealloc__   s2   € ØŒ8ð 	-Ý×"Ò" 4¤8Ñ,Ô,Ð,Ð,Ð,ð	-ð 	-ó    ÚframeNc           	      ó  — |€t          d¦  «        ‚|j        j        sdS | j        �s!t          ¦   «         | _        | j                             |¦  «         | j                             ¦   «          |j        j        rR|j        j	        rF|j        j
        t          |j        j        ¦  «        z  | _        | xj        |j        j	        z  c_        nd| _        t                               t          j        t          j        |j        j        ¦  «        |j        j        |j        j        dz  ¦  «        | _        | j        st+          d¦  «        ‚n¨|j        j        | j        j        j        k    sz|j        j	        | j        j        j	        k    s[|j        j        r^| j        j        j        rM|j        j        | j        j        j        k    s|j        j
        | j        j        j
        k    rt-          d¦  «        ‚t          j        t0          ¦  «        }| j        rq|j        j        t          j        k    rWt          j        t0          | j        | j        z  ¦  «        }|j        j        |k    r t-          d|j        j        › d|› d	�¦  «        ‚t9          t                               | j        t          j        t          j        t          j                 |j        j         ¦  «        |j        j        ¦  «        ¦  «         | xj        |j        j        z  c_        dS )
aÇ  write(frame)

        Push a frame of samples into the queue.

        :param AudioFrame frame: The frame of samples to push.

        The FIFO will remember the attributes from the first frame, and use those
        to populate all output frames.

        If there is a :attr:`~.Frame.pts` and :attr:`~.Frame.time_base` and
        :attr:`~.AudioFrame.sample_rate`, then the FIFO will assert that the incoming
        timestamps are continuous.

        Nz&AudioFifo must be given an AudioFrame.r   é   zCould not allocate AVAudioFifo.z*Frame does not match AudioFifo parameters.zFrame.pts (z) != expected (z); fix or set to None.)!Ú	TypeErrorr   Ú
nb_samplesr   ÚtemplateÚ_copy_internal_attributesÚ_init_user_attributesÚ
_time_baseÚnumr   ÚdenÚfloatÚpts_per_sampler   Úav_audio_fifo_allocÚcythonÚcastÚAVSampleFormatr   r   Únb_channelsÚRuntimeErrorÚ
ValueErrorÚdeclareÚint64_tÚptsÚAV_NOPTS_VALUEÚsamples_writtenr   Úav_audio_fifo_writeÚpointerÚp_voidÚextended_data)r   r   Úexpected_ptss      r   ÚwritezAudioFifo.write   sÙ  € ð" ˆ=ÝÐDÑEÔEÐEàŒyÔ#ð 	ØˆFàŒxñ %	Kõ .Ñ/Ô/ˆDŒMØŒM×3Ò3°EÑ:Ô:Ð:ØŒM×/Ò/Ñ1Ô1Ð1ð ÔÔ#ð (¨¬	Ô(=ð (Ø&+Ô&6Ô&:½UÀ5ÔCSÔCWÑ=XÔ=XÑ&X�Ô#ØÐ#Ô# u¤yÔ'<Ñ<Ð#Ô#Ð#à&'�Ô#å×.Ò.Ý”�CÔ.°´	Ô0@ÑAÔAØ”Ô(Ø”	Ô$Øññô ˆDŒHð ”8ð FÝ"Ð#DÑEÔEÐEðFð
 ŒIÔ ¤Ô 1Ô 8Ò8Ð8ØŒyÔ$¨¬Ô(9Ô(EÒEÐEàÔ Ô$ð Fð ”MÔ,Ô0ð Fð
 Ô$Ô(¨D¬MÔ,DÔ,HÒHÐHØÔ'Ô+¨t¬}Ô/GÔ/KÒKÐKõ ÐIÑJÔJÐJõ ”~¥gÑ.Ô.ˆØÔð 	 5¤9¤=µCÔ4FÒ#FÐ#FÝ!œ;Ý˜Ô,¨tÔ/CÑCñô ˆLð ŒyŒ} Ò,Ð,Ý ð* %¤)¤-ð *ð *Àð *ð *ð *ñô ð õ
 	Ý×#Ò#Ø”Ý”�FœN­6¬=Ô9¸5¼9Ô;RÑSÔSØ”	Ô$ñô ñ	
ô 	
ð 	
ð 	ÐÔ ¤	Ô 4Ñ4ÐÔÐÐr   r   Fr   Úpartialc           	      ó@  — | j         sdS t                               | j         ¦  «        }|dk     rdS |p|}||k     r|r|}ndS t          ¦   «         }|                     | j        ¦  «         |                     t          j        t          j	        | j        j         j
        ¦  «        t          j        t          j        | j        j         j        ¦  «        |d¦  «         t          t                               | j         t          j        t          j        t          j                 |j         j        ¦  «        |¦  «        ¦  «         | j        r2t          j        t&          | j        | j        z  ¦  «        |j         _        nt          j        |j         _        | xj        |z  c_        |S )aÚ  read(samples=0, partial=False)

        Read samples from the queue.

        :param int samples: The number of samples to pull; 0 gets all.
        :param bool partial: Allow returning less than requested.
        :returns: New :class:`AudioFrame` or ``None`` (if empty).

        If the incoming frames had valid a :attr:`~.Frame.time_base`,
        :attr:`~.AudioFrame.sample_rate` and :attr:`~.Frame.pts`, the returned frames
        will have accurate timing.

        Né   )r   r   Úav_audio_fifo_sizer   r$   r#   Ú_initr,   r-   r.   r   ÚAVChannelLayoutÚ	ch_layoutr   Úav_audio_fifo_readr8   r9   r:   r*   Úuint64_tÚsamples_readr4   r5   )r   r   r=   Úbuffered_samplesr   s        r   ÚreadzAudioFifo.readp   s{  € ð  Œxð 	ØˆFå'*×'=Ò'=¸d¼hÑ'GÔ'GÐØ˜aÒÐØˆFàÐ-Ð-ˆà˜gÒ%Ð%Øð Ø*��à�å-Ñ/Ô/ˆØ×'Ò'¨¬Ñ6Ô6Ð6Ø�ŠÝŒK�Ô*¨D¬MÔ,=Ô,DÑEÔEÝŒK�Ô+¨T¬]Ô->Ô-HÑIÔIØØñ		
ô 	
ð 	
õ 	Ý×"Ò"Ø”Ý”�FœN­6¬=Ô9¸5¼9Ô;RÑSÔSØñô ñ	
ô 	
ð 	
ð Ôð 	/Ý"œKÝ˜$Ô-°Ô0AÑAñô ˆEŒIŒMˆMõ  Ô.ˆEŒIŒMàÐÔ˜WÑ$ÐÔØˆr   c                 ón   — g }	 |                       ||¬¦  «        }|�|                     |¦  «         nnŒ1|S )a  read_many(samples, partial=False)

        Read as many frames as we can.

        :param int samples: How large for the frames to be.
        :param bool partial: If we should return a partial frame.
        :returns: A ``list`` of :class:`AudioFrame`.

        T)r=   )rH   Úappend)r   r   r=   Úframesr   s        r   Ú	read_manyzAudioFifo.read_manyª   sM   € ð ˆð	Ø—I’I˜g¨w�IÑ7Ô7ˆEØÐ Ø—’˜eÑ$Ô$Ð$Ð$àð	ð ˆr   c                 óX   — | j         st          dt          › d�¦  «        ‚| j        j        S )z'The :class:`.AudioFormat` of this FIFO.ú'z,.AudioFifo' object has no attribute 'format')r   r   r   r#   r   r   s    r   r   zAudioFifo.formatÁ   ó;   € ð Œxð 	Ý ØJ•HÐJÐJÐJñô ð ð Œ}Ô#Ð#r   c                 óX   — | j         st          dt          › d�¦  «        ‚| j        j        S )z'The :class:`.AudioLayout` of this FIFO.rN   z,.AudioFifo' object has no attribute 'layout')r   r   r   r#   r   r   s    r   r   zAudioFifo.layoutÊ   rO   r   c                 óX   — | j         st          dt          › d�¦  «        ‚| j        j        S )NrN   z1.AudioFifo' object has no attribute 'sample_rate')r   r   r   r#   r   r   s    r   r   zAudioFifo.sample_rateÓ   s9   € àŒxð 	Ý ØO•HÐOÐOÐOñô ð ð Œ}Ô(Ð(r   c                 óR   — | j         rt                               | j         ¦  «        ndS )z4Number of audio samples (per channel) in the buffer.r   )r   r   r@   r   s    r   r   zAudioFifo.samplesÛ   s&   € ð 48´8ÐB�s×%Ò% d¤hÑ/Ô/Ð/ÀÐBr   )r   F)F)r   Ú
__module__Ú__qualname__Ú__doc__r   r   r,   ÚccallÚ
AudioFramer<   ÚintÚbintrH   rL   Úpropertyr   r   r   r   © r   r   r   r      sS  € € € € € ð BÐAðð ð ð-ð -ð -ð „\ðQ5˜:¨Ñ,ð Q5ð Q5ð Q5ñ „\ðQ5ðf „\ð7ð 7˜FœJð 7°V´[ð 7ð 7ð 7ñ „\ð7ðr „\ðð  ¤ð °f´kð ð ð ñ „\ðð, ð$ð $ñ „Xð$ð ð$ð $ñ „Xð$ð ð)ð )ñ „Xð)ð ðCð Cñ „XðCð Cð Cr   r   )r,   Úcython.cimports.av.audio.framer   Úcython.cimports.av.errorr   ÚfinalÚcclassr   r[   r   r   ú<module>r`      s’   ðØ €€€Ø <Ð <Ð <Ð <Ð <Ð <Ø .Ð .Ð .Ð .Ð .Ð .ð „Ø„ðVCð VCð VCð VCð VCñ VCô VCñ „ñ „ðVCð VCð VCr   