§
    ÜóÉ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 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fd„¦   «         Ze j        e j         G d„ de¦  «        ¦   «         ¦   «         ZdS )é    N)ÚCodecContextÚwrap_codec_context)ÚStreamContainer)Ú
Dictionary)Ú	err_check)ÚPacket)ÚStreamÚwrap_stream)Úavdict_to_dict)Úint64_tÚuint8_t)ÚfreeÚmallocÚselfc                 ó  — t          ¦   «         | _        t          j        5  | j        dz  rAt
                               t          j        | j        ¦  «        ¦  «         | xj        dz  c_        d d d ¦  «         d S # 1 swxY w Y   d S )Né   éýÿÿÿ)	r   ÚstreamsÚcythonÚnogilÚ_myflagÚlibÚavformat_close_inputÚaddressÚptr©r   s    úw/home/lighthouse/badge-speaker-benchmark/.benchmark-venv-community/lib64/python3.11/site-packages/av/container/input.pyÚclose_inputr      sº   € å"Ñ$Ô$€D„LÝ	Œð ð ØŒ<˜!Ñð 	å×$Ò$¥V¤^°D´HÑ%=Ô%=Ñ>Ô>Ð>ØˆLŒL˜BÑˆLŒLð	ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð s    AA9Á9A=Â A=c                   ó  — 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„ ¦   «         ZdS )ÚInputContainerc           	      óò  — t           j        }| j        j        }| j        r|dk    rt          d¦  «        ‚| j        s| j        �rm|dk    �rft          | j        ¦  «        }t          j        t           j	        t           j	        t          j                          t          |t          j        t           j        ¦  «        z  ¦  «        ¦  «        }t          |¦  «        D ]×}t           j        ||<   |t!          | j        ¦  «        k     ru| j        rn|                     ¦   «         }|                     | j        |         ¦  «         t                               t          j        ||         ¦  «        |j        d¦  «         Œžt                               t          j        ||         ¦  «        |j        d¦  «         ŒØ|                      | j        ¦  «         |                      ¦   «          t           j        5  t                               | j        |¦  «        }d d d ¦  «         n# 1 swxY w Y   |                      d ¦  «         |                      |¦  «         |rSt          |¦  «        D ]4}t                               t          j        ||         ¦  «        ¦  «         Œ5t9          |¦  «         d}	t;          ¦   «         | _        t          | j        j        ¦  «        D ]Ø}| j        j        |         }
