Ë
    Aôj1  ã                   ó  — d dl Z d dlmZmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZmZ d dlmZ d dlmZmZ d d	lmZmZ e j*                  d
ede j.                  fd„«       Ze j2                  e j4                   G d„ de«      «       «       Zy)é    N)ÚCodecContextÚwrap_codec_context)ÚStreamContainer)Ú
Dictionary)ÚPacket)ÚStreamÚwrap_stream)Úavdict_to_dict)Úint64_tÚuint8_t)ÚfreeÚmallocÚselfÚreturnc                 ó  — t        «       | _        t        j                  5  | j                  dz  rGt
        j                  t        j                  | j                  «      «       | xj                  dz  c_        d d d «       y # 1 sw Y   y xY w)Né   éýÿÿÿ)	r   ÚstreamsÚcythonÚnogilÚ_myflagÚlibÚavformat_close_inputÚaddressÚptr©r   s    úc/var/www/html/academy/tools/voices/clone/fw-venv/lib/python3.12/site-packages/av/container/input.pyÚclose_inputr      s]   € ä"Ó$€D„LÜ	�‰ñ Ø�<‰<˜!Òä×$Ñ$¤V§^¡^°D·H±HÓ%=Ô>Ø�LŠL˜BÑ�L÷	÷ ñ ús    AB Â B	c                   ó8  — e Zd Zd„ Zd„ Zed„ «       Zed„ «       Zed„ «       Zed„ «       Z	ed„ «       Z
