b374k
m1n1 1.01
Apache/2.2.15 (CentOS)
Linux obd60-6c49958d75-2q7cw 5.4.0-174-generic #193-Ubuntu SMP Thu Mar 7 14:29:28 UTC 2024 x86_64
uid=48(apache) gid=48(apache) groups=48(apache)
server ip : 104.21.65.202 | your ip : 10.244.126.0
safemode OFF
 >  / usr / lib64 / python2.6 /
Filename/usr/lib64/python2.6/sndhdr.pyo
Size7.25 kb
Permissionrw-r--r--
Ownerapache
Create time23-Dec-2025 17:41
Last modified20-Jun-2019 19:45
Last accessed22-Apr-2026 05:30
Actionsedit | rename | delete | download (gzip)
Viewtext | code | image
Ñò
§ÚêLc@s,dZddgZd�Zd�ZgZd�Zeie�d�Zeie�d�Zeie�d�Z eie �d �Z
eie
�d
�Z eie �d �Z eie �d �Z
eie
�d
�Zd�Zd�Zd�Zd�Zd�Zedjo e�ndS(s¶Routines to help recognizing sound files.

Function whathdr() recognizes various types of sound file headers.
It understands almost all headers that SOX can decode.

The return tuple contains the following items, in this order:
- file type (as SOX understands it)
- sampling rate (0 if unknown or hard to decode)
- number of channels (0 if unknown or hard to decode)
- number of frames in the file (-1 if unknown or hard to decode)
- number of bits/sample, or 'U' for U-LAW, or 'A' for A-LAW

If the file doesn't have a recognizable type, it returns None.
If the file can't be opened, IOError is raised.

To compute the total time, divide the number of frames by the
sampling rate (a frame contains a sample for each channel).

Function what() calls whathdr(). (It used to also use some
heuristics for raw data, but this doesn't work very well.)

Finally, the function test() is a simple main program that calls
what() for all files mentioned on the argument list. For directory
arguments it calls what() for all files in that directory. Default
argument is "." (testing all files in the current directory). The
option -r tells it to recurse down directories found inside
explicitly given directories.
twhattwhathdrcCst|�}|S(sGuess the type of a sound file(R(tfilenametres((s/usr/lib64/python2.6/sndhdr.pyR#s cCsNt|d�}|id�}x)tD]!}|||�}|o|Sq%WdS(sRecognize sound headerstrbiN(topentreadtteststNone(RtfthttfR((s/usr/lib64/python2.6/sndhdr.pyR)s c
CsÔddk}|d djodS|dd!djo
d}n#|dd!djo
d }ndS|id
�y|i|d �}Wnt|ifj
odSX||i�|i�|i�d|i �fS( NiÿÿÿÿitFORMii tAIFCtaifctAIFFtaiffitr(
RRtseektopenfptEOFErrortErrort getframeratet getnchannelst
getnframest getsampwidth(R
R Rtfmtta((s/usr/lib64/python2.6/sndhdr.pyt test_aifc:s 


c Cs|d djo
t}n |d djo
t}ndSd}||dd!�}||dd!�}||dd!�}||dd !�}||d d
!�}d }|d jo
d } n;|d
jo
d} n$|djod} d
}nd} ||}
|||||
| fS(Nis.sndtds.sdns.tauii iiiitUiit?(Rsdns.(t get_long_bet get_long_leR( R
R ttypethdr_sizet data_sizetencodingtratet nchannelst sample_sizet sample_bitst
frame_size((s/usr/lib64/python2.6/sndhdr.pyttest_auOs,








cCsW|dd!djp|dd!djodSt|dd!�}d d
|d d d
fS(NiAiEtFSSDi�i�tHCOMiithcomi"Viiÿÿÿÿii�i�(RR!(R
R tdivisor((s/usr/lib64/python2.6/sndhdr.pyt test_hcomls(cCs�|d djodSt|dd!�}d}d|jo
djno=||djo,t||d�}tdd |�}nd
|d d d
fS(NisCreative Voice Fileiiiôsig��.Aitvociiÿÿÿÿi(Rt get_short_letordtint(R
R tsbseekR'tratecode((s/usr/lib64/python2.6/sndhdr.pyttest_vocus/c Cs�|d djp(|dd!djp|dd!djodSt|dd !�}t|d d
!�}t|d
d !�}t|d d
!�}d||d|fS(NitRIFFii tWAVEisfmt iiiii"i$twaviÿÿÿÿ(RR3R"(R
R tstyleR(R'R*((s/usr/lib64/python2.6/sndhdr.pyttest_wav�s9cCs.|d djp|dd!djodSd S(
NiR ii t8SVXt8svxii(R?iiii(R(R
R ((s/usr/lib64/python2.6/sndhdr.pyt test_8svx�s%cCsO|d djo:t|dd!�}t|dd!�}d|d|dfSdS( NitSOUNDii iitsndti(R"R3(R
R tnsamplesR'((s/usr/lib64/python2.6/sndhdr.pyt test_sndt�scCs^|d djoIt|dd!�}d|jo
djnod|ddd fSndS(
Nitii i¨atsndriiÿÿÿÿi(R3(R
R R'((s/usr/lib64/python2.6/sndhdr.pyt test_sndr¡scCsDt|d�d>t|d�d>Bt|d�d>Bt|d�BS(Niiiiiii(R4(ts((s/usr/lib64/python2.6/sndhdr.pyR!®scCsDt|d�d>t|d�d>Bt|d�d>Bt|d�BS(Niiiiiii(R4(RH((s/usr/lib64/python2.6/sndhdr.pyR"±scCs t|d�d>t|d�BS(Niii(R4(RH((s/usr/lib64/python2.6/sndhdr.pyt get_short_be´scCs t|d�d>t|d�BS(Niii(R4(RH((s/usr/lib64/python2.6/sndhdr.pyR3·sc CsÂddk}d}|ido+|iddjo|idd5d}ny@|idot|id|d�ntdg|d�Wn0tj
o$|iid�|id�nXdS(Niÿÿÿÿiis-rit.s
[Interrupted]
(tsystargvttestalltKeyboardInterrupttstderrtwritetexit(RKt recursive((s/usr/lib64/python2.6/sndhdr.pyttest¿s "

cCsáddk}ddk}xÂ|D]º}|ii|�ob|dG|p|oCdGHddk}|i|ii|d��}t||d�qÙdGHq|dG|ii�yt |�GHWqt
j
o dGHqXqWdS( Niÿÿÿÿs/:srecursing down:t*is*** directory (use -r) ***t:s*** not found ***( RKtostpathtisdirtglobtjoinRMtstdouttflushRtIOError(tlistRRttoplevelRKRVRRYtnames((s/usr/lib64/python2.6/sndhdr.pyRMÎs$    
t__main__N(t__doc__t__all__RRRRtappendR,R1R8R=R@RDRGR!R"RIR3RSRMt__name__(((s/usr/lib64/python2.6/sndhdr.pyt<module>s8