Your IP : 18.218.123.194


Current Path : /opt/alt/python35/lib64/python3.5/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/__pycache__/sndhdr.cpython-35.opt-2.pyc



���]�@spddgZddlmZedd�Zdd�Zdd�ZgZdd	�Zeje�d
d�Z	eje	�dd
�Z
eje
�dd�Zeje�dd�Zeje�dd�Z
eje
�dd�Zeje�dd�Zeje�dd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zed$krle�d%S)&�what�whathdr�)�
namedtuple�
SndHeadersz.filetype framerate nchannels nframes sampwidthcCst|�}|S)N)r)�filename�res�r�+/opt/alt/python35/lib64/python3.5/sndhdr.pyr(scCs`t|d��J}|jd�}x-tD]%}|||�}|r(t|�Sq(WdSWdQRXdS)N�rbi)�open�read�testsr)r�f�hZtfrrrr	r.s
cCs�ddl}|jd�sdS|dd�dkr>d}n#|dd�dkr]d}ndS|jd�y|j|d	�}Wnt|jfk
r�dSYnX||j�|j�|j�d|j	�fS)
NrsFORM��sAIFC�aifcsAIFFZaiff�r)
r�
startswith�seekr�EOFError�Error�getframerate�getnchannels�
getnframes�getsampwidth)rrr�fmt�arrr	�	test_aifc?s		
	rc
Cs6|jd�rt}n#|dd�dkr7t}ndSd}||dd��}||dd��}||dd��}||dd	��}||d	d
��}d}	|dkr�d}
n6|d
kr�d}
n!|dkr�d}
d
}	nd}
|	|}|r||}nd}|||||
fS)Ns.snd��ds.�dns.Zaurr�����U���?)r r!���)r�get_long_be�get_long_le)
rr�funcZfiletypeZhdr_sizeZ	data_size�encoding�rateZ	nchannelsZsample_sizeZsample_bits�
frame_sizeZnframerrr	�test_auTs2					

r1cCsr|dd�dks,|dd�dkr0dSt|dd��}|rYd	|}nd
}d|ddd
fS)N�A�EsFSSD��sHCOM��i"VrZhcomr%rr*)r+)rrZdivisorr/rrr	�	test_hcomus,
r8cCs�|jd�sdSt|dd��}d}d|koFdknr�||dkr�d||d}|r�td	|�}d
|dddfS)
NsCreative Voice Filer#�ri�r%�rg��.AZvocrr*)r�get_short_le�int)rrZsbseekr/Zratecoderrr	�test_voc�s,r=cCs�ddl}|jd�sH|dd�dksH|dd�dkrLdS|jd�y|j|d�}Wnt|jfk
r�dSYnXd	|j�|j�|j�d|j	�fS)
NrsRIFFrrsWAVEr"sfmt rZwav)
�waverrZopenfprrrrrr)rrr>�wrrr	�test_wav�s<
	r@cCs.|jd�s&|dd�dkr*dSdS)	NsFORMrrs8SVX�8svxrr%)rArr%rr)r)rrrrr	�	test_8svx�s&rBcCsR|jd�rNt|dd��}t|dd��}d|d|dfSdS)NsSOUNDrrr#r9Zsndtr%)rr,r;)rrZnsamplesr/rrr	�	test_sndt�srCcCsX|jd�rTt|dd��}d|ko<dknrTd|dd	dfSdS)
Nsr'ri�i�aZsndrr%rr*)rr;)rrr/rrr	�	test_sndr�srDcCs,|dd>|dd>B|dd>B|dBS)Nrr$r%r"r'rr(r)�brrr	r+�sr+cCs,|dd>|dd>B|dd>B|dBS)Nr(r$r'r"r%rrr)rErrr	r,�sr,cCs|dd>|dBS)Nrrr%r)rErrr	�get_short_be�srFcCs|dd>|dBS)Nr%rrr)rErrr	r;�sr;cCs�ddl}d}|jdd�rN|jddkrN|jdd�=d}yJ|jdd�r�t|jdd�|d�ntdg|d�Wn/tk
r�|jjd�|jd�YnXdS)Nrr%z-rr'�.z
[Interrupted]
)�sys�argv�testall�KeyboardInterrupt�stderr�write�exit)rH�	recursiverrr	�test�s& 
rPcCsddl}ddl}x�|D]�}|jj|�r�t|ddd�|sW|r�td�ddl}|j|jj|d��}t||d�q�td�qt|ddd�|jj	�ytt
|��Wqtk
r�td	�YqXqWdS)
Nrz/:�end� zrecursing down:�*z*** directory (use -r) ***�:z*** not found ***)rH�os�path�isdir�print�glob�joinrJ�stdout�flushr�OSError)�listrOZtoplevelrHrUrrY�namesrrr	rJ�s"




rJ�__main__N)�__all__�collectionsrrrrr
r�appendr1r8r=r@rBrCrDr+r,rFr;rPrJ�__name__rrrr	�<module>!s<	











?>