d„ Zd	„ Zd
„ Zddddddœdej                  dej                  dedz  dej                  dej                  f
d„Zej$                  dej&                  fd„«       Zy)ÚInputContainerc           	      ó¢  — t         j                  }| j                  j                  }| j                  �r|dkD  rÿt        | j                  «      }t        j                  t         j                  t         j                  t        j                        t        |t        j                  t         j                  «      z  «      «      }|t         j                  k(  r
t        «       ‚t        |«      D ]L  }t         j                  ||<   t        j                  t        j                   ||   «      |j                  d«       ŒN | j#                  | j$                  «       | j'                  «        t         j(                  5  t        j+                  | j                  |«      }d d d «       | j#                  d «       |rFt        |«      D ]-  }t        j-                  t        j                   ||   «      «       Œ/ t/        |«       | j1                  «       d}t3        «       | _        t        | j                  j                  «      D �]6  }| j                  j4                  |   }	t        j7                  |	j8                  j:                  «      }
|
rÇt        j=                  |
«      }|t         j                  k(  r
t        «       ‚t        j?                  ||	j8                  «      }|dk  r9t        jA                  t        j                   |«      «       | j1                  |«       |	jB                  |_"        tG        ||
| jH                  «      }|jJ                  rd}nd }| j4                  jM                  tO        | |	|«      «       �Œ9 | jH                  r#| jH                  jP                  s|stS        d«      ‚tU        | j                  jV                  «      | _,        y # 1 sw Y   �Œ2xY w)Nr   FTzAHardware accelerated decode requested but no stream is compatible)-r   ÚNULLr   Ú
nb_streamsÚoptionsr   ÚcastÚpointerr   ÚAVDictionaryr   ÚsizeofÚp_voidÚMemoryErrorÚrangeÚav_dict_copyr   Úset_timeoutÚopen_timeoutÚstart_timeoutr   Úavformat_find_stream_infoÚav_dict_freer   Ú	err_checkr   r   Úavcodec_find_decoderÚcodecparÚcodec_idÚavcodec_alloc_context3Úavcodec_parameters_to_contextÚavcodec_free_contextÚ	time_baseÚpkt_timebaser   ÚhwaccelÚ
is_hwaccelÚ
add_streamr	   Úallow_software_fallbackÚRuntimeErrorr
   ÚmetadataÚ	_metadata)r   ÚargsÚkwargsÚ	c_optionsÚnb_streams_beforeÚ	base_dictÚiÚretÚ at_least_one_accelerated_contextÚstreamÚcodecÚcodec_contextÚpy_codec_contexts                r   Ú	__cinit__zInputContainer.__cinit__   sé  € ô GMÇkÁkˆ	à)-¯©×)<Ñ)<ÐØ�<‹<Ð-°Ò1Ü" 4§<¡<Ó0ˆIÜŸ™Ü—‘œvŸ~™~¬c×.>Ñ.>Ñ?Ñ@ÜÐ(¬6¯=©=¼¿¹Ó+GÑGÓHóˆIð œFŸK™KÒ'Ü!“mÐ#ÜÐ,Ó-ò Q�Ü%Ÿ{™{�	˜!‘Ü× Ñ ¤§¡°	¸!±Ó!=¸y¿}¹}ÈaÕPðQð 	×Ñ˜×*Ñ*Ô+Ø×ÑÔÜ�\‰\ñ 	EÜ×/Ñ/°·±¸)ÓDˆC÷	Eà×Ñ˜ÔáÜÐ,Ó-ò ?�Ü× Ñ ¤§¡°	¸!±Ó!=Õ>ð?ä�ŒOà�‰�sÔà+0Ð(ä&Ó(ˆŒÜ�t—x‘x×*Ñ*Ó+ó 	QˆAØ—X‘X×%Ñ% aÑ(ˆFÜ×,Ñ,¨V¯_©_×-EÑ-EÓFˆEÙÜ #× :Ñ :¸5Ó A�Ø ¤F§K¡KÒ/Ü%›-Ð'Ü×7Ñ7¸ÀvÇÁÓW�Ø˜’7Ü×,Ñ,¬V¯^©^¸MÓ-JÔKØ—N‘N 3Ô'Ø-3×-=Ñ-=�Ô*Ü#5Ø! 5¨$¯,©,ó$Ð ð $×.Ò.Ø7;Ñ4ð $(Ð Ø�L‰L×#Ñ#¤K°°fÐ>NÓ$OÖPð)	Qð. �LŠLØ—L‘L×8Ò8Ù4äØSóð ô (¨¯©×(9Ñ(9Ó:ˆ�÷[	Eñ 	Eús   Å3!OÏOc                 ó   — t        | «       y ©N©r   r   s    r   Ú__dealloc__zInputContainer.__dealloc__d   ó
   € Ü�DÕó    c                 óž   — | j                  «        | j                  j                  t        j                  k7  r| j                  j                  S y rP   )Ú_assert_openr   Ú
