如何使用 IMAPI2 检索和设置刻录速度?
有谁知道如何使用 IMAPI2 设置 CD/DVD 刻录速度(例如 4x、10x)?
另外,我首先需要获得媒体支持的速度。我怎样才能找回它们?
Does anyone know how to set CD/DVD burn speed (e.g. 4x, 10x) using IMAPI2?
Also, I first need to get the speeds supported by the media. How can I retrieve them?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要设置刻录速度,您可以使用方法IDiscFormat2Data::SetWriteSpeed 来自 IDiscFormat2Data 接口。它允许您请求光学介质支持的最大速度或指定所需的刻录速度。
要检索刻录设备和当前介质支持的写入速度,您可以使用方法IDiscFormat2Data::get_SupportedWriteSpeeds
这些方法使用每秒扇区数,而不是 4x、10x 等。您可以使用以下常量将一种方法转换为另一种方法:
扇区中的字节数。
CD 旋转的基本速率,以每秒扇区为单位测量。
DVD 旋转的基本速率,以每秒扇区为单位测量。
蓝光光盘旋转的基本速率,以每秒扇区为单位测量。
来自imapi2.h头文件:
To set the burn speed you can use the method IDiscFormat2Data::SetWriteSpeed from IDiscFormat2Data interface. It lets you request the maximum speed supported by optical media or specify the wanted burning speed.
In order to retrieve the supported write speeds by the burning device and current media you can use the method IDiscFormat2Data::get_SupportedWriteSpeeds
To check the current write speed you have the IDiscFormat2Data::get_CurrentWriteSpeed method.
Those methods use sectors per second instead of 4x, 10x, etc. You can convert from one to another using the following constants:
Number of bytes in a sector.
Base rate of speed that a CD spins, measured in sectors per second.
Base rate of speed that a DVD spins, measured in sectors per second.
Base rate of speed that a Blu-ray disc spins, measured in sectors per second.
from imapi2.h header:
Microsoft 最初发布了 C# 的 IMAPI 接口。它有很多问题。您可以阅读有关它的更多信息 这里。所以我正在使用这个源代码(由
Eric Haddan 在 Code Project 上)而不是 Microsoft 发布的副本。因此,您可能会发现文档方面存在一些差异。
在与写入速度交互(获取/设置)之前,您需要执行一些初始操作,例如设置记录器。我假设您知道所有这些,并在这个答案中跳过它以缩短长度。
要设置刻录速度,您可以选择首先获取支持的写入速度:
然后,根据上面收到的支持的值,您可以设置写入速度:
在上面的方法中,参数
requestedSectorsPerSecond
是字符串的索引您从之前的方法收到的数组(写入速度)。您可以将旋转类型(纯 CAV)设置为false
。以下内容来自 Microsoft :
上面代码中使用的对象名称是根据 IMAPI 本身。这就是为什么我没有添加更多关于 IMAPI 接口的描述。 @rmp 的其他答案已经给出了更多详细信息。
Microsoft initially released IMAPI interface for C#. It had many problems. You can read more about it here. So I am using this source code (written by
Eric Haddan on Code Project) instead of the copy that was released by Microsoft. So, you may see some differences with respect to documentation.
Before you interact with write speed (get/set), you need to do some initial actions like setting the recorder. I am assuming you know all this and skipping it in this answer to shorten the length.
To set the burn speed, you optionally need to get the supported write speeds first:
Then, based on received supported values above, you can set the write speed:
In above method, parameter
requestedSectorsPerSecond
is index of string array (write speed) you received from earlier method. You may set rotation type (pure CAV) tofalse
.Following is from Microsoft:
Names of the objects used in code above are according to IMAPI itself. That is why, I am not adding more description about the IMAPI interface. More details are already given by other answer from @rmp.