(1)什么是多区段刻录?
即MultiSession,这是多区段刻录方式。每个刻录过程只刻录并且关闭一个区段,剩余空间下次可以继续刻录下一区段。因此,往往光盘上存在多个区段,称为多区段光盘。如果光盘中只有一个区段,但光盘没有关闭,也可成为多区段光盘。这种方式多用于数据光盘的刻录,方便之处在于不必一次刻满整盘。
(2)多区段刻录的应用
在Nero中就很好的实现了多区段刻录的功能,具体可以查看这里
http://hi.baidu.com/wyshyr/blog/item/3c2599ee2ae7322a2cf53409.html
(3)IMAPI如何实现多区段刻录
首先,在MSDN(http://msdn.microsoft.com/zh-cn/library/aa364806%28v=VS.85%29.aspx)上查看的IMAPI的功能支持多区段刻录
IMAPI provides the following capabilities:
Creates and burns single-session and multisession discs
那么我们如何来实现呢,可以参考SDK的例子imapi2sample。
(1)IDiscFormat2Data对象提供get_MultisessionInterfaces方法用来获取当前多区段接口
(2)调用IFileSystemImage对象提供的put_MultisessionInterfaces方法用来设置当前的多区段接口
- // Check if media is blank
- if (SUCCEEDED(hr))
- {
- hr = dataWriter->get_MediaHeuristicallyBlank(&isBlank);
- if (FAILED(hr))
- {
- printf("Failed to get_MediaHeuristicallyBlank/n");
- PrintHR(hr);
- }
- }
- if (SUCCEEDED(hr) && !options.Multi && !isBlank)
- {
- printf("*** WRITING TO NON-BLANK MEDIA WITHOUT IMPORT! ***/n");
- }
- // ImportFileSystem - Import file data from disc
- if (SUCCEEDED(hr) && options.Multi)
- {
- FsiFileSystems fileSystems;
- SAFEARRAY* multiSession = NULL;
- // Get mutlisession interface to set in image
- if (SUCCEEDED(hr))
- {
- hr = dataWriter->get_MultisessionInterfaces(&multiSession);
- if (FAILED(hr))
- {
- printf("Failed dataWriter->MultisessionInterfaces/n");
- PrintHR(hr);
- }
- }
- // Set the multisession interface in the image
- if (SUCCEEDED(hr))
- {
- hr = image->put_MultisessionInterfaces(multiSession);
- if (FAILED(hr))
- {
- printf("Failed image->put_MultisessionInterfaces/n");
- PrintHR(hr);
- if (multiSession != NULL)
- {
- SafeArrayDestroy(multiSession);
- }
- }
- multiSession = NULL;
- }
- if (SUCCEEDED(hr))
- {
- hr = image->ImportFileSystem(&fileSystems);
- if (FAILED(hr))
- {
- if (hr == IMAPI_E_EMPTY_DISC)
- {
- printf("Empty Disc/n");
- hr = S_OK;
- }
- else
- {
- printf("Failed to ImportFileSystem/n");
- PrintHR(hr);
- }
- }
- }
- }