start_timer   ÚAV_NOPTS_VALUEr   s    r   rW   zInputContainer.start_timeg   s;   € à×ÑÔØ�8‰8×Ñ¤#×"4Ñ"4Ò4Ø—8‘8×&Ñ&Ð&ð 5rT   c                 óž   — | j                  «        | j                  j                  t        j                  k7  r| j                  j                  S y)a`  Start time of the stream in real world time, in microseconds since the
        Unix epoch, or ``None`` if unknown.

        Only a few demuxers know this; RTSP computes it from RTCP sender reports,
        which is what makes it useful for aligning analytics with a camera's clock.

        Wraps :ffmpeg:`AVFormatContext.start_time_realtime`.
        N)rV   r   Ústart_time_realtimer   rX   r   s    r   rZ   z"InputContainer.start_time_realtimem   s=   € ð 	×ÑÔØ�8‰8×'Ñ'¬3×+=Ñ+=Ò=Ø—8‘8×/Ñ/Ð/ð >rT   c                 óž   — | j                  «        | j                  j                  t        j                  k7  r| j                  j                  S y rP   )rV   r   Údurationr   rX   r   s    r   r\   zInputContainer.duration{   s;   € à×ÑÔØ�8‰8×Ñ¤× 2Ñ 2Ò2Ø—8‘8×$Ñ$Ð$ð 3rT   c                 óN   — | j                  «        | j                  j                  S rP   )rV   r   Úbit_rater   s    r   r^   zInputContainer.bit_rate�   s   € à×ÑÔØ�x‰x× Ñ Ð rT   c                 ó„   — | j                  «        t        j                  | j                  j                  «      }|dk\  r|S y)zåSize of the input in bytes, or ``None`` if it cannot be determined.

        A non-seekable input, such as a pipe or a file-like object without
        ``seek``, has no size to report.

        Wraps :ffmpeg:`avio_size`.
        r   N)rV   r   Ú	avio_sizer   Úpb)r   Úsizes     r   rb   zInputContainer.size†   s7   € ð 	×ÑÔÜŸ™ d§h¡h§k¡kÓ2ˆØ�1Š9ØˆKð rT   c                 ó   — t        | «       y rP   rQ   r   s    r   ÚclosezInputContainer.close”   rS   rT   c           	   /   óT  K  — | j                  «         | j                  j                  |i |¤Ž}| j                  j                  }|dk(  ryt        j                  t
        j                  t           t        |t        j                  t        «      z  «      «      }|t
        j                  k(  r
t        «       ‚| j                  | j                  «       	 t        |«      D ]  }d||<   Œ	 |D ]'  }|j                   }||k\  rt#        d|› d�«      ‚d||<   Œ) t
        j$                  5  t&        j)                  «       }ddd«       t
        j                  k(  rt        d«      ‚	 t
        j$                  5  t&        j+                  |«       ddd«       	 | j-                  «        t
        j$                  5  t&        j/                  | j                  |«      }	ddd«       | j1                  	«       |j4                  |k  rÏ||j4                     rÀ|j4                  t7        | j                  «      k  ržt9        «       }
t
        j$                  5  t&        j;                  |
j                  |«       ddd«       | j                  |
j                  j4                     |
_        |
j<                  j                  j>                  |
j                  _        |
–— �Œi# 1 sw Y   �Œ’xY w# 1 sw Y   �ŒRxY w# 1 sw Y   �ŒxY w# t2        $ r Y nw xY w# 1 sw Y   ŒœxY wt        |«      D ]Y  }||   sŒ	t9        «       }
| j                  |   |
_        |
j<                  j                  j>                  |
j                  _        |
–— Œ[ 	 | j                  d«       tA        |«       |t
        j                  k7  r)t&        jC                  t        jD                  |«      «       yy# | j                  d«       tA        |«       t
        j                  k7  r)t&        jC                  t        jD                  |«      «       w w xY w­w)a0  demux(streams=None, video=None, audio=None, subtitles=None, data=None)

        Yields a series of :class:`.Packet` from the given set of :class:`.Stream`::

            for packet in container.demux():
                # Do something with `packet`, often:
                for frame in packet.decode():
                    # Do something with `frame`.

        .. seealso:: :meth:`.StreamContainer.get` for the interpretation of
            the arguments.

        .. note:: The last packets are dummy packets that when decoded will flush the buffers.

        r   Nzstream index z out of rangeé   zCould not allocate packet)#rV   r   Úgetr   r#   r   r%   r&   r   r   r(   r"   r*   r-   Úread_timeoutr+   ÚindexÚ
