
    3j`              	          S SK JrJr  S SKrS SKJr  S SKJrJ	r	  S SK
JrJr  S SKJr  S SKJr  S SKJr  S S	KJrJr  S S
KJr  S SKJr  S SKJr  \R8                  " \\" 5       5      r\R>                  S\R@                  \RB                     S\R@                  \RD                  \RF                        S\$S\%4S j5       r& " S S\5      r' " S S\5      r( " S S\5      r)\RT                   " S S5      5       r%g)    )FlagIntEnumN)libav)
ByteSource
bytesource)Codec
wrap_codec)
Dictionary)	err_check)Packet)avrational_to_fractionto_avrational)EAGAIN)uint8_t)memcpyc_ctxc_codechwaccelreturnc                 n   U R                   [        R                  :X  a  SSKJn  U" [
        5      nOqU R                   [        R                  :X  a  SSKJn  U" [
        5      nO@U R                   [        R                  :X  a  SSK
Jn  U" [
        5      nO[        [
        5      nUR                  XU5        U$ )z8Build an bv.CodecContext for an existing AVCodecContext.r   )VideoCodecContext)AudioCodecContext)SubtitleCodecContext)
codec_typelibAVMEDIA_TYPE_VIDEOav.video.codeccontextr   _cinit_sentinelAVMEDIA_TYPE_AUDIOav.audio.codeccontextr   AVMEDIA_TYPE_SUBTITLEav.subtitles.codeccontextr   CodecContext_init)r   r   r   r   py_ctxr   r   s          J/home/wildlama/miniconda3/lib/python3.13/site-packages/av/codec/context.pywrap_codec_contextr'      s     3111;"?3			S33	3;"?3			S66	6B%o6o.
LL)M    c                       \ rS rSr% Sr\R                  rS\S'   \R                  r
S\S'   \R                  \R                  -  rS\S'   S	rg
)
ThreadType/   r   z"Decode more than one frame at onceFRAMEz3Decode more than one part of a single frame at onceSLICEz*Decode using both FRAME and SLICE methods.AUTO N)__name__
__module____qualname____firstlineno__NONEr   FF_THREAD_FRAMEr,   __annotations__FF_THREAD_SLICEr-   r.   __static_attributes__r/   r(   r&   r*   r*   /   sJ    D252E2EE/ECFCVCVE@Vc111 	
6 r(   r*   c                      \ rS rSr\R
                  r\R                  r\R                  r
\R                  r\R                  r\R                  r\R"                  r\R&                  r\R*                  r\R.                  r\R2                  r\R6                  r\R:                  r\R>                  r \RB                  r"\RF                  r$\RJ                  r&\RN                  r(\RR                  r*\RV                  r,Sr-g)Flags8   r/   N).r0   r1   r2   r3   r   AV_CODEC_FLAG_UNALIGNED	unalignedAV_CODEC_FLAG_QSCALEqscaleAV_CODEC_FLAG_4MVfour_mvAV_CODEC_FLAG_OUTPUT_CORRUPToutput_corruptAV_CODEC_FLAG_QPELqpelAV_CODEC_FLAG_RECON_FRAMErecon_frameAV_CODEC_FLAG_COPY_OPAQUEcopy_opaqueAV_CODEC_FLAG_FRAME_DURATIONframe_durationAV_CODEC_FLAG_PASS1pass1AV_CODEC_FLAG_PASS2pass2AV_CODEC_FLAG_LOOP_FILTERloop_filterAV_CODEC_FLAG_GRAYgrayAV_CODEC_FLAG_PSNRpsnrAV_CODEC_FLAG_INTERLACED_DCTinterlaced_dctAV_CODEC_FLAG_LOW_DELAY	low_delayAV_CODEC_FLAG_GLOBAL_HEADERglobal_headerAV_CODEC_FLAG_BITEXACTbitexactAV_CODEC_FLAG_AC_PREDac_predAV_CODEC_FLAG_INTERLACED_MEinterlaced_meAV_CODEC_FLAG_CLOSED_GOP
closed_gopr8   r/   r(   r&   r:   r:   8   s    ++I%%F##G55N!!D//K//K55N##E##E//K!!D!!D55N++I33M))H''G33M--Jr(   r:   c                       \ rS rSr\R
                  r\R                  r\R                  r
\R                  r\R                  r\R                  r\R"                  r\R&                  r\R*                  rSrg)Flags2O   r/   N)r0   r1   r2   r3   r   AV_CODEC_FLAG2_FASTfastAV_CODEC_FLAG2_NO_OUTPUT	no_outputAV_CODEC_FLAG2_LOCAL_HEADERlocal_headerAV_CODEC_FLAG2_CHUNKSchunksAV_CODEC_FLAG2_IGNORE_CROPignore_cropAV_CODEC_FLAG2_SHOW_ALLshow_allAV_CODEC_FLAG2_EXPORT_MVS
export_mvsAV_CODEC_FLAG2_SKIP_MANUALskip_manualAV_CODEC_FLAG2_RO_FLUSH_NOOPro_flush_noopr8   r/   r(   r&   re   re   O   se    ""D,,I22L&&F00K**H..J00K44Mr(   re   c                      \ rS rSr\SFS j5       rSGS jr\R                  S\R                  \
R                     S\R                  \R                  \
R                        S\4S j5       r\S	 5       r\R$                  S
\R&                  4S j5       r\S 5       r\R$                  S 5       r\S 5       r\R$                  S 5       r\S 5       r\R$                  S
\R&                  4S j5       r\S 5       r\R$                  S 5       r\S 5       r\S 5       r\S 5       r\R6                  SHS\R8                  4S jj5       rS rS rSGS jr \S 5       r!S\"S-  4S jr#\R                  S\"S-  S \$4S! j5       r%\R                  S \"4S" j5       r&\R                  S# 5       r'\R                  S\"4S$ j5       r(\R                  S% 5       r)\R                  S\"4S& j5       r*\R6                  SGS\"S-  4S' jj5       r+SGS\"S-  4S( jjr,\R                  S)\-4S* j5       r.\R6                  SGS)\-S-  4S+ jj5       r/\R6                  S, 5       r0\R                  S\"S)\-S-  4S- j5       r1\S. 5       r2\S/ 5       r3\S0 5       r4\S1 5       r5\5R$                  S2 5       r5\S3 5       r6\6R$                  S4 5       r6\S5 5       r7\7R$                  S6 5       r7\\Rp                  " S5      S7 5       5       r9\9R$                  S
\R&                  4S8 j5       r9\S9 5       r:\:R$                  S
\R&                  4S: j5       r:\S; 5       r;\S< 5       r<\<R$                  S
\R&                  4S= j5       r<\S> 5       r=\=R$                  S
\R&                  4S? j5       r=\S@ 5       r>\>R$                  SA 5       r>\SB 5       r?\?R$                  SC 5       r?\SD 5       r@SErAg)Ir#   [   Nc                     [        U [        5      (       a  U O
[        X5      n[        R                  " UR                  5      n[        XCR                  U5      $ N)
isinstancer   r   avcodec_alloc_context3ptrr'   )codecmoder   cy_codecr   s        r&   createCodecContext.create]   sD    #-eU#;#;%uAS474N4NLL5
 "%w??r(   c                 V    U[         La  [        S5      e0 U l        SU l        SU l        g )NzCannot instantiate CodecContextF)r   RuntimeErroroptionsstream_indexis_open)selfsentinelargskwargss       r&   	__cinit__CodecContext.__cinit__e   s,    ?*@AAr(   r   r   r   c                 b   Xl         U R                   R                  (       a,  U(       a%  U R                   R                  U:w  a  [        S5      e[        U[        R
                  :w  a  UOU R                   R                  5      U l        X0l        SU R                   l        SU R                   l        g )Nz,Wrapping CodecContext with mismatched codec.r      )	r   r   r   r	   cythonNULLr   thread_countthread_type)r   r   r   r   s       r&   r$   CodecContext._initm   sq     88>>e%(?MNN&++)=488>>R
 !"#r(   c                 .    U R                   R                  $ )z=
Get and set the flags bitmask of CodecContext.

:rtype: int
r   flagsr   s    r&   r   CodecContext.flags~        xx~~r(   valuec                 $    XR                   l        g r|   r   r   r   s     r&   r   r      s    r(   c                 b    [        U R                  R                  [        R                  -  5      $ )z!
Use fixed qscale.

:rtype: bool
)boolr   r   r   r>   r   s    r&   r?   CodecContext.qscale   s"     DHHNNS%=%==>>r(   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r|   )r   r   r   r>   r   s     r&   r?   r      s8    HHNNc666NHHNNs7777Nr(   c                 b    [        U R                  R                  [        R                  -  5      $ r|   )r   r   r   r   rH   r   s    r&   rI   CodecContext.copy_opaque   s     DHHNNS%B%BBCCr(   c                     U(       a.  U R                   =R                  [        R                  -  sl        g U R                   =R                  [        R                  ) -  sl        g r|   )r   r   r   rH   r   s     r&   rI   r      s8    HHNNc;;;NHHNNs<<<<Nr(   c                 .    U R                   R                  $ )z>
Get and set the flags2 bitmask of CodecContext.

:rtype: int
r   flags2r   s    r&   r   CodecContext.flags2   s     xxr(   c                 $    XR                   l        g r|   r   r   s     r&   r   r      s    r(   c                 T   U R                   [        R                  L a  g U R                   R                  S:  ap  [        R                  " [
        [        R                  " [        R                  [           U R                   R                  5      S U R                   R                   5      $ g Nr   )	r   r   r   extradata_sizecastbytespointerr   	extradatar   s    r&   r   CodecContext.extradata   su    88v{{"88""Q&;;FNN73TXX5G5GH-dhh--  r(   c                    UcP  [         R                  " [        R                  " U R                  R
                  5      5        SU R                  l        g [        U5      n[        R                  " [        R                  [           [         R                  " U R                  R
                  UR                  [         R                  -   5      5      U R                  l        U R                  R
                  (       d  [        S5      e[        U R                  R
                  UR                  UR                  5        UR                  U R                  l        g )Nr   zCannot allocate extradata)r   av_freepr   addressr   r   r   r   r   r   r   
av_realloclengthAV_INPUT_BUFFER_PADDING_SIZEMemoryErrorr   )r   datasources      r&   r   r      s    <LL(:(:;<&'DHH#%F!'w'HH&&8X8X(X"DHH 88%%!"=>>488%%vzz6==A&,mmDHH#r(   c                 .    U R                   R                  $ r|   )r   r   r   s    r&   r   CodecContext.extradata_size   s    xx&&&r(   c                     U R                   [        R                  L a  g[        R                  " U R                   R
                  5      $ NF)r   r   r   r   av_codec_is_encoderr   r   s    r&   
is_encoderCodecContext.is_encoder   .    88v{{"&&txx~~66r(   c                     U R                   [        R                  L a  g[        R                  " U R                   R
                  5      $ r   )r   r   r   r   av_codec_is_decoderr   r   s    r&   
is_decoderCodecContext.is_decoder   r   r(   Tstrictc           	         U R                   (       a  U(       a  [        S5      eg [        5       nUR                  U R                  =(       d    0 5        U R
                  R                  R                  (       GdT  U R                  (       GaB  U R                  S:X  a  U R
                  R                  R                  =(       d    SU R
                  R                  l        U R
                  R                  R                  =(       d    [        R                  U R
                  R                  l        OU R                  S:X  aK  SU R
                  R                  l        U R
                  R                  U R
                  R                  l        ODSU R
                  R                  l        [        R                  U R
                  R                  l        [        [        R                   " U R
                  U R"                  R
                  [$        R&                  " UR
                  5      5      SU R"                  R(                   SU R                   S35        SU l         [+        U5      U l        g )	NzCodecContext is already open.video   audiozavcodec_open2("z", )T)r   
ValueErrorr
   updater   r   	time_basenumr   type	frameratedenr   AV_TIME_BASEsample_rater   avcodec_open2r   r   r   namedict)r   r   r   s      r&   openCodecContext.open   s   << !@AA(lt||)r*xx!!%%%$///yyG#)-););)?)?)D1""&)-););)?)?)S3CSCS""&g%)*""&)-)=)=""&)*""&),)9)9""&dhh

w{{8STdjjoo.c$,,qA	
 G}r(   c                 n   U R                   (       ar  [        R                  " [        R                  " U R                   R
                  5      5        [        R                  " [        R                  " U R                   5      5        U R                  (       a!  [        R                  " U R                  5        g g r|   )	r   r   r   r   r   r   avcodec_free_contextparserav_parser_closer   s    r&   __dealloc__CodecContext.__dealloc__   sa    88LL(:(:;<$$V^^DHH%=>;;, r(   c           
          U R                   =(       d    SnU R                  =(       d    SnSU R                  R                   SU SU S[	        U 5      S S3	$ )	Nz<notype>z	<nocodec>z<av. /z at 0xx>)r   r   	__class__r0   id)r   _typer   s      r&   __repr__CodecContext.__repr__  sP    		'Zyy'Kdnn--.awavVBtHQ<qQQr(   c                    U R                   (       dl  [        R                  " U R                  R                  R
                  5      U l         U R                   (       d"  [        SU R                  R                   35      e[        USS9nUb  UR                  O[        R                  nUb  UR                  OSnSn/ n [        R                     [        R                  " U R                   U R                  [        R                  " W5      [        R                  " W5      UU[        R                  [        R                  S5	      n	SSS5        [!        W	5        W(       Ga3  [#        U5      n[%        UR                  R&                  WU5        U R                   R(                  UR                  l        U R                   R*                  UR                  l        U R                   R,                  UR                  l        U R                   R.                  (       a%  U R                   R.                  UR                  l        U R                   R0                  S:X  a-  UR                  =R2                  [        R4                  -  sl        UR7                  U5        U(       d   U$ X9-  nXI-  nU(       d   U$ GM  ! , (       d  f       GNt= f)a  Split up a byte stream into list of :class:`.Packet`.

This is only effectively splitting up a byte stream, and does no
actual interpretation of the data.

It will return all packets that are fully contained within the given
input, and will buffer partial packets until they are complete.

Any timing information the parser is able to infer (``pts``, ``dts``,
``duration``, ``pos`` and the keyframe flag) is assigned onto the
returned packets. Fields the parser cannot determine are left unset.

:param ByteSource raw_input: A chunk of a byte-stream to process.
    Anything that can be turned into a :class:`.ByteSource` is fine.
    ``None`` or empty inputs will flush the parser's buffers.

:return: ``list`` of :class:`.Packet` newly available.

zNo parser for T)
allow_noneNr   r   )r   r   av_parser_initr   r   r   r   r   r   r   r   r   nogilav_parser_parse2r   AV_NOPTS_VALUEr   r   r   r   ptsdtsposduration	key_framer   AV_PKT_FLAG_KEYappend)
r   	raw_inputr   in_datain_sizepacketpacketsout_dataout_sizeconsumeds
             r&   parseCodecContext.parse
  s   * {{,,TZZ^^->->?DK;; >$**//1B!CDD'	dC060B&**/5/Afmmq
 //KKHHNN8,NN8,&&&&
  h  )vzz(; "&

!%

!%

;;''*.++*>*>FJJ';;((A-JJ$$(;(;;$v&  GGk s   A7J11
K c                     U R                   SL$ )zV
Returns ``True`` if this codec context is hardware accelerated, ``False`` otherwise.
N)hwaccel_ctxr   s    r&   
is_hwaccelCodecContext.is_hwaccelf  s    
 t++r(   framec              #   ^  #    [         R                     [        R                  " U R                  Ub  UR                  O[         R
                  5      nS S S 5        [        WS5        U R                  5       nU(       a  Uv   U R                  5       nU(       a  M  g g ! , (       d  f       NP= f7f)Nzavcodec_send_frame())r   r   r   avcodec_send_framer   r   r   _recv_packetr   r	  resr   s       r&   _send_frame_and_recv!CodecContext._send_frame_and_recvm  sz      \\((u'8%))fkkC  	#-.""$L&&(F f \s#   B-?BAB-B-
B*&B-r   c                     U/$ r|   r/   r   r	  s     r&   _prepare_frames_for_encode'CodecContext._prepare_frames_for_encode{  s	    wr(   c                     [        S5      e)Nz Base CodecContext cannot decode.)NotImplementedErrorr   s    r&   _alloc_next_frameCodecContext._alloc_next_frame  s    !"DEEr(   c                    U R                   (       d  U R                  5       U l         U R                   n[        R                     [        R
                  " U R                  UR                  5      nS S S 5        W[        * :X  d  U[        R                  :X  a  g [        US5        U R                  U5      nU(       d	  S U l         U$ g ! , (       d  f       N\= f)Nzavcodec_receive_frame())_next_framer  r   r   r   avcodec_receive_framer   r   AVERROR_EOFr   _transfer_hwframe)r   r	  r  s      r&   _recv_frameCodecContext._recv_frame  s    #557D'' \\++DHHeii@C  6'>SCOO3#01&&u-#DL  \s   ,C
Cc                     U$ r|   r/   r  s     r&   r  CodecContext._transfer_hwframe  s    r(   c                 ,   [        5       n[        R                     [        R                  " U R
                  UR
                  5      nS S S 5        W[        * :X  d  U[        R                  :X  a  g [        US5        U(       d  U$ g ! , (       d  f       ND= f)Nzavcodec_receive_packet())	r   r   r   r   avcodec_receive_packetr   r   r  r   )r   r   r  s      r&   r  CodecContext._recv_packet  sj     \\,,TXXvzzBC  6'>SCOO3#12M  \s   ,B
Bc                 2   U R                   R                  [        R                  [        R                  4;  a  [        S5      eU R                  SS9  U R                  U5      nU H-  nUc  M  UR                  U R                   R                  5        M/     U$ )Nz/Encoding is only supported for audio and video.Fr   )
r   r   r   r   r   r  r   r  _rebase_timer   )r   r	  framess      r&   *_prepare_and_time_rebase_frames_for_encode7CodecContext._prepare_and_time_rebase_frames_for_encode  s    88s'='=s?U?U&VV%&WXX			007 E ""488#5#56  r(   c                     / nU R                  U5       H=  nU R                  U5       H%  nU R                  U5        UR                  U5        M'     M?     U$ )zAEncode a list of :class:`.Packet` from the given :class:`.Frame`.)r)  r  _setup_encoded_packetr   r  s       r&   encodeCodecContext.encode  sU     DDUKE33E:**62

6" ; L 
r(   c              #      #    U R                  U5       H0  nU R                  U5       H  nU R                  U5        Uv   M     M2     g 7fr|   )r)  r  r,  r   r	  r   s      r&   encode_lazyCodecContext.encode_lazy  sC     DDUKE33E:**62 ; Ls   AA	r   c                 N    U R                   R                  UR                   l        g r|   )r   r   )r   r   s     r&   r,  "CodecContext._setup_encoded_packet  s      $xx11

r(   c                     U R                   R                  (       d  [        S5      eU R                  SS9  [        R
                     [        R                  " U R                  Ub  UR                  O[        R                  5      nSSS5        [        WS5        / nU R                  5       nU(       a;  U R                  XA5        UR                  U5        U R                  5       nU(       a  M;  U$ ! , (       d  f       Np= f)a  Decode a list of :class:`.Frame` from the given :class:`.Packet`.

If the packet is None, the buffers will be flushed. This is useful if
you do not want the library to automatically re-order frames for you
(if they are encoded with a codec that has B-frames).

.. warning::

    This method is **not thread-safe**. Calling :meth:`decode` concurrently
    from multiple threads on the same :class:`CodecContext` will corrupt
    internal FFmpeg state and likely cause a crash (segfault). FFmpeg 8.1
    enforces this more strictly than earlier releases. If you need to decode
    from multiple threads, give each thread its own :class:`CodecContext`.

zcannot decode unknown codecFr&  Nzavcodec_send_packet())r   r   r   r   r   r   r   avcodec_send_packetr   r   r  _setup_decoded_framer   )r   r   r  outr	  s        r&   decodeCodecContext.decode  s    " zz~~:;;			 \\))(:&**C  	#./  "%%e4JJu$$&E e 
 \s   ?C//
C=c                     U R                   (       a:  [        R                     [        R                  " U R
                  5        SSS5        gg! , (       d  f       g= f)zReset the internal codec state and discard all internal buffers.

Should be called before you start decoding from a new position e.g.
when seeking or when switching to a different stream.

N)r   r   r   r   avcodec_flush_buffersr   r   s    r&   flush_buffersCodecContext.flush_buffers  s6     <<))$((3  s   !A
Ac                 B    Ub  UR                   R                  Ul        g g r|   )r   r   
_time_baser0  s      r&   r7  !CodecContext._setup_decoded_frame  s!     %zz33E r(   c                 .    U R                   R                  $ r|   )r   r   r   s    r&   r   CodecContext.name      zzr(   c                 .    U R                   R                  $ r|   )r   r   r   s    r&   r   CodecContext.type  rD  r(   c                    / nU R                   R                  (       a@  U R                  R                  (       a%  U R                  R                  R                  (       d  U$ U R                  R                  nSnUR                  U   R                  [
        R                  :w  aZ  UR                  UR                  U   R                  5        US-  nUR                  U   R                  [
        R                  :w  a  MZ  U$ )z@
List the available profiles for this stream.

:type: list[str]
r   r   )	r   r   descprofilesprofiler   AV_PROFILE_UNKNOWNr   r   )r   retrH  is       r&   rI  CodecContext.profiles  s     xx~~TZZ__DJJOO<T<TJ zzmmA&&#*@*@@JJt}}Q',,-FA mmA&&#*@*@@ 
r(   c                 <   U R                   R                  (       a@  U R                  R                  (       a%  U R                  R                  R                  (       d  g U R                  R                  nSnUR                  U   R                  [
        R                  :w  a}  UR                  U   R                  U R                   R                  :X  a  UR                  U   R                  $ US-  nUR                  U   R                  [
        R                  :w  a  M|  g g Nr   r   )r   r   rH  rI  rJ  r   rK  r   )r   rH  rM  s      r&   rJ  CodecContext.profile/  s    xx~~TZZ__DJJOO<T<T zzmmA&&#*@*@@}}Q''488+;+;;}}Q',,,FA mmA&&#*@*@@r(   c                     U R                   (       a@  U R                   R                  (       a%  U R                   R                  R                  (       d  g U R                   R                  nSnUR                  U   R                  [        R
                  :w  ay  UR                  U   R                  U:X  a)  UR                  U   R                  U R                  l        g US-  nUR                  U   R                  [        R
                  :w  a  Mx  g g rP  )r   rH  rI  rJ  r   rK  r   r   )r   r   rH  rM  s       r&   rJ  rQ  =  s    zz

8P8P zzmmA&&#*@*@@}}Q$$-#'==#3#;#; FA	 mmA&&#*@*@@r(   c                     U R                   (       a  [        S5      e[        [        R                  " U R
                  R                  5      5      $ Nz&Cannot access 'time_base' as a decoder)r   r   r   r   r   r   r   r   s    r&   r   CodecContext.time_baseL  s3    ??GHH%fnnTXX5G5G&HIIr(   c                     U R                   (       a  [        S5      e[        U[        R                  " U R
                  R                  5      5        g rT  )r   r   r   r   r   r   r   r   s     r&   r   rU  R  s2    ??GHHeV^^DHH,>,>?@r(   c                 f    U R                   R                  R                  SSSS9R                  SS9$ )N   littleF	byteordersignedasciiencoding)r   	codec_tagto_bytesr9  r   s    r&   r`  CodecContext.codec_tagX  s:    xx!!**1*OVV W 
 	
