
    3j                        S SK r S SKJs  Jr  S SKJr  \ R                  " \\" 5       5      r	\ R                  S\ R                  \ R                  \R                        S\4S j5       r\ R                   \ R"                   " S S5      5       5       r\ R                  S\ R                  \R$                     S\4S j5       r\ R                   \ R"                   " S	 S
5      5       5       rg)    N)int64_tptrreturnc                 F    [        [        5      nUR                  U 5        U$ N)
IndexEntry_cinit_bypass_sentinel_initr   objs     B/home/wildlama/miniconda3/lib/python3.13/site-packages/av/index.pywrap_index_entryr      s     !78CIIcNJ    c                      \ rS rSrSrS r\R                  S\R                  \R                  \
R                        4S j5       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rg)r      zA single entry from a stream's index.

This is a thin wrapper around FFmpeg's ``AVIndexEntry``.

The exact meaning of the fields depends on the container/demuxer.
c                 ,    U[         La  [        S5      eg )Nz&cannot manually instantiate IndexEntryr	   RuntimeErrorselfsentinels     r   	__cinit__IndexEntry.__cinit__   s    11GHH 2r   r   c                     Xl         g r   r   r   r   s     r   r
   IndexEntry._init   s    r   c                     SU R                    SU R                   SU R                   SU R                   SU R                   S3$ )Nz<av.IndexEntry pos=z timestamp=z flags=z size=z min_distance=>)pos	timestampflagssizemin_distancer   s    r   __repr__IndexEntry.__repr__!   sK    !$((;t~~6Fgdjj\ ZII;nT->->,?qB	
r   c                 .    U R                   R                  $ r   )r   r    r%   s    r   r    IndexEntry.pos'   s    xx||r   c                 .    U R                   R                  $ r   )r   r!   r%   s    r   r!   IndexEntry.timestamp+   s    xx!!!r   c                 .    U R                   R                  $ r   )r   r"   r%   s    r   r"   IndexEntry.flags/   s    xx~~r   c                 b    [        U R                  R                  [        R                  -  5      $ r   )boolr   r"   libAVINDEX_KEYFRAMEr%   s    r   is_keyframeIndexEntry.is_keyframe3   s     DHHNNS%9%99::r   c                 b    [        U R                  R                  [        R                  -  5      $ r   )r/   r   r"   r0   AVINDEX_DISCARD_FRAMEr%   s    r   
is_discardIndexEntry.is_discard7   s     DHHNNS%>%>>??r   c                 .    U R                   R                  $ r   )r   r#   r%   s    r   r#   IndexEntry.size;   s    xx}}r   c                 .    U R                   R                  $ r   )r   r$   r%   s    r   r$   IndexEntry.min_distance?   s    xx$$$r   r   N)__name__
__module____qualname____firstlineno____doc__r   cythoncfuncpointerconstr0   AVIndexEntryr
   r&   propertyr    r!   r"   r2   r6   r#   r$   __static_attributes__ r   r   r   r      s    I \\S5E5E(FG  
   " "   ; ; @ @   % %r   r   c                 F    [        [        5      nUR                  U 5        U$ r   )IndexEntriesr	   r
   r   s     r   wrap_index_entriesrK   D   s    $%;<CIIcNJr   c                       \ rS rSrSrS r\R                  S\R                  \	R                     4S j5       rS rS\4S jrS	 rS
 rSSS.S\S\4S jjrSrg)rJ   K   a4  A sequence-like view of FFmpeg's per-stream index entries.

Exposed as :attr:`~av.stream.Stream.index_entries`.

The index is provided by the demuxer and may be empty or incomplete depending
on the container format. This is useful for fast multi-seek loops (e.g., decoding
at a lower-than-native framerate).
c                 ,    U[         L a  g [        S5      e)Nz(cannot manually instantiate IndexEntriesr   r   s     r   r   IndexEntries.__cinit__W   s    --EFFr   r   c                     Xl         g r   
stream_ptrr   s     r   r
   IndexEntries._init\   s    r   c                      S[        U 5       S3$ )Nz<av.IndexEntries[z]>)lenr%   s    r   r&   IndexEntries.__repr__`   s    "3t9+R00r   r   c                     [         R                     [        R                  " U R                  5      sS S S 5        $ ! , (       d  f       g = fr   )rA   nogilr0    avformat_index_get_entries_countrR   r%   s    r   __len__IndexEntries.__len__c   s%    \\77H \\s	    ;
A	c              #   N   #    [        [        U 5      5       H	  nX   v   M     g 7fr   )rangerU   )r   is     r   __iter__IndexEntries.__iter__g   s     s4y!A'M "s   #%c                 >   [        U[        5      (       a  [        U 5      nUS:  a  X-  nUS:  d  X:  a  [        SU SU 35      eUn[        R
                     [        R                  " U R                  U5      nS S S 5        W[        R                  :X  a  [        S5      e[        U5      $ [        U[        5      (       a<  UR                  [        U 5      5      u  pVn[        XVU5       Vs/ s H  oU   PM	     sn$ [        S5      e! , (       d  f       N= fs  snf )Nr   zIndex entries z out of bounds for size zindex entry not foundz#Index must be an integer or a slice)
isinstanceintrU   
IndexErrorrA   rX   r0   avformat_index_get_entryrR   NULLr   sliceindicesr]   	TypeError)	r   indexnc_idxentrystartstopstepr^   s	            r   __getitem__IndexEntries.__getitem__k   s    eS!!D	Aqy
qyEJ >%8PQRPS!TUU %E44T__eL # !899#E**u%% %c$i 8E%*5%=>%=G%=>>ABB  ?s   "D	-D	
DTF)backward	any_framers   rt   c                   UnSnU(       a  U[         R                  -  nU(       a  U[         R                  -  n[        R                     [         R
                  " U R                  XE5      nSSS5        U$ ! , (       d  f       W$ = f)zSearch the underlying index for ``timestamp``.

This wraps FFmpeg's ``av_index_search_timestamp``.

Returns an index into this object, or ``-1`` if no match is found.
r   N)r0   AVSEEK_FLAG_BACKWARDAVSEEK_FLAG_ANYrA   rX   av_index_search_timestamprR   )r   r!   rs   rt   c_timestampr"   idxs          r   search_timestampIndexEntries.search_timestamp   sl      )S---ES(((E\\//TC  
 \ 
s   	"A55
BrQ   N)r<   r=   r>   r?   r@   r   rA   rB   rC   r0   AVStreamr
   r&   rc   rZ   r_   rq   r/   r{   rG   rH   r   r   rJ   rJ   K   sx    G
 \\5  1I IC. .2U&*>B r   rJ   )rA   cython.cimports.libavcimportslibavr0   cython.cimports.libc.stdintr   declareobjectr	   rB   rC   rD   rE   r   r   finalcclassr}   rJ   rK   rH   r   r   <module>r      s     # # /9  &..c6F6F)GH Z   0% 0%  0%f FNN3<<8 \   H H  Hr   