Ë
    ÛÍ:j   ã                   ót   — d dl Z d dlmZ d dlmZ e j
                  e j                   G d„ d«      «       «       Zy)é    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y)Ú	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�}|S # t        $ r+ d| j                   j                  › dt        | «      d›d�}Y |S w xY w)	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     úb/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/av/audio/fifo.pyÚ__repr__zAudioFifo.__repr__   s­   € ð		à�t—~‘~×.Ñ.Ð/¨q°·±°¸lØ×#Ñ#Ð$ C¨¯© }°A°d·k±k°]À&ÌÈDËÐRSÈÐTUðWð ð ˆøô ò 	à�t—~‘~×.Ñ.Ð/ð 0Ü˜D› !˜ Að'ñ ð ˆð	ús   ‚AA Á0BÂBc                 ó\   — | j                   r t        j                  | j                   «       y y )N)ÚptrÚlibÚav_audio_fifo_free©r   s    r   Ú__dealloc__zAudioFifo.__dealloc__   s    € Ø�8Š8Ü×"Ñ" 4§8¡8Õ,ð ó    ÚframeNc           	      óR  — |€t        d«      ‚|j                  j                  sy| j                  �sqt        «       | _        | j                  j                  |«       | j                  j                  «        |j                  j                  r{|j                  j                  re|j                  j                  t        |j                  j                  «      z  | _        | xj                  |j                  j                  z  c_        nd| _        t        j                  t        j                   t        j"                  |j                  j$                  «      |j&                  j(                  |j                  j                  dz  «      | _        | j                  �s(t+        d«      ‚|j                  j$                  | j                  j                  j$                  k7  sÛ|j                  j                  | j                  j                  j                  k7  s¤|j                  j                  r™| j                  j                  j                  ry|j                  j                  | j                  j                  j                  k7  s7|j                  j                  | j                  j                  j                  k7  rt-        d«      ‚t        j.                  t0        «      }| j                  r•|j                  j2                  t        j4                  k7  rnt        j                   t0        | j                  | j6                  z  «      }|j                  j2                  |k7  r$t-        d|j                  j2                  |fz  «      ‚t9        t        j;                  | j                  t        j                   t        j<                  t        j>                     |j                  j@                  «      |j                  j                  «      «       | xj6                  |j                  j                  z  c_        y)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.z4Frame.pts (%d) != expected (%d); 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à�y‰y×#Ò#Øà�x‹xô .Ó/ˆDŒMØ�M‰M×3Ñ3°EÔ:Ø�M‰M×/Ñ/Ô1ð ×Ñ×#Ò#¨¯	©	×(=Ò(=Ø&+×&6Ñ&6×&:Ñ&:¼UÀ5×CSÑCS×CWÑCWÓ=XÑ&X�Ô#Ø×#Ò# u§y¡y×'<Ñ'<Ñ<Ö#à&'�Ô#ä×.Ñ.Ü—‘œC×.Ñ.°·	±	×0@Ñ0@ÓAØ—‘×(Ñ(Ø—	‘	×$Ñ$ØñóˆDŒHð —8“8Ü"Ð#DÓEÐEð �I‰I×Ñ §¡× 1Ñ 1× 8Ñ 8Ò8Ø�y‰y×$Ñ$¨¯©×(9Ñ(9×(EÑ(EÒEà× Ñ ×$Ò$Ø—M‘M×,Ñ,×0Ò0à×$Ñ$×(Ñ(¨D¯M©M×,DÑ,D×,HÑ,HÒHØ×'Ñ'×+Ñ+¨t¯}©}×/GÑ/G×/KÑ/KÒKô ÐIÓJÐJô —~‘~¤gÓ.ˆØ×Ò 5§9¡9§=¡=´C×4FÑ4FÒ#FÜ!Ÿ;™;Ü˜×,Ñ,¨t×/CÑ/CÑCóˆLð �y‰y�}‰} Ò,Ü ØJØ—y‘y—}‘} lÐ3ñ4óð ô
 	Ü×#Ñ#Ø—‘Ü—‘œFŸN™N¬6¯=©=Ñ9¸5¿9¹9×;RÑ;RÓSØ—	‘	×$Ñ$óô	
ð 	×Ò §	¡	× 4Ñ 4Ñ4Ör   r   Úpartialc           	      óâ  — | j                   syt        j                  | j                   «      }|dk  ry|xs |}||k  r|r|}nyt        «       }|j	                  | j
                  «       |j                  t        j                  t        j                  | j
                  j                   j                  «      t        j                  t        j                  | j
                  j                   j                  «      |d«       t        t        j                  | j                   t        j                  t        j                  t        j                      |j                   j"                  «      |«      «       | j$                  rAt        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   se  € ð  �xŠxØä'*×'=Ñ'=¸d¿h¹hÓ'GÐØ˜aÒØàÒ-Ð-ˆà˜gÒ%ÙØ*‘àä-Ó/ˆØ×'Ñ'¨¯©Ô6Ø�‰Ü�K‰Kœ×*Ñ*¨D¯M©M×,=Ñ,=×,DÑ,DÓEÜ�K‰Kœ×+Ñ+¨T¯]©]×->Ñ->×-HÑ-HÓIØØô		
ô 	Ü×"Ñ"Ø—‘Ü—‘œFŸN™N¬6¯=©=Ñ9¸5¿9¹9×;RÑ;RÓSØóô	
ð ×ÒÜ"ŸK™KÜ˜$×-Ñ-°×0AÑ0AÑAóˆE�I‰I�Mô  ×.Ñ.ˆE�I‰IŒMà×Ò˜WÑ$ÕØˆr   c                 ó^   — g }	 | j                  ||¬«      }|�|j                  |«       n	 |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`.

        )r=   )rH   Úappend)r   r   r=   Úframesr   s        r   Ú	read_manyzAudioFifo.read_manyª   s=   € ð ˆØØ—I‘I˜g¨w�IÓ7ˆEØÐ Ø—‘˜eÕ$ààˆð r   c                 ól   — | 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Á   ó7   € ð �xŠxÜ Ø”H�:ÐIÐJóð ð �}‰}×#Ñ#Ð#r   c                 ól   — | 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                 ól   — | 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Ó   s5   € à�xŠxÜ Ø”H�:ÐNÐOóð ð �}‰}×(Ñ(Ð(r   c                 ó\   — | j                   rt        j                  | j                   «      S 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²8Œs×%Ñ% d§h¡hÓ/ÐBÀÐBr   )r   F)F)r   Ú
__module__Ú__qualname__Ú__doc__r   r   r,   ÚccallÚ
AudioFramer<   ÚintÚbintrH   rL   Úpropertyr   r   r   r   © r   r   r   r      sé   „ ñ Bòò-ð ‡\�\ðQ5˜:¨Ñ,ò Q5ó ðQ5ðf ‡\�\ñ7˜FŸJ™Jð 7°V·[±[ò 7ó ð7ðr ‡\�\ñ §¡ð °f·k±kò ó ðð, ñ$ó ð$ð ñ$ó ð$ð ñ)ó ð)ð ñ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r   