
    3j              
          S SK r S SK Jr  \ R                  " \\" 5       5      r\ R                  S\R                  S\S\S\	S-  4S j5       r
\ R                  \ R                  " \R                  SS	9S
\ R                  S\R                  4S j5       5       r\ R                  \ R                    " S S5      5       5       r	\ R                  \ R                    " S S5      5       5       r\" 5       r\ R                  " \ R(                  \ R*                  \R,                        \ R.                  5      r \R3                  \5      r\(       d  g\R5                  \R6                  5        M6  )    N)uintc_formatwidthheightreturnc                     U [         R                  :X  a  g [        R                  [        [        5      nUR                  XU5        U$ N)libAV_PIX_FMT_NONEVideoFormat__new___cinit_bypass_sentinel_init)r   r   r   formats       I/home/wildlama/miniconda3/lib/python3.13/site-packages/av/video/format.pyget_video_formatr      s;     3&&&%--k;QRF
LL&)M    F)checknamec                 t    [         R                  U 5      nU[         R                  :X  a  [        SU -  5      eU$ )z3Wrapper for lib.av_get_pix_fmt with error checking.znot a pixel format: %r)r
   av_get_pix_fmtr   
ValueError)r   pix_fmts     r   get_pix_fmtr      s8    
 "%!3!3D!9G#%%%1D899Nr   c                      \ rS rSrSrSS jr\R                  S\R                  S\
S\
4S j5       rS rS	 r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\S 5       r\R2                  SS\R4                  4S jj5       r\R2                  SS\R4                  4S jj5       rSrg)r      z=

>>> format = VideoFormat('rgb24')
>>> format.name
'rgb24'

c                 :   U[         L a  g [        U[        5      (       a_  [        R                  " [        U5      nU R                  UR                  U=(       d    UR                  U=(       d    UR                  5        g [        U5      nU R                  XRU5        g r	   )
r   
isinstancer   cythoncastr   r   r   r   r   )selfr   r   r   otherr   s         r   	__cinit__VideoFormat.__cinit__)   sl    ))dK((!'[$!?EJJu}}e&:u{{F<RellS%0%6

76*r   r   r   r   c                 \    Xl         [        R                  U5      U l        X l        X0l        g r	   )r   r
   av_pix_fmt_desc_getptrr   r   )r!   r   r   r   s       r   r   VideoFormat._init5   s#    **73
r   c           	         U R                   (       d  U R                  (       aA  SU R                  R                   SU R                   SU R                    SU R                   S3	$ SU R                  R                   SU R                   S3$ )Nz<av. z, x>)r   r   	__class____name__r   r!   s    r   __repr__VideoFormat.__repr__<   sl    ::$..112!DII;bAdkk]Z[\\$..112!DII;a@@r   c                 ,    [        U R                  5      $ r	   )intr   r/   s    r   __int__VideoFormat.__int__B   s    4<<  r   c                 `    [         R                  " [        U R                  R                  5      $ )z#Canonical name of the pixel format.)r   r    strr'   r   r/   s    r   r   VideoFormat.nameE   s     {{3..r   c                 h   ^  [        U 4S j[        T R                  R                  5       5       5      $ )Nc              3   <   >#    U  H  n[        TU5      v   M     g 7fr	   )VideoFormatComponent).0ir!   s     r   	<genexpr>)VideoFormat.components.<locals>.<genexpr>L   s       
3Pa q))3Ps   )tupleranger'   nb_componentsr/   s   `r   
componentsVideoFormat.componentsJ   s,     
389O9O3P
 
 	
r   c                 @    [         R                  U R                  5      $ r	   )r
   av_get_bits_per_pixelr'   r/   s    r   bits_per_pixelVideoFormat.bits_per_pixelP   s    ((22r   c                 @    [         R                  U R                  5      $ r	   )r
   av_get_padded_bits_per_pixelr'   r/   s    r   padded_bits_per_pixel!VideoFormat.padded_bits_per_pixelT   s    //99r   c                 b    [        U R                  R                  [        R                  -  5      $ )zPixel format is big-endian.)boolr'   flagsr
   AV_PIX_FMT_FLAG_BEr/   s    r   is_big_endianVideoFormat.is_big_endianX   s"     DHHNNS%;%;;<<r   c                 b    [        U R                  R                  [        R                  -  5      $ )zJPixel format has a palette in data[1], values are indexes in this palette.)rN   r'   rO   r
   AV_PIX_FMT_FLAG_PALr/   s    r   has_paletteVideoFormat.has_palette]   "     DHHNNS%<%<<==r   c                 b    [        U R                  R                  [        R                  -  5      $ )z9All values of a component are bit-wise packed end to end.)rN   r'   rO   r
   AV_PIX_FMT_FLAG_BITSTREAMr/   s    r   is_bit_streamVideoFormat.is_bit_streamb   s"     DHHNNS%B%BBCCr   c                 b    [        U R                  R                  [        R                  -  5      $ )z<At least one pixel component is not in the first data plane.)rN   r'   rO   r
   AV_PIX_FMT_FLAG_PLANARr/   s    r   	is_planarVideoFormat.is_planarg   s"     DHHNNS%?%??@@r   c                 b    [        U R                  R                  [        R                  -  5      $ )zFThe pixel format contains RGB-like data (as opposed to YUV/grayscale).)rN   r'   rO   r
   AV_PIX_FMT_FLAG_RGBr/   s    r   is_rgbVideoFormat.is_rgbl   rW   r   c                 b    [        U R                  R                  [        R                  -  5      $ )z%The pixel format contains Bayer data.)rN   r'   rO   r
   AV_PIX_FMT_FLAG_BAYERr/   s    r   is_bayerVideoFormat.is_bayerq   s"     DHHNNS%>%>>??r   
luma_widthc                 t    U=(       d    U R                   nU(       a  U* U R                  R                  -	  * $ S$ )zchroma_width(luma_width=0)

Width of a chroma plane relative to a luma plane.

:param int luma_width: Width of the luma plane; defaults to ``self.width``.

r   )r   r'   log2_chroma_w)r!   rh   s     r   chroma_widthVideoFormat.chroma_widthv   s3      -4::
=G:+$(("8"889NQNr   luma_heightc                 t    U=(       d    U R                   nU(       a  U* U R                  R                  -	  * $ S$ )zchroma_height(luma_height=0)

Height of a chroma plane relative to a luma plane.

:param int luma_height: Height of the luma plane; defaults to ``self.height``.

r   )r   r'   log2_chroma_h)r!   rm   s     r   chroma_heightVideoFormat.chroma_height   s3     "0T[[>I;,488#9#99:PqPr   )r   r   r'   r   N)r   r   )r   )r.   
__module____qualname____firstlineno____doc__r#   r   cfuncr
   AVPixelFormatcuintr   r0   r4   propertyr   rC   rG   rK   rQ   rU   rZ   r^   rb   rf   ccallr3   rk   rp   __static_attributes__ r   r   r   r      sd   
