Qf ddlZejedddgZddlmZeddZd ej_d ej_d ej_d ej_d ej_dZ dZgZdZej#edZej#edZej#edZej#edZej#edZej#edZej#edZej#edZdZdZdZdZdZedk(reyy)N) )removewhatwhathdr) namedtuple SndHeadersz.filetype framerate nchannels nframes sampwidthzThe 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 t|}|S)N)r)filenameress -/opt/alt/python312/lib64/python3.12/sndhdr.pyrr8s) ( C Jc t|d5}|jd}tD] }|||}|st|ccdddS dddy#1swYyxYw)Nrbi)openreadtestsr )r fhtfr s r rr>s_" h  FF3KBQ(C!3''    s&A AAAc tj5tjdtddl}ddd|j dsy|dddk(rd}n |ddd k(rd }ny|j d j|d }||j|j|jd|jzfS#1swYxYw#tjf$rYywxYw) Nignore)categoryrFORM sAIFCaifcsAIFFaiffr)warningscatch_warnings simplefilterDeprecationWarningr startswithseekrEOFErrorError getframerate getnchannels getnframes getsampwidth)rrrfmtas r test_aifcr.Os  "h1CD # << 2w' 1RG FF1I IIa  !1>>#3 LLNA 00 22! # " djj !s C 9C CC10C1c, |jdrt}n|dddvrt}nyd}||dd}||dd}||dd}||dd}||dd }d } |d k(rd } n|d k(rd} n |d k(rd} d } nd} | |z} | r|| z } nd} |||| | fS)Ns.snd)sds.sdns.aurrUr?)r$ get_long_be get_long_le) rrfuncfiletypehdr_size data_sizeencodingrate nchannels sample_size sample_bits frame_sizenframes r test_aurGgs||G 2A% %HAaF|HQqW IAbH~H "R>DQr"XIK1} Q Q   y(JZ' T9fk 99rcd |dddk7s|dddk7ryt|dd}|rd |z }nd }d |d d dfS)NAEsFSSDsHCOMi"Vrhcomr5r9r)r:)rrdivisorrAs r test_hcomrQsUBx7aCjG3!C*%Gw 4B !!rc |jdsyt|dd}d}d|cxkrdkr&nn#||dk(rd||dzz }|rtd |z }d |dd d fS) NsCreative Voice Filer3rir5r0g.Avocr9r)r$ get_short_leint)rrsbseekrAratecodes r test_vocrZsv <<2 3 !Br( #F DFSQvY!^6!8$ y8+,D $2q  rcR ddl}|jdr|dddk7s|dddk7ry|jd |j|d}d |j |j|jd|jzfS#t|j f$rYywxYw) NrsRIFFrrsWAVEr2sfmt rwav) waver$r%rr&r'r(r)r*r+)rrr]ws r test_wavr_s << AaGw$6!Br(g:MFF1I IIa  1>>#Q^^%5<<>1Q^^%5#5 77 djj !sBB&%B&c: |jdr|dddk7ryy)Nrrrs8SVX)8svxrr5rr)r$)rrs r test_8svxrbs$ << AaGw$6 rcn |jdr#t|dd}t|dd}d|d|dfSy)NsSOUNDrrr3rSsndtr5)r$r;rV)rrnsamplesrAs r test_sndtrfsG||Hq2w'AbH%tQ!++rcp |jdr$t|dd}d|cxkrdkr nyd|ddd fSyy) Nsr7r0iiasndrr5r9r)r$rV)rrrAs r test_sndrrisI||GAaF# 4 5 4B) ) !rcB|ddz|ddzz|ddzz|dzS)Nrr4r5r2r7rrbs r r:r:3 aDBJ1Q42: &!A$!) 4qt ;;rcB|ddz|ddzz|ddzz|dzS)Nrr4r7r2r5rrrkrls r r;r;rnrc|ddz|dzS)Nrrr5rkrls r get_short_berq aDAI1 rc|ddz|dzS)Nr5rrrkrls r rVrVrrrc\ddl}d}|jddr#|jddk(r|jdd=d} |jddrt|jdd|dytdg|dy#t$r/|jj d|j dYywxYw)Nrr5z-rr7.z [Interrupted] )sysargvtestallKeyboardInterruptstderrwriteexit)rv recursives r testr~sI xx| t+ HHQqSM  88AB< CHHQRL)Q / SE9a (  ,-  s)A3$A335B+*B+cddl}ddl}|D]}|jj|rwt |dzd|s|rWt dddl}|j |jj |j|d}t||dt dt |dzd|jj t t|y#t$rt d YwxYw) Nrz/: )endzrecursing down:*z*** directory (use -r) ***:z*** not found ***) rvospathisdirprintglobjoinescaperxstdoutflushrOSError)listr}toplevelrvrr rnamess r rxrxs  77== " (T/s +H'( "'',,t{{8/Dc"JKy!,23 (S.c * JJ    +d8n% +)* +s C""C98C9__main__)r _deprecated__name____all__ collectionsrr r=__doc__ frameraterBnframes sampwidthrrrr.appendrGrQrZr_rbrfrir:r;rqrVr~rxrkrr rsk:Xg. 9 "  HJ  > !1 !6  !#   2* Y:> W " Y ! X 7 X Y, Y* Y<< +* zFr