t                               |
j         j!        ¦  «        }|rst           "                    |¦  «        }t5          t           #                    ||
j         ¦  «        ¦  «         |
j$        |_%        tM          ||| j'        ¦  «        }|j(        rd}	nd }| j         )                    tU          | |
|¦  «        ¦  «         ŒÙ| j'        r| j'        j+        s|	stY          d¦  «        ‚t[          | j        j.        | j/        | j0        ¦  «        | _1        d S )Nr   z�stream_options were provided, but this format does not expose its streams before avformat_find_stream_info (e.g. MPEG). Per-stream options cannot be applied.FTzAHardware accelerated decode requested but no stream is compatible)2r   ÚNULLr   Ú
nb_streamsÚstream_optionsÚ
ValueErrorÚoptionsr   ÚcastÚpointerr   ÚAVDictionaryr   ÚsizeofÚp_voidÚrangeÚlenÚcopyÚupdateÚav_dict_copyr   Úset_timeoutÚopen_timeoutÚstart_timeoutr   Úavformat_find_stream_infor   Úav_dict_freer   r   r   Úavcodec_find_decoderÚcodecparÚcodec_idÚavcodec_alloc_context3Úavcodec_parameters_to_contextÚ	time_baseÚpkt_timebaser   ÚhwaccelÚ
is_hwaccelÚ
add_streamr
   Úallow_software_fallbackÚRuntimeErrorr   ÚmetadataÚmetadata_encodingÚmetadata_errorsÚ	_metadata)r   ÚargsÚkwargsÚ	c_optionsÚnb_streams_beforeÚ	base_dictÚiÚstream_dictÚretÚ at_least_one_accelerated_contextÚstreamÚcodecÚcodec_contextÚpy_codec_contexts                 r   Ú	__cinit__zInputContainer.__cinit__   s  € õ GMÄkˆ	ð *.¬Ô)<ÐØÔð 	Ð#4¸Ò#9Ð#9Ýð8ñô ð ð ŒLð 	U˜DÔ/ñ 	UÐ5FÈÒ5JÑ5JÝ" 4¤<Ñ0Ô0ˆIÝœÝ”�vœ~­cÔ.>Ô?Ô@ÝÐ(­6¬=½¼Ñ+GÔ+GÑGÑHÔHñô ˆIõ Ð,Ñ-Ô-ð Uð U�Ý%œ{�	˜!‘Ø•s˜4Ô.Ñ/Ô/Ò/Ð/°DÔ4GÐ/Ø"+§.¢.Ñ"2Ô"2�KØ×&Ò& tÔ':¸1Ô'=Ñ>Ô>Ð>Ý×$Ò$¥V¤^°I¸a´LÑ%AÔ%AÀ;Ä?ÐTUÑVÔVÐVÐVå×$Ò$¥V¤^°I¸a´LÑ%AÔ%AÀ9Ä=ÐRSÑTÔTÐTÐTà×Ò˜Ô*Ñ+Ô+Ð+Ø×ÒÑÔÐÝŒ\ð 	Eð 	EÝ×/Ò/°´¸)ÑDÔDˆCð	Eð 	Eð 	Eñ 	Eô 	Eð 	Eð 	Eð 	Eð 	Eð 	Eð 	Eøøøð 	Eð 	Eð 	Eð 	Eà×Ò˜ÑÔÐØ�Š�sÑÔÐàð 	ÝÐ,Ñ-Ô-ð ?ð ?�Ý× Ò ¥¤°	¸!´Ñ!=Ô!=Ñ>Ô>Ð>Ð>Ý�‰OŒOˆOà+0Ð(å&Ñ(Ô(ˆŒÝ�t”xÔ*Ñ+Ô+ð 	Qð 	QˆAØ”XÔ% aÔ(ˆFÝ×,Ò,¨V¬_Ô-EÑFÔFˆEØð (Ý #× :Ò :¸5Ñ AÔ A�ÝÝ×5Ò5°mÀVÄ_ÑUÔUñô ð ð .4Ô-=�Ô*Ý#5Ø! 5¨$¬,ñ$ô $Ð ð $Ô.ð <Ø7;Ð4øð $(Ð ØŒL×#Ò#¥K°°fÐ>NÑ$OÔ$OÑPÔPÐPÐPð ŒLð	à”LÔ8ð	ð 5ð	õ
 ØSñô ð õ (ØŒHÔ˜tÔ5°tÔ7Kñ
ô 
ˆŒˆˆs   Ç+!HÈHÈHc                 ó$   — t          | ¦  «         d S ©N©r   r   s    r   Ú__dealloc__zInputContainer.__dealloc__l   ó   € Ý�DÑÔÐÐÐó    c                 óz   — |                       ¦   «          | j        j        t          j        k    r| j        j        S d S rU   )Ú_assert_openr   Ú
start_timer   ÚAV_NOPTS_VALUEr   s    r   r\   zInputContainer.start_timeo   s:   € à×ÒÑÔÐØŒ8Ô¥#Ô"4Ò4Ð4Ø”8Ô&Ð&ð 5Ð4rY   c                 óz   — |                       ¦   «          | j        j        t          j        k    r| j        j        S dS )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)r[   r   Ústart_time_realtimer   r]   r   s    r   r_   z"InputContainer.start_time_realtimeu   s<   € ð 	×ÒÑÔÐØŒ8Ô'­3Ô+=Ò=Ð=Ø”8Ô/Ð/ð >Ð=rY   c                 óz   — |                       ¦   «          | j        j        t          j        k    r| j        j        S d S rU   )r[   r   Údurationr   r]   r   s    r   ra   zInputContainer.durationƒ   s:   € à×ÒÑÔÐØŒ8Ô¥Ô 2Ò2Ð2Ø”8Ô$Ð$ð 3Ð2rY   c                 óB   — |                       ¦   «          | j        j        S rU   )r[   r   Úbit_rater   s    r   rc   zInputContainer.bit_rate‰   s   € à×ÒÑÔÐØŒxÔ Ð rY   c                 ór   — |                       ¦   «          t                               | j        j        ¦  «        S rU   )r[   r   Ú	avio_sizer   Úpbr   s    r   ÚsizezInputContainer.sizeŽ   s*   € à×ÒÑÔÐÝ�}Š}˜TœXœ[Ñ)Ô)Ð)rY   c                 ó$   — t          | ¦  «         d S rU   rV   r   s    r   ÚclosezInputContainer.close“   rX   rY   c           	   /   óJ  K  — |                       ¦   «           | j        j        |i |¤Ž}| j        j        dk    rdS t          j        t
          j        t                   t          | j        j        t          j
        t          ¦  «        z  ¦  «        ¦  «        }|t
          j        k    rt          ¦   «         ‚|                      | j        ¦  «         	 t          | j        j        ¦  «        D ]}d||<   Œ|D ]1}|j        }|| j        j        k    rt#          d|› d�¦  «        ‚d||<   Œ2t
          j        5  t&                               ¦   «         }ddd¦  «         n# 1 swxY w Y   |t
          j        k    rt          d¦  «        ‚	 t
          j        5  t&                               |¦  «         ddd¦  «         n# 1 swxY w Y   	 |                      ¦   «          t
          j        5  t&                               | j        |¦  «        }ddd¦  «         n# 1 swxY w Y   |                      |¦  «         n# t2          $ r Y n½w xY w||j                 rª|j        t7          | j        ¦  «        k     r�t9          ¦   «         }	t
          j        5  t&                               |	j        |¦  «         ddd¦  «         n# 1 swxY w Y   | j        |	j        j                 |	_        |	j        j        j        |	j        _        |	V — �Œvt          | j        j        ¦  «        D ]I}||         r?t9          ¦   «         }	| j        |         |	_        |	j        j        j        |	j        _        |	V — ŒJ	 |                      d¦  «         tA          |¦  «         |t
          j        k    r.t&           !                    t          j"        |¦  «        ¦  «         dS dS # |                      d¦  «         tA          |¦  «         |t
          j        k    r-t&           !                    t          j"        |¦  «        ¦  «         w w xY 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)#r[   r   Úgetr   r#   r   r'   r(   r   r   r*   r"   ÚMemoryErrorr1   Úread_timeoutr,   Úindexr%   r   r   Úav_packet_allocÚav_packet_unrefr3   Úav_read_framer   ÚEOFErrorÚstream_indexr-   r   Úav_packet_move_refÚ_streamr;   r   Úav_packet_freer   )
