+
    ÆÚjÊ  ã                  ó:  € ^ RI Ht ^ RIHtHt ^ RIHt ^ RIt^ RIt^ RI	t	^ RI
t
^ RIt^ RIt^ RIt ^RIHt R R lt ! R R	]4      t ! R
 R]4      t]! R4      tRt]! R4      tRtRR R lltRR R lltRR R lltRR R llt. ROtR#   ] d    Rt Lai ; i)é    )Úannotations)ÚAnyÚIterable)ÚPathN)Úmagicc               ó    € V ^8„  d   QhRRRR/# )é   ÚprogramÚstrÚreturnú
str | None© )Úformats   "ÚŠ/opt/data/installs/351f81cc06284494/environments/aa258815729c481f8402f54f4c368f83/venv/lib/python3.14/site-packages/mautrix/util/ffmpeg.pyÚ__annotate__r      s   € ÷ 3ñ 3�sð 3˜zñ 3ó    c                ó€   € \         P                  ! V 4      pV'       d    \        P                  P	                  V4      # R # ©N)ÚshutilÚwhichÚosÚpathÚabspath)r
   r   s   & r   Ú	_abswhichr      s*   € Ü�<Š<˜Ó €Dß$(Œ2�7‰7�?‰?˜4Ó Ð2¨dÐ2r   c                  ó   € ] tR t^tRtR# )ÚConverterErrorr   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   r   r   r   r      s   † Ûr   r   c                  ó.   a € ] tR t^!tR V 3R lltRtV ;t# )ÚNotInstalledErrorc               ó   € V ^8„  d   QhRR/# )r	   r   ÚNoner   )r   s   "r   r   ÚNotInstalledError.__annotate__"   s   € ÷ Oñ O˜$ñ Or   c                	ó&   <€ \         SV `  R 4       R# )z2failed to transcode media: ffmpeg is not installedN)ÚsuperÚ__init__)ÚselfÚ	__class__s   &€r   r)   ÚNotInstalledError.__init__"   s   ø€ Ü‰ÑÐMÖNr   r   )r   r   r   r    r)   r!   Ú__classcell__)r+   s   @r   r#   r#   !   s   ø† ÷Oö Or   r#   ÚffmpegÚffprobec               ó$   € V ^8„  d   QhRRRRRR/# )r	   Ú
input_fileúos.PathLike[str] | strÚloggerúlogging.Logger | Noner   r   r   )r   s   "r   r   r   6   s&   € ÷ "ñ "Ø&ð"à!ð"ð 	ñ"r   c           	   ƒ  ó¤  "  € \         f   \        4       h\        V 4      p \        P                  ! \         .\
        O\        V 4      N5R\        P                  P                  R\        P                  P                  R\        P                  P                  / G Rj  x€L
 pVP                  4       G Rj  x€L
 w  r4VP                  ^ 8w  d8   V'       d   VP                  R4      MRVP                   R2p\        RV 24      hV'       d,   V'       d$   VP                  R	VP                  R4       24       \        P                  ! V4      #  L¯ L™5i)
z÷
Probes a media file on the disk using ffprobe.

Args:
    input_file: The full path to the file.

Returns:
    A Python object containing the parsed JSON response from ffprobe

Raises:
    ConverterError: if ffprobe returns a non-zero exit code.
NÚstdoutÚstderrÚstdinúutf-8ú	unknown (Ú)zffprobe error: zffprobe warning: )Úffprobe_pathr#   r   ÚasyncioÚcreate_subprocess_execÚffprobe_default_paramsr   Ú
subprocessÚPIPEÚcommunicateÚ
returncodeÚdecoder   ÚwarningÚjsonÚloads)r1   r3   Úprocr6   r7   Úerr_texts   &&    r   Ú
probe_pathrJ   6   s   é € ô  ÒÜÓ!Ð!ä�jÓ!€JÜ×/Ò/Üðä	ðô 	ˆJ‹òô ×!Ñ!×&Ñ&ð	ô
 ×!Ñ!×&Ñ&ðô × Ñ ×%Ñ%ñ÷ €Dð  ×+Ñ+Ó-×-�N€FØ‡�˜!Ôß-3�6—=‘= Ô)¸9ÀTÇ_Á_ÐDUÐUVÐ9WˆÜ˜¨x¨jÐ9Ó:Ð:ß	—FØ�‰Ð*¨6¯=©=¸Ó+AÐ*BÐCÔDÜ�:Š:�fÓÐññ .ùs6   ‚BEÂEÂEÂ4EÂ5EÃ6EÄEÄ:EÅEc               ó(   € V ^8„  d   QhRRRRRRRR/# )	r	   ÚdataÚbytesÚ
input_mimer   r3   r4   r   r   r   )r   s   "r   r   r   [   s6   € ÷ Fñ FØ
ðFàðFð "ðFð 	ñ	Fr   c           	   ƒ  ó  "  € \         f   \        4       hVf*   \        f   \        R4      h\        P                  ! V 4      p\
        P                  ! V4      p\        P                  ! RR7      ;_uu_ 4       p\        V4      RV 2,          p\        VR4      ;_uu_ 4       pVP                  V 4       RRR4       \        WRR7      G Rj  x€L
 uuRRR4       #   + '       g   i     L.; i L!  + '       g   i     R# ; i5i)aL  