ValueErrorr   r   Úav_packet_allocÚav_packet_unrefr/   Úav_read_framer2   ÚEOFErrorÚstream_indexÚlenr   Úav_packet_move_refÚ_streamr9   r   Úav_packet_freer   )r   rB   rC   r   r#   Úinclude_streamrG   rJ   Úread_packetrH   Úpackets              r   ÚdemuxzInputContainer.demux—   sd  è ø€ ð  	×ÑÔà 0 §¡× 0Ñ 0°$Ð A¸&Ñ AˆØ"&§(¡(×"5Ñ"5ˆ
Ø˜Š?ØÜ28·+±+Ü�N‰Nœ7Ñ#Ü�:¤§¡¬gÓ 6Ñ6Ó7ó3
ˆð œVŸ[™[Ò(Ü“-Ðð 	×Ñ˜×*Ñ*Ô+ð:	@Ü˜:Ó&ò &�Ø$%�˜qÒ!ð&à!ò &�Ø—L‘L�Ø˜
’?Ü$ }°Q°C°}Ð%EÓFÐFØ$%�˜qÒ!ð	&ô —‘ñ 4Ü!×1Ñ1Ó3�÷4àœfŸk™kÒ)Ü!Ð"=Ó>Ð>àä—\‘\ñ 5Ü×'Ñ'¨Ô4÷5ðØ×&Ñ&Ô(ÜŸ™ñ GÜ!×/Ñ/°·±¸+ÓF˜÷Gà—N‘N 3Ô'ð  ×,Ñ,¨zÒ9Ø& {×'?Ñ'?Ò@à"×/Ñ/´#°d·l±lÓ2CÒCô "(£˜Ü#Ÿ\™\ñ LÜ×2Ñ2°6·:±:¸{ÔK÷Là)-¯©°f·j±j×6MÑ6MÑ)N˜œà/5¯~©~×/AÑ/A×/KÑ/K˜Ÿ
™
Ô,Ø$šñ; ÷4ñ 4ú÷5ñ 5ú÷Gñ Gûô  ò Ùðú÷Lð Lúô ˜:Ó&ò !�Ø! !Ó$Ü#›X�FØ%)§\¡\°!¡_�F”NØ+1¯>©>×+=Ñ+=×+GÑ+G�F—J‘JÔ(Ø “Lñ!ð ×Ñ˜TÔ"Ü�Ô ØœfŸk™kÒ)Ü×"Ñ"¤6§>¡>°+Ó#>Õ?ð *øð ×Ñ˜TÔ"Ü�Ô ØœfŸk™kÒ)Ü×"Ñ"¤6§>¡>°+Ó#>Õ?ð *üs®   ‚CP(ÃAO Ä#KÄ87O Å/KÆO Æ K/ Æ.!K"ÇK/ Ç(AO É!K>É#A%O ËKËO ËKËO Ë"K,Ë'K/ Ë/	K;Ë8O Ë:K;Ë;O Ë>LÌO ÌAO Í2AP(ÏAP%Ð%P(c              /   óŽ   K  — | j                  «         | j                  |i |¤ŽD ]  }|j                  «       E d{  –—†  Œ y7 Œ­w)a`  decode(streams=None, video=None, audio=None, subtitles=None, data=None)

        Yields a series of :class:`.Frame` from the given set of streams::

            for frame in container.decode():
                # Do something with `frame`.

        .. seealso:: :meth:`.StreamContainer.get` for the interpretation of
            the arguments.

        N)rV   rw   Údecode)r   rB   rC   rv   s       r   ry   zInputContainer.decodeö   sE   è ø€ ð 	×ÑÔØ �d—j‘j $Ð1¨&Ñ1ò 	'ˆFØ—}‘}“×&Ñ&ñ	'Ø&ús   ‚9A»A¼ATFN)ÚbackwardÚ	any_framerJ   Úunsupported_frame_offsetÚunsupported_byte_offsetrz   r{   rJ   r|   r}   c                ó  — | j                  «        t        |t        «      st        dt	        |«      «      ‚|}d}|r|t
        j                  z  }|r|t
        j                  z  }|r|t
        j                  z  }|r|t
        j                  z  }|r|j                  nd}	t        j                  5  t
        j                  | j                  |	||«      }
