
    C1i                     t    S SK r S SKJr  S SKJr  S SKJrJr  S SK	J
r
  \ R                   " S S\5      5       rg)    N)libav)Packet)avrational_to_fractionto_avrational)
VideoFramec                       \ rS rSrS rS r\R                  SS\S-  4S jj5       r	\R                  SS\
S-  4S jj5       r\S	 5       r\S
 5       r\S 5       r\S 5       r\S 5       rSrg)VideoStream   c                    SU R                    SU R                   SU R                  (       a  U R                  R                  OS  SU R                  R                   SU R                  R
                   S[        U 5      S S3$ )Nz<av.VideoStream # z, xz at 0x>)indexnameformatcodec_contextwidthheightidselfs    I/home/james-whalen/.local/lib/python3.13/site-packages/av/video/stream.py__repr__VideoStream.__repr__
   sq    

|1TYYKr#';;t{{D94;M;M;S;S:TTU!!(()4|1>	
    c                     US;   a%  [        S[        U 5      R                   SU S35      e[        U R                  U5      $ )N)	frameraterate'z' object has no attribute ')AttributeErrortype__name__getattrr   )r   r   s     r   __getattr__VideoStream.__getattr__   sK    (( DJ''((CD6K  t))400r   Nframec                     U R                   R                  U5      nU H.  nXl        U R                  R                  UR                  l        M0     U$ )z
Encode an :class:`.VideoFrame` and return a list of :class:`.Packet`.

:rtype: list[Packet]

.. seealso:: This is mostly a passthrough to :meth:`.CodecContext.encode`.
)r   encode_streamptrr   stream_index)r   r&   packetspackets       r   r(   VideoStream.encode   sD     $$++E2F!N&*hhnnFJJ#  r   r-   c                 8    U R                   R                  U5      $ )z
Decode a :class:`.Packet` and return a list of :class:`.VideoFrame`.

:rtype: list[VideoFrame]

.. seealso:: This is a passthrough to :meth:`.CodecContext.decode`.
)r   decode)r   r-   s     r   r0   VideoStream.decode*   s     !!((00r   c                 h    [        [        R                  " U R                  R                  5      5      $ )z
The average frame rate of this video stream.

This is calculated when the file is opened by looking at the first
few frames and averaging their rate.

:type: fractions.Fraction | None
)r   cythonaddressr*   avg_frame_rater   s    r   average_rateVideoStream.average_rate5   s"     &fnnTXX5L5L&MNNr   c                 h    [        [        R                  " U R                  R                  5      5      $ )z
The base frame rate of this stream.

This is calculated as the lowest framerate at which the timestamps of
frames can be represented accurately. See :ffmpeg:`AVStream.r_frame_rate`
for more.

:type: fractions.Fraction | None
)r   r3   r4   r*   r_frame_rater   s    r   	base_rateVideoStream.base_rateA   s"     &fnnTXX5J5J&KLLr   c                     [         R                  " [        R                  U R                  [        R                  5      n[        [        R                  " U5      5      $ )zThe guessed frame rate of this stream.

This is a wrapper around :ffmpeg:`av_guess_frame_rate`, and uses multiple
heuristics to decide what is "the" frame rate.

:type: fractions.Fraction | None
)libav_guess_frame_rater3   NULLr*   r   r4   )r   vals     r   guessed_rateVideoStream.guessed_rateN   s=     "55KK6;;
 &fnnS&9::r   c                     [         R                  " U R                  R                  U R                  [        R
                  5      n[        [        R                  " U5      5      $ )zThe guessed sample aspect ratio (SAR) of this stream.

This is a wrapper around :ffmpeg:`av_guess_sample_aspect_ratio`, and uses multiple
heuristics to decide what is "the" sample aspect ratio.

:type: fractions.Fraction | None
)r=   av_guess_sample_aspect_ratio	containerr*   r3   r?   r   r4   )r   sars     r   sample_aspect_ratioVideoStream.sample_aspect_ratio\   sC     ">>NN&++
 &fnnS&9::r   c                    [         R                  " [        R                  5      n[        R                  " [         R
                  " UR                  5      [         R
                  " UR                  5      U R                  R                  U R                  R                  -  U R                  R                  U R                  R                  -  S5        [        [         R
                  " U5      5      $ )zThe guessed display aspect ratio (DAR) of this stream.

This is calculated from :meth:`.VideoStream.guessed_sample_aspect_ratio`.

:type: fractions.Fraction | None
i   )r3   declarer=   
AVRational	av_reducer4   numdenr   r   rG   r   r   )r   dars     r   display_aspect_ratio VideoStream.display_aspect_ratioj   s     nnS^^,NN377#NN377#KK 8 8 < <<KK!9!9!=!==	
 &fnnS&9::r    )N)r"   
__module____qualname____firstlineno__r   r$   r3   ccallr   r(   r   r0   propertyr6   r:   rA   rG   rP   __static_attributes__rR   r   r   r	   r	      s    
1 \\J-    \\1Vd] 1 1 	O 	O 
M 
M ; ; ; ; ; ;r   r	   )r3   cython.cimportsr   r=   cython.cimports.av.packetr   cython.cimports.av.utilsr   r   cython.cimports.av.video.framer   cclassStreamr	   rR   r   r   <module>r_      s6     ( , J 5 r;& r; r;r   