
    ybj1:              	          S SK Jr  S SKJrJr  S SKrS SKJr  S SK	J
r
JrJr  S SKJr  S SKJr  S SKJrJr  S S	KJrJr  S S
KJr  S SKJr  S SKJr  \S   rS\R<                  S\4S jrS\S\R<                  4S jr \RB                  \RD                   " S S\
5      5       5       r#\RH                  S\RJ                  \RL                     S\R<                  S\#4S j5       r'\RH                  \RP                  \RR                  " SS9S\RT                  S\RJ                  \   S\RV                  4S j5       5       5       r,\RB                  \RD                   " S S\
5      5       5       r-g)    )Iterator)Literalget_argsN)libav)Buffer
ByteSource
bytesource)	err_check)opaque_container)avrational_to_fractionto_avrational)	Py_DECREF	Py_INCREF)uint8_t)memcpy)
AVRational)(palettenew_extradataparam_changeh263_mb_inforeplay_gaindisplay_matrix	stereo_3daudio_service_typequality_statsfallback_trackcpb_propertiesskip_samplesjp_dual_monostrings_metadatasubtitle_positionmatroska_block_additionalwebvtt_identifierwebvtt_settingsmetadata_updatempegts_stream_idmastering_display_metadata	sphericalcontent_light_levela53_ccencryption_init_infoencryption_infoafdprfticc_profile	dovi_confs12m_timecodedynamic_hdr10_plusiamf_mix_gain_paramiamf_info_paramiamf_recon_gain_info_paramambient_viewing_environmentframe_croppinglcevc3d_reference_displaysrtcp_srdtypereturnc                 X    [        [        5      [        R                  " [        U 5         $ N)r   PktSideDataTcythoncastintr;   s    څ/tmp/claude-0/-home-danvics-docker-quiz/c1e0577a-e42c-4a3d-b1ea-3edd61103a4e/scratchpad/stt/lib/python3.13/site-packages/av/packet.pypacket_sidedata_type_to_literalrE   ?   s    L!&++c5"9::    c                 >    [        [        5      R                  U 5      $ r>   )r   r?   indexrC   s    rD   !packet_sidedata_type_from_literalrI   C   s    L!''..rF   c                      \ rS rSr\S\S\S\4S j5       rS\	R                  S\R                  4S jrS	 rSS\S
\R                  4S jjr\S\4S j5       r\S\4S j5       r\S\4S j5       r\R.                  S\R                  4S j5       r\R.                  S\R2                  4S j5       r\R.                  S\R                  4S j5       rS\4S jrSrg)PacketSideDataG   packet	data_typer<   c                 D    [        U5      n[        U R                  U5      $ )aa  create new PacketSideData by copying an existing packet's side data

:param packet: Source packet
:type packet: :class:`~av.packet.Packet`
:param data_type: side data type
:return: newly created copy of the side data if the side data of the
         requested type is found in the packet, else an empty object
:rtype: :class:`~av.packet.PacketSideData`
)rI   _packet_sidedata_from_packetptr)rM   rN   r;   s      rD   from_packetPacketSideData.from_packetJ   s     2)<+FJJ>>rF   r;   sizec                 x   Xl         [        R                     U(       ah  [        R                  " [        R                  [
        R                  " U5      5      U l        U R                  [        R                  :X  a  [        S5      eO[        R                  U l        S S S 5        X l
        g ! , (       d  f       N= f)NFailed to allocate memory)r;   r@   nogilrA   p_ucharlib	av_mallocdataNULLMemoryErrorrT   )selfr;   rT   s      rD   	__cinit__PacketSideData.__cinit__Y   sr    
\\"KKd8KL	99+%&ABB , #KK	  	 \s   BB++
B9c                     [         R                     [        R                  " [         R                  " U R
                  5      5        S S S 5        g ! , (       d  f       g = fr>   )r@   rW   rY   av_freepaddressr[   r^   s    rD   __dealloc__PacketSideData.__dealloc__d   s,    \\LL		23 \\   5A
Amovec                 n   U R                   S:X  a  gU R                  n[        R                     U(       d  [        R                  " [        R
                  [        R                  " U R                   5      5      nU[        R                  :X  a  [        S5      e[        X0R                  U R                   5        [        R                  " UR                  U R                  X0R                   5      nSSS5        [        W5        U(       a  [        R                  U l        SU l         gg! , (       d  f       N>= f)zcopy or move side data to the specified packet

:param packet: Target packet
:type packet: :class:`~av.packet.Packet`
:param move: True to move the data from this object to the packet,
             defaults to False.
:type move: bool
r   NrV   )rT   r[   r@   rW   rA   rX   rY   rZ   r\   r]   r   av_packet_add_side_datarQ   r;   r
   )r^   rM   rh   r[   ress        rD   	to_packetPacketSideData.to_packeth   s     99>yy\\{{6>>3==3KL6;;&%&ABBtYY		2--fjj$**dIIVC  	#DIDI  \s   C D&&
D4c                 ,    [        U R                  5      $ )z0
The type of this packet side data.

:type: str
)rE   r;   rd   s    rD   rN   PacketSideData.data_type   s     /tzz::rF   c                 B    [         R                  " U R                  5      $ )z<
The description of this packet side data type.

:type: str
)rY   av_packet_side_data_namer;   rd   s    rD   	data_descPacketSideData.data_desc   s     ++DJJ77rF   c                     U R                   $ )z9
The size in bytes of this packet side data.

:type: int
rT   rd   s    rD   	data_sizePacketSideData.data_size   s     yyrF   c                     U R                   $ r>   ru   rd   s    rD   _buffer_sizePacketSideData._buffer_size       yyrF   c                     U R                   $ r>   )r[   rd   s    rD   _buffer_ptrPacketSideData._buffer_ptr   r{   rF   c                     g)NT rd   s    rD   _buffer_writablePacketSideData._buffer_writable   s    rF   c                 <    U R                   [        R                  :g  $ )z3
True if this object holds side data.

:type: bool
)r[   r@   r\   rd   s    rD   __bool__PacketSideData.__bool__   s     yyFKK''rF   )r[   r;   rT   NF)__name__
__module____qualname____firstlineno__staticmethodPacketr?   rK   rR   rY   AVPacketSideDataTyper@   size_tr_   re   bintrl   propertystrrN   rr   rB   rv   cfuncry   p_voidr}   r   boolr   __static_attributes__r   rF   rD   rK   rK   G   s*    ?F ?| ? ? ?	s77 	v}} 	4 fkk : ;3 ; ; 83 8 8 3   \\fmm   \\V]]   \\&++  ($ (rF   rK   rM   c                    [         R                     [        R                  " U R                  U R
                  U5      nU[         R                  :g  nS S S 5        [        UW(       a  WR                  OS5      n[         R                     U(       a+  [        UR                  WR                  UR                  5        S S S 5        U$ ! , (       d  f       Nz= f! , (       d  f       U$ = f)Nr   )r@   rW   rY   av_packet_side_data_get	side_dataside_data_elemsr\   rK   rT   r   r[   )rM   r;   c_ptrfoundsdatas        rD   rP   rP      s     
++f44e
 #fkk1	 
 5%**1=E	5::uzz5::6 
 L 
 
 Ls   A C3C
C
C%F)checkopaquer[   c                     U [         R                  :w  a>  [         R                     [        [         R                  " [
        U 5      5        S S S 5        g g ! , (       d  f       g = fr>   )r@   r\   gilr   rA   object)r   r[   s     rD   _python_freer      s<     ZZfkk&&12 Z Zs   %A
A"c                   n   \ rS rSrSrS.S jrS rS.S jrS r\	R                  S\	R                  4S	 j5       r\	R                  S\	R                  4S
 j5       r\	R                  S\R                   4S j5       rS rS r\S 5       r\S 5       r\R.                  S\4S j5       r\S 5       r\R.                  S 5       r\S 5       r\R.                  S 5       r\S 5       r\R.                  S 5       r\S 5       r\S 5       r\S 5       r\R.                  S 5       r\S 5       r\R.                  S 5       r\S 5       r \ R.                  S  5       r \S! 5       r!\S" 5       r"\S# 5       r#\S$ 5       r$\$R.                  S% 5       r$S&\%S\&4S' jr'S&\%S\(4S( jr)S/S)\(S*\	RT                  4S+ jjr+S\,\(   4S, jr-S-r.g)0r      zA packet of encoded data within a :class:`~av.format.Stream`.

This may, or may not include a complete object within a stream.
:meth:`decode` must be called to extract encoded data.
Nc                     [         R                     [        R                  " 5       U l        S S S 5        g ! , (       d  f       g = fr>   )r@   rW   rY   av_packet_allocrQ   )r^   inputs     rD   r_   Packet.__cinit__   s#    \\**,DH \\s	   5
Ac                     [         R                     [        R                  " [         R                  " U R
                  5      5        S S S 5        g ! , (       d  f       g = fr>   )r@   rW   rY   av_packet_freerc   rQ   rd   s    rD   re   Packet.__dealloc__   s.    \\v~~dhh78 \\rg   c           	         SnS nUc  g [        U[        5      (       aX  UnU(       aN  [        [        R                  " U R
                  [        R                  " [        R                  U5      5      5        g g [        U5      nUR                  nU(       a  [        U5        [        R                  " UR
                  U[        [        R                  " [        R                  U5      S5      nU[        R                  :X  a  [        U5        [!        S5      eX@R
                  l        UR
                  U R
                  l        [        R                  " [        R                  U5      U R
                  l        g g )Nr   zCould not allocate AVBufferRef)
isinstancerB   r
   rY   av_new_packetrQ   r@   rA   r	   lengthr   av_buffer_creater   r   r\   r   r]   bufr[   rT   )r^   r   rT   sourcer   s        rD   __init__Packet.__init__   s   ! =eS!!D#++DHHfkk&**d6STU   &F==D&!**JJ KKv6 &++%f%%&FGG" &

 &FJJ = rF   c                 
   U R                   (       a  U R                   R                  OSnSU R                  R                   SU SU R                   SU R
                   SU R                  R                   S[        U 5      S S	3$ )
Nr   zav.z of #z, dts=z, pts=z; z bytes at 0xx>)	_streamrH   	__class__r   dtsptsrQ   rT   idr^   streams     rD   __repr__Packet.__repr__  sq    '+||##$..))*%xvdhhZ HHH:Rl2d8A,aI	
rF   r<   c                 .    U R                   R                  $ r>   rQ   rT   rd   s    rD   ry   Packet._buffer_size      xx}}rF   c                 .    U R                   R                  $ r>   )rQ   r[   rd   s    rD   r}   Packet._buffer_ptr  r   rF   dstc                    UR                   (       d  [        S5      eU R                  R                  R                   (       d  XR                  l        g U R                  R                  R                   UR                   :X  a/  U R                  R                  R                  UR                  :X  a  g [
        R                  " U R                  U R                  R                  U5        XR                  l        g )NzCannot rebase to zero time.)num
ValueErrorrQ   	time_basedenrY   av_packet_rescale_ts)r^   r   s     rD   _rebase_timePacket._rebase_time  s    ww:;;xx!!%%!$HH88!!SWW,1C1C1G1G3771R  488+=+=sC rF   c                     [        U[        5      (       d  [        S5      e[        U[        R
                  " W5      5        U R                  U5        g)a  Rescale the packet timestamps to a new time base.

This rescales :attr:`pts`, :attr:`dts`, and :attr:`duration`, then updates
:attr:`time_base`. If the current time base is unset, the timestamp values
are unchanged and the new time base is assigned.

:meth:`~av.container.OutputContainer.mux` already performs this operation
automatically when necessary.

Wraps :ffmpeg:`av_packet_rescale_ts`.
ztime_base must be an AVRationalN)r   r   	TypeErrorr   r@   rc   r   )r^   r   r   s      rD   
rescale_tsPacket.rescale_ts&  s@     )Z00=>> 	i!45#rF   c                 8    U R                   R                  U 5      $ )z
Send the packet's data to the decoder and return a list of
:class:`.AudioFrame`, :class:`.VideoFrame` or :class:`.SubtitleSet`.
)r   decoderd   s    rD   r   Packet.decode9  s    
 ||""4((rF   c                 .    U R                   R                  $ r>   )rQ   stream_indexrd   s    rD   r   Packet.stream_index@  s    xx$$$rF   c                     U R                   $ )z3
The :class:`Stream` this packet was demuxed from.
)r   rd   s    rD   r   Packet.streamD  s    
 ||rF   r   c                 Z    Xl         UR                  R                  U R                  l        g r>   )r   rQ   rH   r   r   s     rD   r   r   K  s     &

 0 0rF   c                 h    [        [        R                  " U R                  R                  5      5      $ )zh
The unit of time (in fractional seconds) in which timestamps are expressed.

:type: fractions.Fraction
)r   r@   rc   rQ   r   rd   s    rD   r   Packet.time_baseP  s"     &fnnTXX5G5G&HIIrF   c                 l    [        U[        R                  " U R                  R                  5      5        g r>   )r   r@   rc   rQ   r   )r^   values     rD   r   r   Y  s    eV^^DHH,>,>?@rF   c                     U R                   R                  [        R                  :w  a  U R                   R                  $ g)z
The presentation timestamp in :attr:`time_base` units for this packet.

This is the time at which the packet should be shown to the user.

:type: int | None
N)rQ   r   rY   AV_NOPTS_VALUErd   s    rD   r   
Packet.pts]  s-     88<<3---88<< .rF   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r>   )rY   r   rQ   r   r^   vs     rD   r   r   i  !    9--DHHLHHLrF   c                     U R                   R                  [        R                  :w  a  U R                   R                  $ g)zW
The decoding timestamp in :attr:`time_base` units for this packet.

:type: int | None
N)rQ   r   rY   r   rd   s    rD   r   
Packet.dtsp  s-     88<<3---88<< .rF   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r>   )rY   r   rQ   r   r   s     rD   r   r   z  r   rF   c                 d    U R                   R                  S:w  a  U R                   R                  $ g)zv
The byte position of this packet within the :class:`.Stream`.

Returns `None` if it is not known.

:type: int | None
N)rQ   posrd   s    rD   r   
Packet.pos  s'     88<<288<< rF   c                 .    U R                   R                  $ )z6
The size in bytes of this packet's data.

:type: int
r   rd   s    rD   rT   Packet.size  s     xx}}rF   c                     U R                   R                  [        R                  :w  a  U R                   R                  $ g)zj
The duration in :attr:`time_base` units for this packet.

Returns `None` if it is not known.

:type: int
N)rQ   durationrY   r   rd   s    rD   r   Packet.duration  s1     88 2 2288$$$ 3rF   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r>   )rY   r   rQ   r   r   s     rD   r   r     s#    9 # 2 2DHH !HHrF   c                 b    [        U R                  R                  [        R                  -  5      $ r>   )r   rQ   flagsrY   AV_PKT_FLAG_KEYrd   s    rD   is_keyframePacket.is_keyframe  s     DHHNNS%8%8899rF   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r>   )rQ   r   rY   r   r   s     rD   r   r     s8    HHNNc111NHHNN 3 344NrF   c                 b    [        U R                  R                  [        R                  -  5      $ r>   )r   rQ   r   rY   AV_PKT_FLAG_CORRUPTrd   s    rD   
is_corruptPacket.is_corrupt       DHHNNS%<%<<==rF   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r>   )rQ   r   rY   r   r   s     rD   r   r     s8    HHNNc555NHHNN 7 788NrF   c                 b    [        U R                  R                  [        R                  -  5      $ r>   )r   rQ   r   rY   AV_PKT_FLAG_DISCARDrd   s    rD   
is_discardPacket.is_discard  r   rF   c                 b    [        U R                  R                  [        R                  -  5      $ r>   )r   rQ   r   rY   AV_PKT_FLAG_TRUSTEDrd   s    rD   
is_trustedPacket.is_trusted  r   rF   c                 b    [        U R                  R                  [        R                  -  5      $ r>   )r   rQ   r   rY   AV_PKT_FLAG_DISPOSABLErd   s    rD   is_disposablePacket.is_disposable  s     DHHNNS%?%??@@rF   c                     U R                   R                  [        R                  LaW  [        R
                  " [        R                  " [        R                  U R                   R                  R                  5      5      $ g r>   )	rQ   
opaque_refr@   r\   r   getrA   p_charr[   rd   s    rD   r   Packet.opaque  sR    88fkk1#''FMM488+>+>+C+CD  2rF   c                     [         R                  " [        R                  " U R                  R
                  5      5        Uc  g [        R                  " U5      U R                  l        g r>   )rY   av_buffer_unrefr@   rc   rQ   r  r   addr   s     rD   r   r    sB    FNN488+>+>?@9.2215rF   r;   c                     [        U5      n[        R                  " U R                  R                  U R                  R
                  U5      [        R                  :g  $ )z_True if this packet has the specified side data

:param dtype: side data type
:type dtype: str
)rI   rY   r   rQ   r   r   r@   r\   )r^   r;   dtype2s      rD   has_sidedataPacket.has_sidedata  sJ     359''""DHH$<$<f {{	
rF   c                 ,    [         R                  X5      $ )aP  get a copy of the side data

:param dtype: side data type (:meth:`~av.packet.PacketSideData.sidedata_types` for the full list of options)
:type dtype: str
:return: newly created copy of the side data if the side data of the
         requested type is found in the packet, else an empty object
:rtype: :class:`~av.packet.PacketSideData`
)rK   rR   )r^   r;   s     rD   get_sidedataPacket.get_sidedata  s     ))$66rF   sidedatarh   c                 &    UR                  X5        g)zcopy or move side data to this packet

:param sidedata: Source packet side data
:type sidedata: :class:`~av.packet.PacketSideData`
:param move: If True, move the data from `sidedata` object, defaults to False
:type move: bool
N)rl   )r^   r  rh   s      rD   set_sidedataPacket.set_sidedata  s     	4&rF   c              #      #    [        U R                  R                  5       H<  n[        U R                  U R                  R                  U   R
                  5      v   M>     g7f)zZiterate over side data of this packet.

:yield: :class:`~av.packet.PacketSideData` object
N)rangerQ   r   rP   r   type)r^   is     rD   iter_sidedataPacket.iter_sidedata  sF      txx//0A.txx9K9KA9N9S9STT 1s   A!A#)r   rQ   r>   r   )/r   r   r   r   __doc__r_   re   r   r   r@   r   r   ry   r   r}   rY   r   r   r   r   r   r   r   setterStreamr   r   r   r   rT   r   r   r   r  r  r  r   r   r   r  rK   r  r   r  r   r$  r   r   rF   rD   r   r      s   -9>@
 \\fmm   \\V]]   \\! ! !&) % %   ]]1V 1 1 J J A A 	  	  	ZZ      	ZZ  	  	    	% 	% __" " : : 5 5 > > 9 9 > > > > A A   ]]6 6
# 
$ 
	7# 	7. 	7'^ '6;; 'Ux7 UrF   r   ).collections.abcr   typingr   r   r@   cython.cimportsr   rY   cython.cimports.av.bufferr   r   r	   cython.cimports.av.errorr
   cython.cimports.av.opaquer   cython.cimports.av.utilsr   r   cython.cimports.cpython.refr   r   cython.cimports.libc.stdintr   cython.cimports.libc.stringr   av.rationalr   r?   r   rE   rI   finalcclassrK   r   pointerAVPacketrP   rW   	exceptvalr   voidr   r   r   rF   rD   <module>r:     su   $ $  ( D D . 6 J < / . "
 ')X;3+C+C ; ;/\ /c>V>V / k(V k(  k(\ NN3<<(141I1I $ 3MM3
..
!3 [[3   3 mUV mU  mUrF   