ddd«       | j                  
«       | j!                  «        y# 1 sw Y   Œ+xY w)a)  seek(offset, *, backward=True, any_frame=False, stream=None)

        Seek to a (key)frame nearest to the given timestamp.

        :param int offset: Time to seek to, expressed in``stream.time_base`` if ``stream``
            is given, otherwise in :data:`av.time_base`.
        :param bool backward: If there is not a (key)frame at the given offset,
            look backwards for it.
        :param bool any_frame: Seek to any frame, not just a keyframe.
        :param Stream stream: The stream who's ``time_base`` the ``offset`` is in.

        :param bool unsupported_frame_offset: ``offset`` is a frame
            index instead of a time; not supported by any known format.
        :param bool unsupported_byte_offset: ``offset`` is a byte
            location in the file; not supported by any known format.

        After seeking, packets that you demux should correspond (roughly) to
        the position you requested.

        In most cases, the defaults of ``backwards = True`` and ``any_frame = False``
        are the best course of action, followed by you demuxing/decoding to
        the position that you want. This is because to properly decode video frames
        you need to start from the previous keyframe.

        .. seealso:: :ffmpeg:`avformat_seek_file` for discussion of the flags.

        z+Container.seek only accepts integer offset.r   éÿÿÿÿN)rV   Ú
isinstanceÚintÚ	TypeErrorÚtyper   ÚAVSEEK_FLAG_BACKWARDÚAVSEEK_FLAG_ANYÚAVSEEK_FLAG_FRAMEÚAVSEEK_FLAG_BYTEri   r   r   Úav_seek_framer   r2   Úflush_buffers)r   Úoffsetrz   r{   rJ   r|   r}   Úc_offsetÚflagsro   rH   s              r   ÚseekzInputContainer.seek  sç   € ðJ 	×ÑÔä˜&¤#Ô&ÜÐIÌ4ÐPVË<ÓXÐXà"ˆØˆñ Ø”S×-Ñ-Ñ-ˆEÙØ”S×(Ñ(Ñ(ˆEñ $Ø”S×*Ñ*Ñ*ˆEÙ"Ø”S×)Ñ)Ñ)ˆEá39 6§<¢<¸rˆÜ�\‰\ñ 	MÜ×#Ñ# D§H¡H¨l¸HÀeÓLˆC÷	Mà�‰�sÔà×ÑÕ÷		Mð 	Mús   Â.#C;Ã;Dr   c                 ó„   — | j                  «        | j                  D ]!  }|j                  }|sŒ|j                  «        Œ# y rP   )rV   r   rL   r‰   )r   rJ   rL   s      r   r‰   zInputContainer.flush_buffersF  s=   € à×ÑÔð
 —l‘lò 	.ˆFØ"×0Ñ0ˆMÚØ×+Ñ+Õ-ñ	.rT   )Ú__name__Ú
__module__Ú__qualname__rN   rR   ÚpropertyrW   rZ   r\   r^   rb   rd   rw   ry   r   Úbintr   r�   ÚcfuncÚvoidr‰   © rT   r   r    r       s  „ òI;òVð ñ'ó ð'ð
 ñ0ó ð0ð ñ%ó ð%ð
 ñ!ó ð!ð ñó ðòò]@ò~'ð( !%Ø!&Ø $Ø05Ø/4ò>ð —+‘+ð	>ð
 —;‘;ð>ð ˜‘ð>ð #)§+¡+ð>ð "(§¡ó>ð@ ‡\�\ð	.˜vŸ{™{ò 	.ó ñ	.rT   r    )r   Ú cython.cimports.av.codec.contextr   r   Ú$cython.cimports.av.container.streamsr   Úcython.cimports.av.dictionaryr   Úcython.cimports.av.packetr   Úcython.cimports.av.streamr   r	   Úcython.cimports.av.utilsr
   Úcython.cimports.libc.stdintr   r   Úcython.cimports.libc.stdlibr   r   r”   r    r•   r   ÚfinalÚcclassÚ	Containerr–   rT   r   ú<module>r¢      sx   ðÛ ß MÝ @Ý 4Ý ,ß 9Ý 3ß 8ß 4ð ‡�ð�nð ¨¯©ò ó ðð ‡�Ø‡�ôx.�Yó x.ó ó ñx.rT   