
    C1i              	          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\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\R2                  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/james-whalen/.local/lib/python3.13/site-packages/av/utils.py_decoder      s    ;;ua ''99    c                 $    U R                  X5      $ r	   )encoder   s      r   _encoder      s    88H%%r   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_setr   )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_avrationalr2   D   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)r4   
ValueErrorr5   )r3   r4   r5   s      r   check_ndarrayr9   J   si    
 {{e/wk%++aP
 	
 zzT.tfK

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