r(   c                     [        U[        5      (       aA  [        U5      S:X  a2  [        R	                  UR                  SS9SSS9U R                  l        g [        S5      e)NrX  r]  r^  rY  FrZ  z)Codec tag should be a 4 character string.)	r}   strlenint
from_bytesr-  r   r`  r   r   s     r&   r`  rb  ^  sS    eS!!c%jAo!$g.(5 "0 "DHH HIIr(   c                 P    U R                   R                  [        R                  -  $ )zGlobal quality for codecs which cannot change it per frame.

Stored internally in lambda units; this property converts to/from
QP units using ``FF_QP2LAMBDA``.

Wraps :ffmpeg:`AVCodecContext.global_quality`.

)r   global_qualityr   FF_QP2LAMBDAr   s    r&   ri  CodecContext.global_qualityg  s     xx&&#*:*:::r(   c                 H    U[         R                  -  U R                  l        g r|   )r   rj  r   ri  r   s     r&   ri  rk  t  s    "'#*:*:":r(   c                 f    U R                   R                  S:  a  U R                   R                  $ S $ r   r   bit_rater   s    r&   ro  CodecContext.bit_ratex  s(    $(HH$5$5$9txx  CtCr(   c                 $    XR                   l        g r|   rn  r   s     r&   ro  rp  |  s    !r(   c                 d    U R                   R                  S:  a  U R                   R                  $ g r   )r   rc_max_rater   s    r&   max_bit_rateCodecContext.max_bit_rate  s'    88!#88'''r(   c                 0    U R                   R                    g r|   r   bit_rate_tolerancer   s    r&   rx  CodecContext.bit_rate_tolerance  s    ##r(   c                 $    XR                   l        g r|   rw  r   s     r&   rx  ry    s    &+#r(   c                 .    U R                   R                  $ )zVHow many threads to use; 0 means auto.

Wraps :ffmpeg:`AVCodecContext.thread_count`.

)r   r   r   s    r&   r   CodecContext.thread_count  s     xx$$$r(   c                 \    U R                   (       a  [        S5      eXR                  l        g )Nz/Cannot change thread_count after codec is open.)r   r   r   r   r   s     r&   r   r|    s    <<PQQ %r(   c                 @    [        U R                  R                  5      $ )zKOne of :class:`.ThreadType`.

Wraps :ffmpeg:`AVCodecContext.thread_type`.

)r*   r   r   r   s    r&   r   CodecContext.thread_type  s     $((..//r(   c                 "   U R                   (       a  [        S5      e[        U5      [        L a  XR                  l        g [        U5      [        L a#  [        U   R                  U R                  l        g UR                  U R                  l        g )Nz.Cannot change thread_type after codec is open.)	r   r   r   rf  r   r   rd  r*   r   r   s     r&   r   r    s^    <<OPP;##(HH %[C#-e#4#:#:DHH #(;;DHH r(   c                 Z   U R                   R                  nU[        R                  :X  a  gU[        R                  :X  a  gU[        R
                  :X  a  gU[        R                  :X  a  gU[        R                  :X  a  gU[        R                  :X  a  gU[        R                  :X  a  gU $ )a^  Returns one of the following str literals:

"NONE" Discard nothing
"DEFAULT" Discard useless packets like 0 size packets in AVI
"NONREF" Discard all non reference
"BIDIR" Discard all bidirectional frames
"NONINTRA" Discard all non intra frames
"NONKEY Discard all frames except keyframes
"ALL" Discard all

Wraps :ffmpeg:`AVCodecContext.skip_frame`.
r4   DEFAULTNONREFBIDIRNONINTRANONKEYALL)
r   
skip_framer   AVDISCARD_NONEAVDISCARD_DEFAULTAVDISCARD_NONREFAVDISCARD_BIDIRAVDISCARD_NONINTRAAVDISCARD_NONKEYAVDISCARD_ALLr   s     r&   r  CodecContext.skip_frame  s     ##C&&&C)))C(((C'''C***C(((C%%%r(   c                 ,   US:X  a   [         R                  U R                  l        g US:X  a   [         R                  U R                  l        g US:X  a   [         R
                  U R                  l        g US:X  a   [         R                  U R                  l        g US:X  a   [         R                  U R                  l        g US:X  a   [         R                  U R                  l        g US:X  a   [         R                  U R                  l        g [        S5      e)	Nr4   r  r  r  r  r  r  zInvalid skip_frame type)r   r  r   r  r  r  r  r  r  r  r   r   s     r&   r  r    s    F?"%"4"4DHHi"%"7"7DHHh"%"6"6DHHg"%"5"5DHHj "%"8"8DHHh"%"6"6DHHe^"%"3"3DHH677r(   c                 .    U R                   R                  $ )z5Codec delay.

Wraps :ffmpeg:`AVCodecContext.delay`.

)r   delayr   s    r&   r  CodecContext.delay  r   r(   )r  r   r   r   r   r   r   r   )NNr|   )T)Br0   r1   r2   r3   staticmethodr   r   r   cfuncr   r   AVCodecContextconstAVCodecHWAccelr$   propertyr   setterrf  r?   rI   r   r   r   r   r   ccallbintr   r   r   r  r  Framer  listr  r  r  r  r  r)  r-  r1  r   r,  r9  r=  r7  r   r   rI  rJ  r   r`  	cdivisionri  ro  rt  rx  r   r   r  r  r8   r/   r(   r&   r#   r#   [   s   @ @ \\$^^C../$ ~~fll3;;78$ 	$ $    \\6::   ? ? ]]8 8 D D = =   ]] FJJ     
 
 4 4" ' ' 7 7
 7 7
 \\%6;; % %6-R
Zx , ,)%$, ) \\    \\F5 F F \\ ( \\u   \\  \\    \\EDL    \\2F 2 2 \\"Vd] " "H \\	4 	4 \\4% 4$ 4 4      (   ^^  J J
 A A
 
 

 J J d	;  	; ;FJJ ; ; D D __"fjj " "   $ $ ,

 , , % % &&** & &
 0 0 / /  < 8 8$  r(   r#   )+enumr   r   r   cython.cimportsr   r   cython.cimports.av.bufferr   r   cython.cimports.av.codec.codecr   r	   cython.cimports.av.dictionaryr
   cython.cimports.av.errorr   cython.cimports.av.packetr   cython.cimports.av.utilsr   r   cython.cimports.libc.errnor   cython.cimports.libc.stdintr   cython.cimports.libc.stringr   declareobjectr   r  r   r  r  r  r  r#   r'   r*   r:   re   cclassr/   r(   r&   <module>r     s      ( < < 4 . , J - / ...2 >>#,,-^^FLL56  	 8 .G ..	5W 	5 O
 O
 O
r(   