tag 标签: 刻录

相关博文
  • 热度 32
    2014-10-29 15:07
    8469 次阅读|
    1 个评论
    深入研究光盘多重区段的原理,DAO、SAO、TAO刻录原理区别 wxleasyland@sina.com 2014.10.24   多年来,一直不理解多区段光盘、DAO、SAO、TAO的具体的实现原理,国内没有人说清楚的。找了很多资料,终于有眉目了。   一、简单归纳总结 一张CD光盘中可以有多个区段(session),每个区段(session)中可以有多个轨道(track),轨道中存了数据。   每个区段中都含有导入区lead-in、轨道数据区track、导出区lead-out。   一张音乐光盘CDDA中只有一个区段,即光盘结构是: lead-in 轨道1(一般每个轨道就是一首歌) 轨道2 其它轨道 lead-out   lead-in中存放了TOC数据等。Lead In中会反复记录TOC数据,保证TOC可读得出来。 TOC数据是各个轨道的位置等信息,非常重要,TOC读不了,就找不到轨道了。   lead-out区只是表示结束的信息。   CD-R光盘在第一个lead-in之前,还有一个PMA区域,可反复擦写,用于临时存储TOC。 CD音乐播放器、CDROM光驱无法读取PMA区域,只能从第一个lead-in开始读。 刻录机当然可以读取PMA区域。   其实CD-R光盘中还有ATIP和PCA等,这些就不管它了。   “打开”的区段:可以在区段中只写入轨道数据,但不写入lead-in和lead-out,TOC内容暂时写入到PMA中。这个区段就是“打开”的。这种光盘只能由刻录机读出。   关闭区段:写入当前区段的lead-in和lead-out,将PMA中的TOC写入到lead-in中。这样区段就关闭了。这种光盘所有机子都可以读了,因为有lead-in和TOC了。   封盘:在关闭当前区段时,写入lead-in的TOC中不包含链接到下一个新区段的链接,这样光盘就无法再添加新区段数据了,即封盘了。如果TOC中有包含指向新区段的链接,则光盘就是“打开”的,可以再继续添加新区段数据。 封不封盘,不会影响到光盘(比如音乐光盘CDDA)的读取,只要区段是关闭的,就可以读出。   DAO、SAO、TAO的刻录方式的原理区别,在下面的注解中。   多区段MULTISESSION是CD-R的ORANGE BOOK标准定义的,同时ISO9660标准中结合了MULTISESSION功能。 即多区段是ORINGE BOOK和ISO9660的结合。   另外,光盘的第一个LEAD-IN的位置是基本固定的。第一个LEAD-IN是给第一个SESSION用的。但不同的光盘,第一个LEAD-IN的起始点不会完全一样。光驱找到第一个LEAD-IN,就找到了第一个SESSION。多区段光盘的前一个区段LEAD-IN的TOC里有链接到下一区段的链接,所以光驱可以找到第2、3个区段等。   CD数据盘是采用了ISO9660,目录入口应可以指向CD上的任何文件,不管是在哪个SESSION里面     二、以下是对一些文献的引用、翻译和理解:   http://www.cdrfaq.org/faq02.html#S2-19 Subject: What does finalizing (and closing and fixating) do? (2002/05/26) A disc that you can add data to is "open". All data is written into the current session.   When you have finished writing, you close the session. If you want to make a multisession disc, you open a new session at the same time. If you don't open a new session then, you can't open one later, which means that it's impossible to add more data to the CD-R. The entire disc is considered "closed". 能写入数据的光盘是“打开”的。所有数据写入到当前区段,写完后,关闭当前区段。 如果要建立一个多区段光盘,则必须要在“关闭”当前区段的同时,“打开”一个新的区段。如果这时不“打开”一个新区段,那么以后就不能再进行“打开”区段操作了,也就没办法写入新的数据了,即光盘“封盘”了。   The process of changing a session from "open" to "closed" is called "finalizing", "fixating", or just plain "closing" the session.  When you close the last session, you have finalized, fixated, or closed the disc. A single-session disc has three basic regions: the lead-in, which has the Table of Contents (or TOC); the program area, with the data and/or audio tracks; and the lead-out, which is filled with zeroes and provides padding at the end of the disc.     An "open" single-session disc doesn't yet have the lead-in or lead-out written.  单区段光盘有3个区域:lead-in,轨道数据区,lead-out。 lead-in中存放了TOC。 一个“打开”的单区段光盘中,还没有写入lead-in和lead-out。   If you write data to a disc and leave the session open, the TOC -- which tells the CD player or CD-ROM drive where the tracks are -- is written into a separate area called the Program Memory Area, or PMA.  CD recorders are the only devices that know to look at the PMA, which is why you can't see data in an open session on a standard playback device.   CD players won't find any audio tracks, and CD-ROM drives won't see a data track. When the session is finalized, the TOC is written in the lead-in area, enabling other devices to recognize the disc. CD音乐播放器、CDROM光驱都是读取TOC来了解光盘的轨道位置。 如果你写完轨道数据后不关闭区段,则TOC只是被写入到PMA中,而且lead-in和lead-out都还没有写入。 只有CD刻录机才能读出PMA,而CD播放器、CDROM光驱都读不了。所以这时CD播放器、CDROM光驱都读不出光盘上的文件。 当区段关闭时,TOC被写入到lead-in中,这样CD播放器、CDROM光驱就能读出光盘上的数据了。   (我注: 可以写入轨道数据后不关闭区段,即今天刻录1个轨道,明天刻录1个轨道,TOC是写入到PMA区中,普通光驱读不了这个盘。等轨道都刻完了,再进行“关闭”操作,写入lead-in(TOC)和lead-out,使普通光驱可以读这个光盘。 只进行轨道刻录,这就是TAO刻录方式!! 所有轨道都TAO完了,再另外进行关闭区段操作。 对于音乐盘,即可以今天刻一首歌,明天刻一首歌,最后再进行“关闭”区段操作。“关闭”区段后,CD播放器才可以读盘。 )   (Something to try: write an audio track to a blank CD, and leave the session open. Put the disc in a CD player. Some players will deny the existence of the disc, some will spin the disc up to an incredible speed and won't even brake the spindle when you eject the disc, others will perform equally random acts. The TOC is important!) If you close the current session and open a new one, the lead-in and lead-out of the current session will be written.    A TOC will be written in the current lead-in that points to the eventual TOC of the next session.   This process is repeated for every closed session, resulting in a chain of links from one lead-in area to the next.    Typical audio CD players don't know about chasing TOC links, so they can only see tracks in the first session.   Your CD-ROM drive, unless it's broken or fairly prehistoric, will know about multisession discs and will happily return the first session, last session, or one somewhere in between, depending on what the OS tells it and what it is capable of. 如果关闭当前区段的同时打开一个新区段,则lead-in和lead-out会写入到当前区段中,同时一条指向“下一区段的TOC”的TOC记录会被写入到当前区段lead-in中。这样使前后二个lead-in能链接在一起了。  一般的CD音乐播放器,没有多区段光盘的读取功能,不了解这个TOC链接,故它们只能看到第一个区段的数据。 一般的CDROM光驱,有多区段光盘的读取功能,所以可以根据操作系统的要求读取任何一个区段的内容。 (我注: 多区段刻录比较常见,即今天刻录1个区段,明天增加文件时,再刻录1个区段,最后一个区段是打开的,随时可以加数据上去。并且普通光驱可以读取这个光盘。   SAO方式刻录新区段时,是lead-in、数据、lead-out一齐一次性统统写入了。 当然,也可以对新区段进行TAO方式刻录,即只写入轨道,后面需要时再进行关闭区段操作。 即: TAO =只刻录轨道数据 SAO =TAO+关闭当前区段!! DAO =对整张光盘进行单一区段SAO!! 多区段与SAO还是TAO没有关系,而是与TOC中有没有下一区段的链接有关系!!   哪个是 “最后一个区段” ?我们用多区段方式刻了第1个区段后,它“打开”了第2个区段。其实这时光盘是有2个区段了!!只是第2个区段是“打开”的,没有任何数据,没有TOC,在关闭第2个区段之前,它的TOC也会暂时存在PMA区中,WINDOWS也看不到它。 即多区段方式的“最后一个区段”都是“打开”的! 当然“最后一个区段”也可以指最后一个有数据的已关闭的区段。   WINDOWS系统是显示出最后一个有数据的已关闭的区段的文件内容。   )   Some CD-ROM drives, notably certain early NEC models, are finicky about open sessions, and will gag when they try to read the lead-in from a still-open session.   They follow the chain of links in the lead-ins of each session, but when they get to the last, they can't find a valid TOC and become confused.   Even though these drives support multi-session, they require that the last session be closed before they will read the disc successfully. Fortunately, most drives don't behave this way. 极少数不正常的CDROM光驱,虽然支持多区段,但是如果遇到最后一个区段是“打开”的时,光驱会傻掉。所以它们要求光盘的最后一区段是关闭的。 (我注:这里说的“最后一个区段”就是真正的最后一个区段,即它要求光盘是“封盘”的!)。   If you use disc-at-once (DAO) recording, the lead-in is written at the very start of the process, because the contents of the TOC are known ahead of time.   With most recorders, there is no way to specify that more than one session should be created in DAO mode, so creating a multisession disc with DAO recording isn't generally possible.   Such discs must be created with track-at-once (TAO) or session-at-once (SAO) recording. 在DAO刻录方式中,是最先写入lead-in的,因为TOC的内容已经提前知道了。但是由于基本上所有的刻录机都没办法进行一次性2个区段以上的DAO刻录,故一般没办法用DAO方式创建多区段光盘。 多区段只能用TAO或SAO方式。   If you're using certain versions of Windows, the Auto Insert Notification feature will "discover" the CD-R as soon as the TOC is written. This can cause the write process to fail, which is why Windows software automatically enables and disables AIN as needed.   Otherwise, if recording in track-at-once mode, it will fail during finalization; in disc-at-once mode, it will fail near the beginning of the write process.   In both cases, test writes will succeed, because the TOC doesn't get written during a test pass. WINDOWS的插入通告功能会影响刻录。   Packet-written discs follow the same rules with regard to open and closed sessions, which is why they have to be finalized before they can be read on a CD-ROM drive.    The "Packet Writing - Intermediate" document in the primer athttp://www.mrichter.com/cdr/primer/primer.htm goes into a little more detail on this subject. (Some people like to refer to packet writing as "PAO", for packet-at-once.) 包写入光盘的原理是相同的,所以光盘必须先关闭,才能在CDROM光驱上读取。即PAO方式。 There are gory details beyond what is written here.   For example, the lead-in on a CD-R actually has a pre-recorded TOC that specifies physical parameters of the recording layer, such as required laser recording power, and information about the disc, like how many blocks can be written (the "ATIP" discussed in section (2-38)).   You don't usually need to worry about such things though.     ―――――――――――――――――― http://www.osta.org/technology/cdqa2.htm What are the different writing modes? CD-R and CD-R/RW recorders employ several different writing modes including Disc-At-Once (DAO), Track-At-Once (TAO), Session-At-Once (SAO), and packet writing.    Be aware that not all recorders and software support all writing modes.   If in doubt, consult with the product manufacturer. During DAO recording,  the Lead-In Area, Program Area and Lead-Out Area of a CD-R or CD-RW disc are consecutively written in a single uninterrupted operation.   DAO recording is only possible using a blank disc and, after recording is completed, no additional information can be written.    Typically, DAO is used to write CD audio, CD-Text and discs destined for mass replication. DAO方式中,是一次性连续依次地写入lead-in,数据,lead-out。 DAO只能用于空白盘,并且写完了就封盘了。   In contrast to DAO, TAO operates by turning the writing laser on and off at the beginning and end of each track and writes the Program Area of a disc before its Lead-In and Lead-Out Areas.   It is possible to use a recorder to read from (or write additional tracks to) a TAO disc before a session is fixated.    All TAO discs contain 2 to 3 second gaps between tracks (run-in, run-out and link blocks) but some recorders have the ability to vary the size of the gaps. TAO方式,只是在写入每个轨道时打开激光,并且只是写入PMA区。在区段“关闭”前,可以用刻录机读出TAO光盘内容。  TAO刻出的光盘中,轨道与轨道之间会有2~3秒的空白间隔。   SAO is much like DAO in that the Lead-In Area, Program Area and Lead-Out Area are consecutively written in a single uninterrupted operation. However, the first session is not finalized so additional sessions can be added.   Typically, SAO is used to write CD Extra (Enhanced Music CD) discs where the first session contains one or multiple audio tracks and the second session consists of multimedia computer data. SAO像DAO那样,连续依次地写入lead-in,轨道数据,lead-out。但是,区段刻录没有封盘,可以继续追加区段。   Packet writing records variable (CD-R) or fixed (CD-RW) sized chunks or “packets” of data to the disc for as many times as is needed to complete the writing of the user’s files.   In the case of a CD-R disc (which is not erasable) data may be added incrementally until the disc becomes full.    CD-RW discs, on the other hand, are completely rewritable and thus are a little different from their CD-R cousins in that files can be added and deleted as needed.     ―――――――――――――― 《CDR830_quick.pdf》写: There are 5 Erase modes for CD-RW: ERASE TOC (Un-finalizes a CD-RW)―――即删除TOC,就可以“打开”光盘 ERASE LAST (Erases last track) ERASE ALL (Erases all tracks) ERASE RANGE (Erases a range of tracks) INITIALIZE (see page 38 of the operations manual)     ――――――――――――――― http://windows.microsoft.com/en-us/windows/close-finalize-cd-dvd#1TC=windows-7 Close or finalize a CD or DVD Before you can use a recordable disc (such as CD-R, DVD-R, DVD+R, DVD-R DL, or DVD+R DL) formatted with the Live File System format in other computers,  you need to close the current disc session to prepare the disc for use.    需要先关闭当前区段,才能在别的电脑使用你的刻录盘。 The disc session is closed by default when you eject a disc that can be burned in multiple sessions (called multi-session capable discs, such as CD-R, CD-RW, DVD+R, DVD-R, and BD-R discs),   as well as for single-session capable discs (such as such DVD-RW, DVD+RW, DVD-RAM, DVD+R DL, DVD-R DL, and BD-RE discs).   WINDOWS默认是自动关闭区段的。可以设置成不自动关闭。 Notes ·         After you close a disc session for multi-session capable discs, you can still add more files to the disc, but you must close each additional session to be able to use the disc on another computer. About 20 megabytes (MB) of disc space is used each time you close a session.  对于多区段光盘,关闭区段后,仍可以添加文件到光盘,但必须关闭添加的区段,这样别的电脑才能用。  每次关闭一个区段,需占用20MB左右光盘空间。   ·         If you remove a disc from your burner without closing the disc session, you can close it later on. Just insert it back into your computer's disc burner and follow the steps above to close the session.  如果没有关闭区段,则可以人工关闭它。   ·         Some programs might finalize your disc instead of closing the current session.  You can't add any additional files to a disc that has been finalized.  When you burn a CD or DVD using Windows Explorer, the disc is not finalized.   封闭光盘后,就不能再添加文件到光盘上了。WINDOWS刻录时不会封闭光盘!         三、深入探索多区段光盘的TOC的内容 在http://www.herongyang.com/CD-DVD/CD-TOC-cdrtools-readcd-fulltoc.html这里了解到,可以用“readcd.exe  -fulltoc”读出光盘中的TOC内容。 好不容易找到从http://www.student.tugraz.at/thomas.plank/index_en.html下载了,在WINDOWS中可以用,需要一并把DLL放在同一目录。 也可以在这里下载http://pan.baidu.com/s/1nt1F2Ox   比如读出一张CDDA音乐光盘,TOC内容是这样的: TOC len: 213. First Session: 1 Last Session: 1. 01 10 00 A0 00 00 00 00 01 00 00-表示本区段第1个轨道编号是01# 01 10 00 A1 00 00 00 00 10 00 00-表示本区段最后一个轨道编号是16# 01 10 00 A2 00 00 00 00 42 28 22-表示本区段的lead-out位置在66分40秒34分帧(注:1秒有75分帧,即75个子块) 01 12 00 01 00 00 00 00 00 02 00-表示01#轨道位置在0分2秒0分帧 01 12 00 02 00 00 00 00 06 32 46 01 12 00 03 00 00 00 00 09 0A 1B 01 12 00 04 00 00 00 00 0C 1D 25 01 12 00 05 00 00 00 00 11 2D 05 01 12 00 06 00 00 00 00 19 08 1E 01 12 00 07 00 00 00 00 1C 1C 2C 01 12 00 08 00 00 00 00 1F 3A 05 01 12 00 09 00 00 00 00 27 01 2B 01 12 00 0A 00 00 00 00 2B 2C 15 01 12 00 0B 00 00 00 00 2E 2C 0B 01 12 00 0C 00 00 00 00 32 11 18 01 12 00 0D 00 00 00 00 35 32 46 01 12 00 0E 00 00 00 00 3B 09 18 01 12 00 0F 00 00 00 00 3E 09 10 01 12 00 10 00 00 00 00 40 2D 1F-表示16#轨道位置在64分45秒31分帧 FF 22 00 00 00 00 00 00 00 00 00 Lead out 1: 299884     对于多区段数据光盘: 一张2个区段的光盘,刻录时,每次都是“创建MULTI SESSION”,则各个SESSION内的文件互不相关,WINDDOWS只能看到最后一个SESSION的文件内容。 另一张2个区段的光盘,刻录时,第二次是“继续MULTI SESSION”,则WINDDOWS看到的是所有SESSION合成后的文件内容。其实并不是最后一个SESSION中的TOC中包含了前面所有SESSION的轨道信息,而是多区段也结合了ISO9660,在ISO9660作用下可以定位到所有文件。   这2张光盘,readcd.exe读出来的TOC信息是完全一样的,都是如下:   TOC len: 125. First Session: 1   Last Session: 2.   01 14 00 A0 00 00 00 00 01 00 00-表示本区段第1个轨道编号是01# 01 14 00 A1 00 00 00 00 01 00 00-表示本区段最后一个轨道编号是01# 01 14 00 A2 00 00 00 00 00 0A 00-表示本区段的lead-out位置在0分15秒0分帧(注:1秒有75分帧,即75个子块) 01 14 00 01 00 00 00 00 00 02 00-表示01#轨道位置在0分2秒0分帧 01 54 00 B0 02 28 00 02 4F 3B 47-表示下一区段的轨道数据起始位置在2分40秒0分帧 01 54 00 C0 A0 00 30 00 61 1A 42   02 14 00 A0 00 00 00 00 02 00 00-表示本区段第1个轨道编号是02# 02 14 00 A1 00 00 00 00 02 00 00-表示本区段最后一个轨道编号是02#   02 14 00 A2 00 00 00 00 02 32 00-表示本区段的lead-out位置在2分50秒0分帧 02 14 00 02 00 00 00 00 02 2A 00-表示02#轨道位置在2分42秒0分帧 02 54 00 B0 04 14 00 01 4F 3B 47-表示下一区段的轨道数据起始位置在4分20秒0分帧(即“打开”了第3区段) 00 00 00 00 00 00 00 00 00 00 00 Lead out 1: 600 Lead out 2: 12600   可见,第2个区段的TOC中并没有包含第1个区段的轨道位置信息,这二个区段的文件能相关联起来,全靠ISO9660。   TOC格式中具体代表什么意思,可参考红皮书,或者ECMA130标准第32页。 B0、C0标识是在多区段光盘中才有的,只找到了00-363r1.pdf第40页,可以去下载参考ftp://ftp.t10.org/t10/document.00/00-363r1.pdf。  
相关资源