Probe media file data using ffprobe.

Args:
    data: The bytes of the file to probe.
    input_mime: The mime type of the input data. If not specified, will be guessed using magic.

Returns:
    A Python object containing the parsed JSON response from ffprobe

Raises:
    ConverterError: if ffprobe returns a non-zero exit code.
Nú7input_mime was not specified and magic is not installedÚmautrix_ffmpeg_©ÚprefixrL   Úwb)r1   r3   )r<   r#   r   Ú
ValueErrorÚmimetypeÚ	mimetypesÚguess_extensionÚtempfileÚTemporaryDirectoryr   ÚopenÚwriterJ   )rL   rN   r3   Úinput_extensionÚtmpdirr1   Úfiles   &&&    r   Úprobe_bytesr`   [   s½   é € ô$ ÒÜÓ!Ð!àÒÜŠ=ÜÐVÓWÐWÜ—^’^ DÓ)ˆ
Ü×/Ò/°
Ó;€OÜ	×	$Ò	$Ð,=×	>Õ	>À&Ü˜&“\ d¨?Ð*;Ð$<Õ<ˆ
Ü�*˜d×#Ô# tØ�J‰J�tÔ÷ $ä¨:ÔE×E÷	 
?Ò	>ç#×#úáE÷	 
?×	>Ð	>üsB   ‚A5DÁ7*C.Â!C	Â3C.Ã
C,ÃC.ÃDÃC)Ã$	C.Ã.C?	Ã9	Dc               ó8   € V ^8„  d   QhRRRRRRRRRR	R
RRRRR/# )r	   r1   r2   Úoutput_extensionr   Ú
input_argsúIterable[str] | NoneÚoutput_argsÚremove_inputÚboolÚoutput_path_overridezos.PathLike[str] | str | Noner3   r4   r   zPath | bytesr   )r   s   "r   r   r   |   sb   € ÷ @9ñ @9Ø&ð@9à ð@9ð %ð@9ð &ð	@9ð
 ð@9ð 8ð@9ð "ð@9ð ñ@9r   c           	   ƒ  óB  "  € \         f   \        4       hV'       d   TpV'       d   \        R4      hM?V'       g   \        R4      h\        V 4      p V P                  V P
                   V 2,          pW8X  d.   \        V4      pVP                  VP
                   RV 2,          p\        P                  ! \         .\        OT;'       g    RORN\        V 4      NT;'       g    RO\        V4      N5R\        P                  P                  R\        P                  P                  R\        P                  P                  / G Rj  x€L
 pVP                  4       G Rj  x€L
 w  ršVP                  ^ 8w  d8   V
'       d   V
P                  R	4      MR
VP                   R2p\        RV 24      hV
'       d,   V'       d$   VP!                  RV
P                  R	4       24       V'       d)   \#        V \        4      '       d   V P%                  RR7       VR8X  d   V	# T#  LÔ L¾5i)a  
Convert a media file on the disk using ffmpeg.

Args:
    input_file: The full path to the file.
    output_extension: The extension that the output file should be.
    input_args: Arguments to tell ffmpeg how to parse the input file.
    output_args: Arguments to tell ffmpeg how to convert the file to reach the wanted output.
    remove_input: Whether the input file should be removed after converting.
                  Not compatible with ``output_path_override``.
    output_path_override: A custom output path to use
                          (instead of using the input path with a different extension).

Returns:
    The path to the converted file, or the stdout if ``output_path_override`` was set to ``-``.

Raises:
    ConverterError: if ffmpeg returns a non-zero exit code.
Nz9remove_input can't be specified with output_path_overridez4output_extension or output_path_override is requiredz-newz-ir6   r7   r8   r9   r:   r;   zffmpeg error: zffmpeg warning: T)Ú
missing_okÚ-r   )Úffmpeg_pathr#   rU   r   ÚparentÚstemr=   r>   Úffmpeg_default_paramsr   r@   rA   rB   rC   rD   r   rE   Ú
isinstanceÚunlink)r1   rb   rc   re   rf   rh   r3   Úoutput_filerH   r6   r7   rI   s   &&&&&&&     r   Úconvert_pathrs   |   sÿ  é € ô8 ÒÜÓ!Ð!çØ*ˆßÜÐXÓYÐYð çÜÐOÓPÐPä˜*Ó%ˆ
Ø ×'Ñ'¨Z¯_©_Ð,=Ð>NÐ=OÐ*PÕPˆØÔ Ü˜;Ó'ˆØ!×(Ñ(¨k×.>Ñ.>Ð-?¸tÐDTÐCUÐ+VÕVˆä×/Ò/Üðä	ðð ×
Ð
˜ðð 	ð	ô
 	ˆJ‹ðð ×
Ð
˜ðô 	ˆKÓòô ×!Ñ!×&Ñ&ðô ×!Ñ!×&Ñ&ðô × Ñ ×%Ñ%ñ÷ €Dð  ×+Ñ+Ó-×-�N€FØ‡�˜!Ôß-3�6—=‘= Ô)¸9ÀTÇ_Á_ÐDUÐUVÐ9WˆÜ˜~¨h¨ZÐ8Ó9Ð9ß	—FØ�‰Ð)¨&¯-©-¸Ó*@Ð)AÐBÔCßœ
 :¬t×4Ò4Ø×Ñ TÐÔ*Ø  CÔ'ˆ6Ð8¨[Ð8ñ)ñ .ùsX   ‚H�	H§H»BHÃ
HÃ#A#HÅHÅHÅHÅHÅ>6HÆ5HÆ=*HÇ(4HÈHc               ó4   € V ^8„  d   QhRRRRRRRRRR	R
RRR/# )r	   rL   rM   rb   r   rc   rd   re   rN   r   r3   r4   r   r   )r   s   "r   r   r   ¿   sN   € ÷ ,ñ ,Ø
ð,àð,ð %ð,ð &ð	,ð
 ð,ð "ð,ð ñ,r   c           
   ƒ  óª  "  € \         f   \        4       hVf*   \        f   \        R4      h\        P                  ! V 4      p\
        P                  ! V4      p\        P                  ! RR7      ;_uu_ 4       p\        V4      RV 2,          p\        VR4      ;_uu_ 4       p	V	P                  V 4       RRR4       \        VVVVVR7      G Rj  x€L
 p
\        V
R4      ;_uu_ 4       p	V	P                  4       uuRRR4       uuRRR4       #   + '       g   i     La; i LP  + '       g   i     M; i RRR4       R#   + '       g   i     R# ; i5i)	a  
Convert media file data using ffmpeg.

Args:
    data: The bytes of the file to convert.
    output_extension: The extension that the output file should be.
    input_args: Arguments to tell ffmpeg how to parse the input file.
    output_args: Arguments to tell ffmpeg how to convert the file to reach the wanted output.
    input_mime: The mime type of the input data. If not specified, will be guessed using magic.

Returns:
    The converted file as bytes.

Raises:
    ConverterError: if ffmpeg returns a non-zero exit code.
NrP   rQ   rR   rL   rT   )r1   rb   rc   re   r3   Úrb)rl   r#   r   rU   rV   rW   rX   rY   rZ   r   r[   r\   rs   Úread)rL   rb   rc   re   rN   r3   r]   r^   r1   r_   rr   s   &&&&&&     r   Úconvert_bytesrx   ¿   s  é € ô0 ÒÜÓ!Ð!àÒÜŠ=ÜÐVÓWÐWÜ—^’^ DÓ)ˆ
Ü×/Ò/°
Ó;€OÜ	×	$Ò	$Ð,=×	>Õ	>À&Ü˜&“\ d¨?Ð*;Ð$<Õ<ˆ
Ü�*˜d×#Ô# tØ�J‰J�tÔ÷ $ä(Ø!Ø-Ø!Ø#Øô
÷ 
ˆô �+˜t×$Ô$¨Ø—9‘9“;÷ %Ñ$÷ 
?Ò	>ç#×#úñ
÷ %×$úÐ$÷ 
?×	>×	>Ò	>üs`   ‚A5EÁ7*D?Â!D	Â3D?ÃDÃD?Ã'D!	Ã7
D?ÄEÄDÄ	D?Ä!D1Ä,D?Ä5
EÄ?E	Å
	E)z-hide_bannerú	-loglevelrE   z-y)ry   Úquietz-print_formatrF   z-show_optional_fieldsÚ1z-show_formatz-show_streamsr   )NN)NNFNN)NNNN)rl   ro   r   r#   rx   rs   r`   rJ   )Ú
__future__r   Útypingr   r   Úpathlibr   r=   rF   ÚloggingrW   r   r   rY   Ú r   ÚImportErrorr   ÚChildProcessErrorr   r#   rl   ro   r<   r?   rJ   r`   rs   rx   Ú__all__r   r   r   Ú<module>r„      s©   ðõ #ç  Ý Û Û Û Û Û 	Û Û ðÝõ
3ô
	Ð&ô 	ôO˜ô Oñ
 ˜Ó!€ØFÐ á˜Ó#€ð	Ð ÷"÷JF÷B@9÷F,ò^	‚øðu ô Ø‚Eðús   ²B Â	BÂB