Your IP : 3.137.177.116
a
R�f� � @ s. d dgZ ddlmZ edd�Zdej_dej_dej_d ej_d
ej _dd � Z
dd� Zg Zd
d� Z
e�e
� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Ze�e� dd� Zdd � Zd!d"� Zd#d$� Zd%d&� Zd'd(� Zed)k�r*e� d*S )+�what�whathdr� )�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthz�The value for type indicates the data type
and will be one of the strings 'aifc', 'aiff', 'au','hcom',
'sndr', 'sndt', 'voc', 'wav', '8svx', 'sb', 'ub', or 'ul'.zYThe sampling_rate will be either the actual
value or 0 if unknown or difficult to decode.z^The number of channels or 0 if it cannot be
determined or if the value is difficult to decode.z?The value for frames will be either the number
of frames or -1.zAEither the sample size in bits or
'A' for A-LAW or 'U' for u-LAW.c C s t | �}|S )N)r )�filename�res� r �+/opt/alt/python39/lib64/python3.9/sndhdr.pyr 4 s c C sl t | d��N}|�d�}tD ],}|||�}|rt|� W d � S qW d � d S 1 s^0 Y d S )N�rbi )�open�read�testsr )r �f�hZtfr r r r r : s
c C s� dd l }| �d�sd S | dd� dkr,d}n| dd� dkrBd}nd S |�d� z|�|d �}W n t|jfyz Y d S 0 ||�� |�� |�� d|� � fS )
Nr � FORM� � s AIFC�aifcs AIFFZaiff�r)
r �
startswith�seekr �EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)r r r Zfmt�ar r r � test_aifcK s
�r c
C s� | � d�rt}n| d d� dv r&t}nd S d}|| dd� �}|| dd� �}|| dd� �}|| dd� �}|| dd � �}d
} |d
kr�d}
n$|dkr�d}
n|d
kr�d}
d} nd}
| | }|r�|| }nd}|||||
fS )Ns .snd� )s ds.s dns.Zaur r � � � � �U� � �?���)r �get_long_be�get_long_le)
r r �func�filetypeZhdr_size� data_size�encoding�rate� nchannelsZsample_sizeZsample_bitsZ
frame_sizeZnframer r r �test_au` s2
r1 c C sT | dd� dks | dd� dkr$d S t | dd� �}|rBd | }nd
}d|dd
dfS )N�A �E s FSSD� � s HCOM� � i"V r Zhcomr# r( r )r) )r r Zdivisorr/ r r r � test_hcom� s
r8 c C st | � d�sd S t| dd� �}d}d| kr6dk rfn n,| | dkrfd| |d }|rftd | �}d
|dddfS )
Ns Creative Voice Filer! � r i� r# � r g ��.AZvocr( r )r �get_short_le�int)r r Zsbseekr/ Zratecoder r r �test_voc� s
$r= c C s� dd l }| �d�r2| dd� dks2| dd� dkr6d S |�d� z|�|d�}W n t|jfyj Y d S 0 d |�� |�� |�� d|� � fS )
Nr s RIFFr r s WAVEr s fmt r Zwav)
�waver r r r r r r r r )r r r>