您好,欢迎光临本网站![请登录][注册会员]  
文件名称: WAV文件结构解析
  所属分类: 其它
  开发工具:
  文件大小: 34kb
  下载次数: 0
  上传时间: 2019-03-17
  提 供 者: weixin_********
 详细说明:NULL 博文链接:https://weiyuhu.iteye.com/blog/569002RFC 521 February 2008 RFC 521 February 2008 An Adu descriptor consis-s of che following fields: size of the entire ADu frame (not just the portion that will fit within a sing_e RTP packet). Each such packet (even the last one? C": Continuation flag (1 bit): l, if the data following the ADU contains only one "ADU descriptor ptor is a continuation of an AnU frame that was too large tc fit within a single RTP packet: 0 otherwise 4.4. RTP Header Fields T": Descriptor Type flag (1 bit): Payload Type: The (static) payload type 14 that was defined for 0 if this is a l-byce ADu descriptor MPEG audio [b. MUST NOt be used. Instead, a differen-, dynami 1 if this is a 2-byce ADu descriptor payload type MusT be used - i.e., one within the range [96..1271 ADU size"(6 or 14 bits): The size (in bytes)of the Acu frame M bit: his payload format defines no use for this bit. Senders taat will follow this ADU descriptor (i.e, NcT including the SHOULD set this bit to zero in each outgoing packe- size of the descripor itself). A 2-byte Adu de scriptor of 64 bytes or more. For smaller ADt frame sizes senders (9 (with a 14-bit "ADU size" fiela) is usec for ADU frame size T-mestammp: Th-s -s a 32-bit, 9o kHz timestamp, representing the presentation time of the first AU packed within the packet MAY alternatively use a 1-byse ADu descriptor (with a 5-bit ADU size Field). Receivers must be able to accept an ACU 4. 5. Iland_ing Rece- ved Data descriptor of eiher size. Note that n formation is lost by converting a sequence of MP3 Thus, a 1-byte ADU descriptor is formatte= as follows: frames to a correspording sequence of "ADU frames", so a. receiving RTP -mp-ementatior can either feed the ADU frames directly to an 01234567 appropriately modified MP3 decoder, or convert them back into a I CI0 ADU size -+-+-+-十-+-+-+- 5. Handling Multip_e MPEG Audio Layers and a 2-byte ADU descripor is forma=ted as follows The RTp payload format ces=ribed here is intended only for MPEG-1 or are self-contained, without a back-pointer to earlier frame 0123456789012345 However, it is possible (although unusual) for a sequence of cudi 1-4--1-4-1-1--+-1-1-+-1-4-+-1 frames to consist of a mixture of layer III frames, and layer I or II C|1 ADU size (14 bits) frames. When such a sequence is transmitted, only layer III frames 十-+-+-+-十-+-+-+-+-+-+-+-+-+-+-+-十 are converted to ADUs layer I or Ii frames are sent 'as is(except for the prepending of an "adu descriptor"). Similarly, the receiver 4.3. Packing Rules cf a sequence of frames - using this payload format - leaves layer I and I- frames ur touched (after removing the prepended "ADU Each. RIP packet payload begins wish an "ADU descriptor", followed by descriptor"), but converts layer Iii frames from. " ADU frames"to fit completely witin the RTP packet. In this case, more than one ADu frame data. Normally, this ADu descriptor + ADU frame regu-ar MP3 frames. (Recall that each frame 's layer is identified from its 4-byte MPeg header) successive "Adu descriptor +"ADU frame"MAY be packed into a single .TP packet provided tha- they all fit conpletely If you are transmitting a stream consisting konly* of layer I or layer I- frames (i.e., without any MP3 data), then there is no If, however, a single "ADU descriptor" +"ADu frame is too large to benefit to using this payload format * unless you are using the fit within an RIP packet, then the "ADu frame" is split across two or interleaving mechanism described in Section 7 below more successive RTe packets. Each such packet begins with an ADU des flag of 0; the following packe-s' descriptors each have a c" flag of 1. Fach descriptor, in his case, has the same "ADU size" value: the Finlayson Standards Tra≈k Page Standards irack RFC 521 February 2008 REC 5219 ebruarv 2008 6. Frame Packetizing and Depacke-izing Step 6-s the rearranging of the sequence of aDu frames bac to its crig-na- order (except for ADt frames missing due to packet loss The transmission of a sequence of MP3 frames takes the following described in Section 7 below. (Note also the pseudo-code in Appendi MP3 = rame s tep i-s the conversion of the sequence of adu frames into a 1-> ADU frames orrespond=ng sequence of MP3 frames i.e.,the reverse of szep 1 - interleaved Adu frame (Note a-so the pseudo-code in Appendix A2,) With an appropriately >RTP packets modified MP3 decoder, an implementation may omit this step; instead, it could feed ADU frames direstly to the (modified) MP3 decode Step 1 is the conversion of a sequence of MP3 frames to a corresponding sequence of ADU frames, and takes place as described in 7. ADU Frame Inter-eaving Sections 3 and 4. 1 above. (Noce also the pseudo-code in Appendix In MPEG audio frames (MPEG-1 or 2i all layers), the high-order 11 cits of the 4-byte MPEG header ('syncword are always all-one (i.e Step 2 is the reordering of the sequence of AD frames in an OxF:E). When reordering ecuence of adu frames for transmission (optional) interleaving patern, prior to packetization, as described ne reuse these 1- bits as an Interleaving Sequence Number(ISN) be low. (No do-code in Appendix B 1.) (Upon reception, they are replaced with OxFFF once a gain. because of the kack-poincer in MP3 frames, interleaving can bex ng Interleaving he lps the ef fect of packet loss by distribut consecUtive ADU -rames over non-consecutive packets. (Note the The structure of the Isn is (a b) where applied - in general - only =o ADu frames. Thus, interleaving was a =s bits 0-7 8-bit Interleave Index (within Cycle) rot possible -or REC 2250. b -- bits 8-10: 3-bit Interleave Cycle Count Step 3 is the packetizing of a sequence of (interleaved) ADU frame s That is, the 4-byte MPEG header is reused as follows int RTP rackets - as described in se: tion 4.3 ab ve. Fach packets RTP timestamp is the presentation time of the first Adu that is 1 packed within it. Note cha- if interleaving was done in step 2 0234567890123456789012345678901 RTP timestamps cn outgoing packets will not necessarily be monotonically nondecreasing Inter_eave -dx I CycCtI The rest of the original mPeg header I 1---1-1--1-1-1-1-|--1-1---1-4-4-1--1-- Similarly, a sequence of received RT2 packets is handled as follows: Example: Consider the following interleave cycle (of size 8) RTP 4->RTP packets ordered by RTP sequence number 1,3,5,7,C;2,4,6 interleaved adu frame s 6-> DU frame s (This part-cu-ar pattern has the property that any loss of up to -our 7->M23 Frames onsecutive Adus in the interleaved stream will lead to deinter-eaved stream with no gaps greater than one.) This produces Step 4 is the usual sorting of incoming RtP packets using the Rte the fol_:ing sequence of Isns: (-,0)(3,0)(5,0)(7,0)(0,0)(2,0)(,0)(6,0)(1,1)(3,1)(5,1) step 5 is the depacketizing of ADU frames from RTP packets 1.e· etc 3. As par- of th r uses the (continuation) -lag in he ADu descriptor to notice when an ACU f split over more than packet (ana to discard the ACU y 1- cne k Finlayson Standards Tra≈k Page Standards irack RFC 521 February 2008 RFC 521 ebruarv 2008 Sor in this example, a sequence of ADu frame 8. _ANA Cons-derat:ons f0 f1 E2 f3 f4 E5 E6 E7 f8 E9(etc. Media type nane: audio would get reordered, in step 2, int Media subtype mpa-robust (1,C)f1(3,0)=3(5,0)f5(7,0)f7(0,0)fC(20)2(4,0)f4(6,0)f6 Requ:red parameters: none (1,1)9(3:1)=11(5;1)f13(etc,) Cptiona- parameters: none and the reverse reordering (along wi=h replacement of the OxFFE) would cccur upon reception Encoding considerations This type is defined only for transfer via RTP, as specified in The reason fcr breaking he Isn into "Interleave Cycle Count" and RFC 5219 Interleave Index(rather han just treating it as a single Il-bi' courter, is to give receivers a way of knowing when an AU frame Security considerations chould be released to he ADu->MP3 conversion process (step 7 See the Security Considerations section of REC 5219 above), rather than waiting for more interleaved adu frames to arrive. For instance, in the example above, when the receiver sees a Tnteroperabil ty :onsidevations t 1 Tsn (, 1) knows that it can release a This encod rg is t ible with both the "audio/mpa" an: previosly seen =rames with ISN (,0), even if some other audio/n peg" media types Interleave Index allows interleave cycles of size up to 256 8-bit (some thing>,0)=rames remain missing cue to packet loss. An 8-bit Publ-shed specification: The -SO/IEC MPEG-1 [3 and MPEG-2 [4 audio specifications, and The choice of an interleaving order can be made independently of RTp RFC 5219 packetization Thus, a simple implementation could choose an interleaving order First, reorder the Anu frames a: cordingly (step Applcations that use this mecia tyre 2), then simply pack them sequentially into RTP packets (step 3) Audio streaming tools (transmitting and receiving) However the size c= adu frames - and thus the number of aru frames that will -it in each RT: packet - will typically vary in size additional information: none more optimal implementation would combine steps 2 and 3, by choosing an interleaving order that beter reflected the number of Acu frames Person enmai- address to contact for further information packed within each RTE packet Ross finlayson Einlaysona_ive555.com Fach receivinG implementation of chis payload format MUST recognize the Isn and be able to perform deinterleaving of incoming AcU frames Intended usage: COMMON (step o). However, a sending implementation of this payload format MAY choose nct to perform interleaving e, by omitting step 2 Author/Change controller In this case, the ig -order 1l bits in each 4-byte MfEG header would Author: Ross Finlayson remain at OxFFE. Receiving implementations would thus see a sequence Change controller: IETF AVT Working Group of idetical ISNs (all OxFFE). They would handle this in the same way as if the Interleave Cycle Count changed with each A]U frae, by simply releasing the sequence of incoming ADt frames sequentially to the ADU-MP3 co version process (step 7), without reordering Note also the pseudo-code in Appendix B. 2.) Finlayson Standards Tra≈k [Page 91 Standards irack [Page 101 RFC 521 February 2008 REC 521 Februarv 2008 SDP Usage 12. Normat:ve Refererce: Wher: conveying information by SDP [7, the encoding name SHALL be [- Hoffman, D, Ferrando, G, Oval, V, and M. Civanlar, " RTP mpa-rcbust "(the same as the media subtype). An example of the Pay oad Format f* MPFG1/MPFG2. Video", RFC 22.50, January 1998 media representaticn in SDP is: .audic 4900] RTP/AVP 121 a-rtpmap: 121 mpa-robust/90000 Note taat the rtp timestamp frequency must be 90000 pictures and associated audio for digital storage media up to about -r5 Mb:ts/s --Part 3: Audio", 1993 L0. Security Considerations [4] -SO/IEC Interrational Standard 13818-3; "Generic coding of moving If a session using this payload format is being encrypted, and pictures and associated audio information --Part 3: Audio", interleaving is being used, then he sender SHOULD ensure that any 998 charge of encryption key coincides with a start of a new interleave ycle. Apart from this, the security onsiderations for this payload [5] Ilandley, M. ard C. Perkins, "Guidelines for Writers of RTP format are identical to hose noted for RFC 2250[1 Pay oad Format. Specifi:ations", BCP 35, RFC 2736, December 1999 Acknowledgements [6 Schulzrinne, F. and s. Casner, RTE Profile for Audio and video Conferences with Minimal Control ST2 65, 3551,Ju1y2003 The suggestion c= adding an interleaving option (using the first bits of the MpG ' syncwcrd which would otherwise be all-ones - as an [7 Handley, M, Jacobson, v. and C. Perkins "SDp: Session interleaving index)is due o Dave Singer and Stefan Gewinner. In Description Protocol, RrC 4566, July 2006 addition, Dave Singer provided valuable feedback that helped clarify and improve the description of this payload format. Feedback from Chris sloan led to the addiion of an "ADt descriptor" preceding each ADU frame in the RIp pac et Finlayson Standards Tra≈k [Page ll] Standards irack [Page 12] RFC 521 February 2008 RFC 521 Februarv 2008 ppendix a Translating be=ween"MP3 Frames and ADt Frames Converting a Sequence of MP3 Frames"to a Sequence of ADU F The following 'pseudo code describes how a sencer using this payload format. ca translate a sequen f reqular MP3 Frames" to ADI Segment Queue pending MP3Frames; / initially empty Frames", and how a receiver can perform the reverse translation: from wNhile (- ADU Frames to ME 3 Frames" // Enqueue rew MP3 Frames, until we have enough daca - o // generate the ADU for a frame: We first define the following absract data structures do t int totalDatasizeBefore I Segment: A record that represents either a MP3 Frame"or an pendingMe frames. totalDatasize(i ADU Frame It consists of the following field header": the 4-by=e MPEG header Segment newFrame ='the next ME3 Frame; r'headersize": a constant ( pendingMP3 Frames, enqueue(newFrame)i sideIn=o": the ' side info structure, *including* the optional 2-byte Crc field, if presen- int totalDatasize/fter sideIn-oSize: the size (in bytes) of the above structure pendingme3Frames. totalDatasize(i I=rame Data": the remaining data in this frame y while (totalDataSizeBefore newframe backpointer I I I'frameDatasize": the size (in bytes) of the above data total DatasizeAfter new Frame.adunatasize); backpointer e value (expressed in bytes backpointer for this frame We now have enough data to generate the ADU for the most adaDatasize": the size (in by=es) of the ADt associated with recently enqueued frame (i.e, the tail of the queue) this frame. (If the frame is already an ADU Frame", then // (The earlier frames in the queue --if any --must be aduDatasize frame Datasize) 7, d-scarded, as we con't have enough data to generate Imp 3Frarme3ize": the total size (in bytes) that this frame would // their ADUs. have if it were a regular "MP3 Frame. (If it is already a Segment tailFrame pencingMP3Frames tail() MP3 Frame", then mp.3FrameSize Size t sideTnfos frarreDatasize) Note that this size can be derived completely // Output the header and side info: fror. header output(tailFrame header output(tailFrame sideInfo)i N eue: A FIFo queue of Segments, with operations void enqueue(Segment) 7 Go back to the frame that contains the start of our egrent dequeue( // Adu data Boolea isEmpty() int offset =0: t head Serment. curFrame iFT Segment tail( int prevBytes tailErame backpointer Segment previous(Segment): re=urns the segment prior to a while (prevBytes > 0)1 glven cne cur Frame- pendingMP3 Frames previous (curFrame)i Segment next(Segment): returns the segment after n int dataHere curFrame. frameDatasizei unsigned totaldatasize(: returns the sum of th if (dataller prevBytes) i rameDataSize fields of each entry in the queue prevbytes - dataHerei offset datah 7/ Dequeue any frames that we no longer need: Finlayson Standards Tra≈k [ Page 13] Standards irack [Page 141 RFC 521 February 2008 Februarv 2008 pendingMP3Frames dequeue(i while (1) urAU backpointer 7, Cutput, from the remaining frames, the ADt] data that curAU. aduatasize // we want if (endofData > endcfHeadErame int bytes ToUse tailFrame. aduDatasize; ,We have enough data to generate a while (byt 0){ int dataHere curFrame. frameDatasize offset needToEnqueue False; int bvtesUsedhere break oytesToUse dat by=; frameoffset + curADU. mF: 3Framesize outp t("by-esUsedHere" bytes from cr2二U. headers2e rFrame. frameDatar starting fr if (curADU-- pendingADUFrames tail()) breaki bytesToUse - bycesUsedherei curADc= pendingAUE'rames next(curADu); of=set 0 arFrame- pendi ng M23Frames next(:ur Frae) 2. Converting a Sequence of "ADU Frames" to a sequence of Mp3 frames void qenerateFranme F'romHeadADU( t egment Queue pendingADUFramesi// initially empty while (1)( //Output the header and side info: while (needToGe-AnADU ())i output(curADUheader Segment newAdu = 'the next ADU Frame'i output(CurADU. sideInfo) pendingADUframes. enqueue(newADU // Begin by zeroing out the rest of the frame, in case the insert DummyADUsIENecessary () // ADu data doesn't fill it in completely int endo flleadrrame curADU. mp frame Size CumADU headersize curadu, side infosize generateframeFromHeadAD[()i tput ("endofHeadF F=ll in the frame with appropriate ADu daca from this. and Boolean needloGetAnADU( // subsequent ADUs / Checks whether we need to enqueue one or more new ADUs int frammeoffset =0 // befcre we have enough daca to generate a frame for the int tooffset =0 head adu Boolean needToEnqueue Truei while (tooffset encofHeadFrarme) irt startofDat offset curADU backpointer i=(! pendingADUFrames. isEmp=y())( -f(startofData endo hEadfRame Segment curADU pending!DUE'rames head()i breaki / no more ADUs are needed int endofHeadframe- cur!DU. mp3Frame size curADu. headersize curADU. sideInfosize rt endofData startofData curADU. adudatasize iat fr f (endofData endcfHeadframe) Finlayson Standards Tra≈k [Page 15] Standards irack [Page i6] RFC 521 February 2008 ebruarv 2008 prevA-U. headersize prevACU. sideInfosize int fromoffset if (prevADU. aduDatasize prevADUend) if (starcofData <= tooffset)( / this shoul. happen i f th fromofEse- tooffset startcfData / previous ADU was well-formed startofDa-a tooffset orevADUend if (endofData startofData) i }e⊥se{ endofData startofDatai orevADUend prevADU. aduDacasizei e⊥se fromofEse prevADUend // leave some zero bytes beforehand Insert a cummy ADU in fron- of the -ail int bytesUsedllere encofData- startcfDatai /"mp3F-ameSize as the tail ADU, but should offset offset tesUsedH // have f"frevAnUend bytes from &CurADU. frameData[framoffset]")i /an " adunataSize"of zero. The simplest too=fset + by=esUsedHerei vay to co this is to copy the "sideInfo"from the tail ADU, replace the value of -rameoffset + curADU. mp3Eramesize //"main data begin" with "prevADUend'", and set cureD. headersize- CurADU, sideInfosize , all of the "part2 3 length" fields to zero urADU pendingADUFrames next(curaDU)i else i nc more dummy ADUs need to be void insertDummyADUsIENecessary ( 7, The tail segmen- (ADU is assume to have been recently Appendix B. -nterleavirg and Deinterleaving // enqueued. If /,c- the previous ADU, hen we need to insert one or more The fol-ow-ng 'pseudo code describes how a sender can reorder a AD(s ahead of it. (This situatio sequence of "ADU Frames"a:cording to an interleaving patter // shold occur only if an intermediate ADU was missing (step 2), and how a receiver can perform the reverse reordering (step 7,--eg. due to packe- loss. while (1) Segment cailAdu= pending ADUFrames tail()i B. 1. Interleaving a Sequence of ADU Frarces' int prevADUend: / relative to the start We first define the foll OWIng if (pendingADUFrames head()!= tailADU) -nterleaveCyclesize": an integer in the range [1..2561 7, here is a previous ADU nterleaveCycle": an array, of size interleaveCyclesize", Segmen- prevADL contain=ng some permutation of the integers from the set pending ! Frames. previous(tailAcu)i interleaveCyc-eSize-1] e.g., if interleaveCy prevADUend nterleaveCycle might contain: 1,3,5,7,0,2,4,b prevADU. mp? size inverseInter-eaveCycle": an array containing the inverse of the prevADU. ba: pointer permutation in irterleaveCycle" Finlayson Standards Tra≈k [Page 171 Standards irack [Page 18] RFC 521 February 2008 February 2008 interleave inverseInterleaveCycle [ill==i if (cc !=iccLastseen| ii iiLastSeen) the current Interleave Index (initially 0) Ne 've startec a new interleave cycle icc": the current Interleave Cycle Count (initially 0 // (or interleaving was not used). Release all ad Frame uffer": an array, of size interleaveCyclesize", of ADU pending ADU frames to the AU-MP3 conversion Frarr.es that are awaiting packe-ization while (1)[ if (aduFrameBuffer[i!= NUL_)( int positionofNextyrame inverseInterleaveCycle[iii elease aduframeBuffer[ili adufrarm.eB=fer i positionofNextEramel= the next ADu frame; aduFrameBuffer[il= NUL replace the aigh-order 1l bits of this frame 's MPeg header with (ii, icc)i // Note: Be sure to leave the remaining 21 bit interleaveCyclesize) i-Lastseen = ii //Wle've finished this cycle, so pass all iccLastSeen- icci // pending frames to the packetizing step fcr (in- i =0: i interleaveCyclesize; I+i)i pass aduFrameBuffer [i] to the packetizing step; Appendix C. Changes fr:m RFC 3119 The primary change from RFC 3119 is to correct the encoding name in icc =(iCc+1)8; the "ScP usage" section. The correct encoding name is"mpa-robust so, the term media type" replaces "mime type". Finally, some minor bug fixes ard clarifications were made to the (non-norma-ive) eudo code in a R.2. Deinterleaving a Sequence of (Interleaved)"ADU Frames" Ne first define the following absract data structures wii: the Interleave Index from the current incoming ADu frame nicc": the Interleave Cycle Count from the current incoming ADU frame iiLastseen": the mos- recently seen Interleave Index (initially some integer *nct* in the range [0..25:1) iccLastseen": the most recently seen Interleave Cycle Count (initially, some integer xnot* in the range [0..7]) n'aduFrame3uffer: an array, of size 256 of(pointers to) ACU s that aa t been depacketizea (initial are NULl) while (1)[ adufrarm.e= the nex- ADU frame from the depacketizing step; ii, icc)="the high-order ll bits of aduframe's MPEg header the high-order ll bits of aduFrame'S NPEG header- oXFFE: / Note: Be sure to leave the remaining 21 bits Finlayson Standards Tra≈k [Page 191 Standards irack
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: wav文件结构
 输入关键字,在本站1000多万海量源码库中尽情搜索: