
    C1i3                        S SK JrJrJr  S SKrS SKJr  S SKJ	r	  S SK
Jr  S SKJr  S SKJr  S SKJrJr  S S	KJr  \S
   rS\R,                  S\4S jrS\S\R,                  4S jr\R2                   " S S\	5      5       r\R6                  S\R8                  \R:                     S\R,                  S\4S j5       r\R2                   " S S\	5      5       rg)    )IteratorLiteralget_argsN)libav)Buffer)
bytesource)	err_check)opaque_container)avrational_to_fractionto_avrational)memcpy)(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r6   s    C/home/james-whalen/.local/lib/python3.13/site-packages/av/packet.pypacket_sidedata_type_to_literalr@   ;   s    L!&++c5"9::    c                 >    [        [        5      R                  U 5      $ r9   )r   r:   indexr>   s    r?   !packet_sidedata_type_from_literalrD   ?   s    L!''..rA   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)PacketSideDataC   packet	data_typer7   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`
)rD   _packet_sidedata_from_packetptr)rH   rI   r6   s      r?   from_packetPacketSideData.from_packetE   s     2)<+FJJ>>rA   r6   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)r6   r;   nogilr<   p_ucharlib	av_mallocdataNULLMemoryErrorrO   )selfr6   rO   s      r?   	__cinit__PacketSideData.__cinit__T   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r9   )r;   rR   rT   av_freepaddressrV   rY   s    r?   __dealloc__PacketSideData.__dealloc___   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   NrQ   )rO   rV   r;   rR   r<   rS   rT   rU   rW   rX   r   av_packet_add_side_datarL   r6   r	   )rY   rH   rc   rV   ress        r?   	to_packetPacketSideData.to_packetc   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
)r@   r6   r_   s    r?   rI   PacketSideData.data_type   s     /tzz::rA   c                 B    [         R                  " U R                  5      $ )z<
The description of this packet side data type.

:type: str
)rT   av_packet_side_data_namer6   r_   s    r?   	data_descPacketSideData.data_desc   s     ++DJJ77rA   c                     U R                   $ )z9
The size in bytes of this packet side data.

:type: int
rO   r_   s    r?   	data_sizePacketSideData.data_size   s     yyrA   c                     U R                   $ r9   rp   r_   s    r?   _buffer_sizePacketSideData._buffer_size       yyrA   c                     U R                   $ r9   )rV   r_   s    r?   _buffer_ptrPacketSideData._buffer_ptr   rv   rA   c                     g)NT r_   s    r?   _buffer_writablePacketSideData._buffer_writable   s    rA   c                 <    U R                   [        R                  :g  $ )z3
True if this object holds side data.

:type: bool
)rV   r;   rW   r_   s    r?   __bool__PacketSideData.__bool__   s     yyFKK''rA   )rV   r6   rO   NF)__name__
__module____qualname____firstlineno__staticmethodPacketr:   rF   rM   rT   AVPacketSideDataTyper;   size_trZ   r`   bintrg   propertystrrI   rm   r=   rq   cfuncrt   p_voidrx   r|   boolr   __static_attributes__r{   rA   r?   rF   rF   C   s(   ?F ?| ? ? ?	s77 	v}} 	4 fkk : ;3 ; ; 83 8 8 3   \\fmm   \\V]]   \\&++  ($ (rA   rF   rH   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;   rR   rT   av_packet_side_data_get	side_dataside_data_elemsrW   rF   rO   r   rV   )rH   r6   c_ptrfoundsdatas        r?   rK   rK      s     
++f44e
 #fkk1	 
 5%**1=E	5::uzz5::6 
 L 
 
 Ls   A C3C
C
C%c                   h   \ 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 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)\	RR                  4S* jjr*S\+\'   4S+ jr,S,r-g)/r      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r9   )r;   rR   rT   av_packet_allocrL   )rY   inputs     r?   rZ   Packet.__cinit__   s#    \\**,DH \\s	   5
Ac                     [         R                     [        R                  " [         R                  " U R
                  5      5        S S S 5        g ! , (       d  f       g = fr9   )r;   rR   rT   av_packet_freer^   rL   r_   s    r?   r`   Packet.__dealloc__   s.    \\v~~dhh78 \\rb   c                     SnS nUc  g [        U[        5      (       a  UnO[        U5      nUR                  nU(       a*  [	        [
        R                  " U R                  U5      5        Ub  U R                  U5        g g r   )	
isinstancer=   r   lengthr	   rT   av_new_packetrL   update)rY   r   rO   sources       r?   __init__Packet.__init__   sl    !=eS!!D&F==Dc''$78KK rA   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>)	_streamrC   	__class__r   dtsptsrL   rO   idrY   streams     r?   __repr__Packet.__repr__   sq    '+||##$..))*%xvdhhZ HHH:Rl2d8A,aI	
rA   r7   c                 .    U R                   R                  $ r9   rL   rO   r_   s    r?   rt   Packet._buffer_size       xx}}rA   c                 .    U R                   R                  $ r9   )rL   rV   r_   s    r?   rx   Packet._buffer_ptr   r   rA   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
ValueErrorrL   	time_basedenrT   av_packet_rescale_ts)rY   r   s     r?   _rebase_timePacket._rebase_time   s    ww:;;xx!!%%!$HH88!!SWW,1C1C1G1G3771R  488+=+=sC rA   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   decoder_   s    r?   r   Packet.decode
  s    
 ||""4((rA   c                 .    U R                   R                  $ r9   )rL   stream_indexr_   s    r?   r   Packet.stream_index  s    xx$$$rA   c                     U R                   $ )z3
The :class:`Stream` this packet was demuxed from.
)r   r_   s    r?   r   Packet.stream  s    
 ||rA   r   c                 Z    Xl         UR                  R                  U R                  l        g r9   )r   rL   rC   r   r   s     r?   r   r     s     &

 0 0rA   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;   r^   rL   r   r_   s    r?   r   Packet.time_base!  s"     &fnnTXX5G5G&HIIrA   c                 l    [        U[        R                  " U R                  R                  5      5        g r9   )r   r;   r^   rL   r   )rY   values     r?   r   r   *  s    eV^^DHH,>,>?@rA   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)rL   r   rT   AV_NOPTS_VALUEr_   s    r?   r   