+ \\S.. u e  A! / / 
 

 3 3 : : = = > > D D A A > > @ @ \\	Ovzz 	O 	O \\	Q 	Q 	Qr   r   c                       \ rS rSrS\S\R                  4S jr\S 5       r	\S 5       r
\S 5       r\S 5       r\S	 5       r\S
 5       r\S 5       rSrg)r;      r   indexc                     Xl         X l        [        R                  " UR                  R
                  U   5      U l        g r	   )r   r   r   addressr'   comp)r!   r   r   s      r   r#   VideoFormatComponent.__cinit__   s)    
>>&**//%"89r   c                 .    U R                   R                  $ )z5The index of the plane which contains this component.)r'   planer/   s    r   r   VideoFormatComponent.plane        xx~~r   c                 .    U R                   R                  $ )z Number of bits in the component.)r'   depthr/   s    r   bitsVideoFormatComponent.bits   r   r   c                     U R                   S:H  =(       a#    U R                  R                  R                  S:H  =(       d9    U R                   S:H  =(       a#    U R                  R                  R                  S:H  $ )z#Is this component an alpha channel?            )r   r   r'   rB   r/   s    r   is_alphaVideoFormatComponent.is_alpha   sT     

aFDKKOO$A$AQ$F 
JJ!OB = = B	
r   c                    U R                   S:H  =(       ao    U R                  R                  R                  S:H  =(       dE    U R                  R                  R                  S:H  =(       d    U R                  R                  (       + $ )z!Is this component a luma channel?r   r   r   )r   r   r'   rB   rb   r/   s    r   is_lumaVideoFormatComponent.is_luma   s_     zzQ 
KKOO))Q. &{{,,1&;;%%%	
r   c                     U R                   S:H  =(       d    U R                   S:H  =(       aG    U R                  R                  R                  =(       d     U R                  R                  R                  $ )z#Is this component a chroma channel?r   r   )r   r   r'   rj   ro   r/   s    r   	is_chromaVideoFormatComponent.is_chroma   sJ     

a24::? 
KKOO))JT[[__-J-J	
r   c                     U R                   (       a  U R                  R                  5       $ U R                  R                  $ )zaThe width of this component's plane.

Requires the parent :class:`VideoFormat` to have a width.

)r   r   rk   r   r/   s    r   r   VideoFormatComponent.width   s,     .2^^t{{'')RARARRr   c                     U R                   (       a  U R                  R                  5       $ U R                  R                  $ )zcThe height of this component's plane.

Requires the parent :class:`VideoFormat` to have a height.

)r   r   rp   r   r/   s    r   r   VideoFormatComponent.height   s,     /3nnt{{((*T$++BTBTTr   )r   r   r'   N)r.   rr   rs   rt   r   r   size_tr#   ry   r   r   r   r   r   r   r   r{   r|   r   r   r;   r;      s    : :FMM :
     
 
 
 
 
 
 S S U Ur   r;   )r   r   rx   declareobjectr   rv   r
   rw   r   r   	exceptvalr   p_const_charr   finalcclassr;   setnamespointerconstAVPixFmtDescriptorNULLdescav_pix_fmt_desc_nextaddr   r|   r   r   <module>r      sn     9  (-7<4  #%%U3f)) c.?.?  4  lQ lQ  lQ^ 7U 7U  7Ut 	~~fnnV\\#2H2H%IJFKKX
##D)D	IIdii	 r   