r   rF   rG   r   Úinclude_streamrK   rO   Úread_packetrM   Úpackets
             r   ÚdemuxzInputContainer.demux–   s  è è € ð  	×ÒÑÔÐà 0 ¤Ô 0°$Ð A¸&Ð AÐ AˆØŒ8Ô !Ò#Ð#ØˆFÝ28´+ÝŒN�7Ô#Ý�4”8Ô&­¬µwÑ)?Ô)?Ñ?Ñ@Ô@ñ3
ô 3
ˆð �Vœ[Ò(Ð(Ý‘-”-Ðð 	×Ò˜Ô*Ñ+Ô+Ð+ð7	@Ý˜4œ8Ô.Ñ/Ô/ð &ð &�Ø$%�˜qÑ!Ð!Ø!ð &ð &�Ø”L�Ø˜œÔ+Ò+Ð+Ý$Ð%E°QÐ%EÐ%EÐ%EÑFÔFÐFØ$%�˜qÑ!Ð!õ ”ð 4ð 4Ý!×1Ò1Ñ3Ô3�ð4ð 4ð 4ñ 4ô 4ð 4ð 4ð 4ð 4ð 4ð 4øøøð 4ð 4ð 4ð 4à�fœkÒ)Ð)Ý!Ð"=Ñ>Ô>Ð>ð%å”\ð 5ð 5Ý×'Ò'¨Ñ4Ô4Ð4ð5ð 5ð 5ñ 5ô 5ð 5ð 5ð 5ð 5ð 5ð 5øøøð 5ð 5ð 5ð 5ðØ×&Ò&Ñ(Ô(Ð(Ýœð Gð GÝ!×/Ò/°´¸+ÑFÔF˜ðGð Gð Gñ Gô Gð Gð Gð Gð Gð Gð Gøøøð Gð Gð Gð Gà—N’N 3Ñ'Ô'Ð'Ð'øÝð ð ð Ø�Eðøøøð " +Ô":Ô;ð %ð
 #Ô/µ#°d´lÑ2CÔ2CÒCÐCõ "(¡¤˜Ý#œ\ð Lð LÝ×2Ò2°6´:¸{ÑKÔKÐKðLð Lð Lñ Lô Lð Lð Lð Lð Lð Lð Løøøð Lð Lð Lð Là)-¬°f´jÔ6MÔ)N˜œà/5¬~Ô/AÔ/K˜œ
Ô,Ø$˜˜˜ñ5%õ: ˜4œ8Ô.Ñ/Ô/ð !ð !�Ø! !Ô$ð !Ý#™XœX�FØ%)¤\°!¤_�F”NØ+1¬>Ô+=Ô+G�F”JÔ(Ø �L�L�Løð!ð ×Ò˜TÑ"Ô"Ð"Ý�Ñ Ô Ð Ø�fœkÒ)Ð)Ý×"Ò"¥6¤>°+Ñ#>Ô#>Ñ?Ô?Ð?Ð?Ð?ð *Ð)øð ×Ò˜TÑ"Ô"Ð"Ý�Ñ Ô Ð Ø�fœkÒ)Ð)Ý×"Ò"¥6¤>°+Ñ#>Ô#>Ñ?Ô?Ð?Ð?ð *øøøsÄ   ÃA!N? Ä0EÅ
N? ÅEÅN? ÅEÅ/N? ÆF4Æ(N? Æ4F8Æ8N? Æ;F8Æ<N? Ç  H. Ç !HÈH. ÈHÈH. ÈHÈH. È-N? È.
H;È8N? È:H;È;AN? Ê!J/Ê#N? Ê/J3Ê3N? Ê6J3Ê7B#N? Î?A#P"c              /   ó†   K  — |                       ¦   «           | j        |i |¤ŽD ]}|                     ¦   «         E d{V —† ŒdS )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)r[   r{   Údecode)r   rF   rG   rz   s       r   r}   zInputContainer.decodeñ   sg   è è € ð 	×ÒÑÔÐØ �d”j $Ð1¨&Ð1Ð1ð 	'ð 	'ˆFØ—}’}‘”Ð&Ð&Ð&Ð&Ð&Ð&Ð&Ð&ð	'ð 	'rY   TFN)ÚbackwardÚ	any_framerO   Úunsupported_frame_offsetÚunsupported_byte_offsetr~   r   rO   r€   r�   c                ó
  — |                       ¦   «          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        |	||¦  «        }
ddd¦  «         n# 1 swxY w Y   t          |
¦  «         |                      ¦   «          dS )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)r[   Ú
isinstanceÚintÚ	TypeErrorÚtyper   ÚAVSEEK_FLAG_BACKWARDÚAVSEEK_FLAG_ANYÚAVSEEK_FLAG_FRAMEÚAVSEEK_FLAG_BYTEro   r   r   Úav_seek_framer   r   Úflush_buffers)r   Úoffsetr~   r   rO   r€   r�   Úc_offsetÚflagsrt   rM   s              r   ÚseekzInputContainer.seek  s`  € ðJ 	×ÒÑÔÐå˜&¥#Ñ&Ô&ð 	YÝÐIÍ4ÐPVÉ<Ì<ÑXÔXÐXà"ˆØˆð ð 	.Ø•SÔ-Ñ-ˆEØð 	)Ø•SÔ(Ñ(ˆEð $ð 	+Ø•SÔ*Ñ*ˆEØ"ð 	*Ø•SÔ)Ñ)ˆEà39Ð#A 6¤< <¸rˆÝŒ\ð 	Mð 	MÝ×#Ò# D¤H¨l¸HÀeÑLÔLˆCð	Mð 	Mð 	Mñ 	Mô 	Mð 	Mð 	Mð 	Mð 	Mð 	Mð 	Møøøð 	Mð 	Mð 	Mð 	Må�#‰Œˆà×ÒÑÔÐÐÐs   Â&#CÃCÃCc                 ó|   — |                       ¦   «          | j        D ]}|j        }|r|                     ¦   «          Œ d S rU   )r[   r   rQ   r�   )r   rO   rQ   s      r   r�   zInputContainer.flush_buffersA  sT   € à×ÒÑÔÐð
 ”lð 	.ð 	.ˆFØ"Ô0ˆMØð .Ø×+Ò+Ñ-Ô-Ð-øð	.ð 	.rY   )Ú__name__Ú
__module__Ú__qualname__rS   rW   Úpropertyr\   r_   ra   rc   rg   ri   r{   r}   r   Úbintr	   r‘   Úcfuncr�   © rY   r   r    r       s|  € € € € € ðP
ð P
ð P
ðdð ð ð ð'ð 'ñ „Xð'ð
 ð0ð 0ñ „Xð0ð ð%ð %ñ „Xð%ð
 ð!ð !ñ „Xð!ð ð*ð *ñ „Xð*ðð ð ðY@ð Y@ð Y@ðv'ð 'ð 'ð( !%Ø!&Ø $Ø05Ø/4ð>ð >ð >ð ”+ð	>ð
 ”;ð>ð ˜‘ð>ð #)¤+ð>ð "(¤ð>ð >ð >ð >ð@ „\ð	.ð 	.ñ „\ð	.ð 	.ð 	.rY   r    )r   Ú cython.cimports.av.codec.contextr   r   Ú$cython.cimports.av.container.streamsr   Úcython.cimports.av.dictionaryr   Úcython.cimports.av.errorr   Ú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   ÚfinalÚcclassÚ	Containerr™   rY   r   ú<module>r¦      sI  ðØ €€€Ø MÐ MÐ MÐ MÐ MÐ MÐ MÐ MØ @Ð @Ð @Ð @Ð @Ð @Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ø .Ð .Ð .Ð .Ð .Ð .Ø ,Ð ,Ð ,Ð ,Ð ,Ð ,Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø 3Ð 3Ð 3Ð 3Ð 3Ð 3Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ø 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4Ð 4ð „ð�nð ð ð ñ „ðð „Ø„ðr.ð r.ð r.ð r.ð r.�Yñ r.ô r.ñ „ñ „ðr.ð r.ð r.rY   