Packet.pts.  s-     88<<3---88<< .rA   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r9   )rT   r   rL   r   rY   vs     r?   r   r   :  !    9--DHHLHHLrA   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)rL   r   rT   r   r_   s    r?   r   
Packet.dtsA  s-     88<<3---88<< .rA   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r9   )rT   r   rL   r   r   s     r?   r   r   K  r   rA   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)rL   posr_   s    r?   r   
Packet.posR  s'     88<<288<< rA   c                 .    U R                   R                  $ )z6
The size in bytes of this packet's data.

:type: int
r   r_   s    r?   rO   Packet.size^  s     xx}}rA   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)rL   durationrT   r   r_   s    r?   r   Packet.durationg  s1     88 2 2288$$$ 3rA   c                 j    Uc   [         R                  U R                  l        g XR                  l        g r9   )rT   r   rL   r   r   s     r?   r   r   s  s#    9 # 2 2DHH !HHrA   c                 b    [        U R                  R                  [        R                  -  5      $ r9   )r   rL   flagsrT   AV_PKT_FLAG_KEYr_   s    r?   is_keyframePacket.is_keyframez  s     DHHNNS%8%8899rA   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r9   )rL   r   rT   r   r   s     r?   r   r   ~  s8    HHNNc111NHHNN 3 344NrA   c                 b    [        U R                  R                  [        R                  -  5      $ r9   )r   rL   r   rT   AV_PKT_FLAG_CORRUPTr_   s    r?   
is_corruptPacket.is_corrupt       DHHNNS%<%<<==rA   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r9   )rL   r   rT   r   r   s     r?   r   r     s8    HHNNc555NHHNN 7 788NrA   c                 b    [        U R                  R                  [        R                  -  5      $ r9   )r   rL   r   rT   AV_PKT_FLAG_DISCARDr_   s    r?   
is_discardPacket.is_discard  r   rA   c                 b    [        U R                  R                  [        R                  -  5      $ r9   )r   rL   r   rT   AV_PKT_FLAG_TRUSTEDr_   s    r?   
is_trustedPacket.is_trusted  r   rA   c                 b    [        U R                  R                  [        R                  -  5      $ r9   )r   rL   r   rT   AV_PKT_FLAG_DISPOSABLEr_   s    r?   is_disposablePacket.is_disposable  s     DHHNNS%?%??@@rA   c                     U R                   R                  [        R                  LaW  [        R
                  " [        R                  " [        R                  U R                   R                  R                  5      5      $ g r9   )	rL   
opaque_refr;   rW   r
   getr<   p_charrV   r_   s    r?   opaquePacket.opaque  sR    88fkk1#''FMM488+>+>+C+CD  2rA   c                     [         R                  " [        R                  " U R                  R
                  5      5        Uc  g [        R                  " U5      U R                  l        g r9   )rT   av_buffer_unrefr;   r^   rL   r   r
   addr   s     r?   r  r    sB    FNN488+>+>?@9.2215rA   r6   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
)rD   rT   r   rL   r   r   r;   rW   )rY   r6   dtype2s      r?   has_sidedataPacket.has_sidedata  sJ     359''""DHH$<$<f {{	
rA   c                 ,    [         R                  X5      $ )aR  get a copy of the side data

:param dtype: side data type (:method:`~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`
)rF   rM   )rY   r6   s     r?   get_sidedataPacket.get_sidedata  s     ))$66rA   sidedatarc   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)rg   )rY   r  rc   s      r?   set_sidedataPacket.set_sidedata  s     	4&rA   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)rangerL   r   rK   r   type)rY   is     r?   iter_sidedataPacket.iter_sidedata  sF      txx//0A.txx9K9KA9N9S9STT 1s   A!A#)r   rL   r9   r   ).r   r   r   r   __doc__rZ   r`   r   r   r;   r   r   rt   r   rx   rT   
AVRationalr   r   r   r   r   setterStreamr   r   r   r   rO   r   r   r   r   r   r   r  r   r   r	  rF   r  r   r  r   r  r   r{   rA   r?   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rA   r   ) typingr   r   r   r;   cython.cimportsr   rT   cython.cimports.av.bufferr   cython.cimports.av.bytesourcer   cython.cimports.av.errorr	   cython.cimports.av.opaquer
   cython.cimports.av.utilsr   r   cython.cimports.libc.stringr   r:   r   r@   rD   cclassrF   r   pointerAVPacketrK   r   r{   rA   r?   <module>r'     s    . .  ( , 4 . 6 J .
 ')X;3+C+C ; ;/\ /c>V>V / k(V k( k(\ NN3<<(141I1I $ PUV PU PUrA   