
    3j              	          S SK Jr  S SKrS SKJr  S SKJr  \R                  S\R                  \R                     S\4S j5       r\R                  S\R                  \R                     S	\S
\S\4S j5       r\R                  S\R                  \R                  \R                        S\S	\S
\4S j5       r\R                  S\R                  \R"                  \R$                        S\4S j5       r\R                  S\S\R                  \R$                     S\R*                  4S j5       r\R                  S\S\S\R.                  S\R*                  4S j5       rg)    )FractionN)libav)	err_checksreturnc                 V    [         R                  " [        U 5      R                  X5      $ N)cythoncastbytesdecode)r   encodingerrorss      B/home/wildlama/miniconda3/lib/python3.13/site-packages/av/utils.py_decoder   	   s    ;;ua ''99    inputr   r   c                    [         R                  n0 n [        R                  " U SU[        R                  5      nU[         R                  :X  a   U$ [        UR                  X5      U[        UR                  X5      '   Mm  )N )r
   NULLlibav_dict_getAV_DICT_IGNORE_SUFFIXr   valuekey)r   r   r   elementoutputs        r   avdict_to_dictr      sp     6<[[GF
//%Wc6O6OPfkk!
 M	 :AMM8:
ww{{H56	 r   dstsrcc                     [         R                  " U 5        UR                  5        HD  u  pE[        [         R                  " XR                  X#5      UR                  X#5      S5      5        MF     g )Nr   )r   av_dict_freeitemsr   av_dict_setencode)r   r    r   r   r   r   s         r   dict_to_avdictr&      sR     Siik
OOZZ15<<3QST	
 "r   c                     U R                   (       a1  U R                  (       a   [        U R                   U R                  5      $ g r	   )numdenr   )r   s    r   avrational_to_fractionr*   /   s)     yyUYY		599--r   fracc                 H    U R                   Ul        U R                  Ul        g r	   )	numeratorr(   denominatorr)   )r+   r   s     r   to_avrationalr/   8   s    EI  EIr   arraydtypendimc                     U R                   U:w  a  [        SU SU R                    S35      eU R                  U:w  a  [        SU SU R                   S35      eg)zJ
Check a numpy array has the expected data type and number of dimensions.
z!Expected numpy array with dtype `z` but got ``z Expected numpy array with ndim `N)r1   
ValueErrorr2   )r0   r1   r2   s      r   check_ndarrayr6   >   si    
 {{e/wk%++aP
 	
 zzT.tfK

|1M
 	
 r   )	fractionsr   r
   cython.cimportsr   r   cython.cimports.av.errorr   cfuncpointercharstrr   AVDictionarydictr   r&   const
AVRationalobjectr*   voidr/   intr6    r   r   <module>rF      s     ( . :v~~fkk* : : : >>#**+7:DG	   
	s'7'78	9
	
 
 	
 
 >>&,,s~~67  ! !v~~cnn'E !&++ ! !
 
 
 
fjj 
V[[ 
 
r   