xaac-rs 0.2.0

High-level Rust AAC/xHE-AAC encoder and decoder bindings built on libxaac
Documentation
�

iY�i�����ddlmZddlZddlmZddlZd	d�Zd
d�Zedk(r	e	eej���y#e$r!Ze
eej��e	d��dZ[wwxYw)�)�annotationsN)�Pathc��y)Nz:usage: python examples/python/decode_stream.py <input.aac>�r�� examples/python/decode_stream.py�usager	
s��Grc�b�t|�dk7rtt���t|d�j	�}tj�}d}d}d}|t|�k�rit|dzt|��}|j|||�}|jr�|dz
}|t|jj�z
}td|�dt|jj��d|jjj�d|jjj�d	�	�n�|j ry|j"}|j�Htd
|j$�d|jj�d|jj�d	��ntd
|j$���nn|}|t|�kr��i	|j'�}|jr�|dz
}|t|jj�z
}td|�dt|jj��d|jjj�d|jjj�d	�	���|j r��	td
|���td|���y)N��r�zframe z: z pcm bytes, z Hz, z chzneed more input: initialized=z, zflush frame zdecoded frames: zdecoded pcm bytes: )�len�
ValueErrorr	r�
read_bytes�xaac_rs�Decoder�min�decode_stream_chunk�is_frame�frame�pcm�print�stream_info�sample_rate�channels�is_need_more_input�progress�initialized�finish)	�argv�data�decoder�frame_count�	pcm_bytes�offset�end�statusrs	         r�mainr(sm��
�4�y�A�~����!�!���Q��=�#�#�%�D��o�o��G��K��I�
�F�
�3�t�9�
��&�3�,��D�	�*���,�,�T�&��-=�>���?�?��1��K���V�\�\�-�-�.�.�I����
�R��F�L�L�,<�,<�(=�'>�l��<�<�+�+�7�7�8���<�<�+�+�4�4�5�S�:�
�
�
&�
&����H��#�#�/��#�#+�#7�#7�"8���+�+�7�7�8���+�+�4�4�5�S�:���5�h�6J�6J�5K�L�M����1�3�t�9�
�4����!���?�?��1��K���V�\�\�-�-�.�.�I���{�m�2�c�&�,�,�2B�2B�.C�-D�L��<�<�+�+�7�7�8���<�<�+�+�4�4�5�S�:�
�

��$�$��
�	��[�M�
*�+�	��	�{�
+�,�r�__main__)�filer)�return�str)r z	list[str]r+�int)�
__future__r�sys�pathlibrrr	r(�__name__�
SystemExitr �	Exception�excr�stderrrrr�<module>r6sn��"�
���H�5
�p�z�����c�h�h��(�(�����
�c��
�
�#���m����s�<�A"�A�A"