Image Masterin api (imapi)


About the Image Mastering API



Yüklə 373 Kb.
səhifə2/6
tarix07.11.2018
ölçüsü373 Kb.
#78601
1   2   3   4   5   6

About the Image Mastering API


The Image Master API (IMAPI) allows an application to “stage” and “burn” a simple audio or data image to on a CD-R or CD-R/W devices. The specific formats to be supported are Redbook audio and data discs with both Joliet and ISO 9660. The API architecture allows for future expansion of the supported format set.

This document focuses on a description of the Adaptec implementation of IMAPI for Microsoft. As such, descriptions of the four main COM objects and their interfaces are included in this document. The four main objects are as follows: MSDiscMasterObj, MSDiscRecorderObj, MSDiscStashObj, and MSBurnEngineObj. Of these, the MSDiscMasterObj is the only object with multiple interfaces besides IUnknown. In particular:



There may be multiple MSDiscMasterObj objects instantiated on a system, but only one application may access a recorder at a time. Applications use the IDiscMaster interface to open IMAPI, enumerate supported formats (Joliet and Redbook), select a format, get a list of recorders, select a recorder, and finally start a burn. The IJolietDiscMaster and IRedbookDiscMaster interfaces are returned to an application through the IDiscMaster interface when a format is selected, and they allow specific control of the content of a data or audio disc respectively. While it is expected that every application will be able to find and talk to IDiscMaster and IDiscRecorder, it is not expected that every application will know about or understand the specific format interfaces. Applications can access generic properties of the IJolietDiscMaster Interface. This includes such properties as volume name or legacy file name.



MSDiscRecorder objects are accessed through IDiscRecorder interfaces. Every CD-R or CD-R/W device that is compatible with IMAPI will have a corresponding MSDiscRecorder object. An application uses the pointers to the IDiscRecorder interfaces on those objects to select which device will be used by IMAPI to record a CD. In addition, applications can access generic properties of a recorder through the IDiscRecorder interface. This includes such properties as writer speed or other burn parameters.

The remaining two objects: MSDiscStashObj and MSBurnEngineObj are internal interfaces accessed by IMAPI. They are minimally documented to clarify architecture only. The MSDiscStashObj represents (through IDiscStash) a raw file up to 800 MB in size that is used by MSDiscMasterObj to create images of the audio or data discs to be burned. The stash is then passed on to the MSBurnEngineObj (through IMSBurnEngine) when a burn is requested from the lower level engine. The MSBurnEngineObj expects that the contents of the stash will be in a specific known format. In this respect, the MSDiscMasterObj and MSBurnEngineObj have an unwritten contract as to the content of the stash.


Using the Image Mastering API


An application using IMAPI communicates with it through IDiscMaster, IDiscRecorder, IJolietDiscMaster, and IRedbookDiscMaster. The following flow describes a normal interaction between an application and these interfaces.

  1. Create an instance of the MSDiscMasterObj using normal COM techniques (CoCreateInstance, smart pointers from an import, and so on) and request the IDiscMaster interface.

  2. Acquire access to IMAPI through IDiscMaster. The application should call the Open method on IDiscMaster. If this succeeds, the application has full access to all the interfaces and methods implemented in MSDiscMasterObj.

  3. Retrieve the disc master format enumerator to examine the set of formats that the disc master object supports, and then choose the active format. The “formats” returned from the enumerator are, in this case, the IIDs of the interfaces for IJolietDiscMaster and IRedbookDiscMaster.

  4. Enumerate the list of supported disc recorders (specific to the active format), and then choose one of these to be the active recorder. IDiscRecorder represents a physical device.

  5. Use ProgressAdvise on IDiscMaster to register for progress callbacks.

  6. Use the interface for the selected format to build up content. Content builds incrementally, so tracks or folder contents may be added to a disc piece by piece. Building up this content is called “staging an image”. The contents of the staged image cannot be incrementally deleted (you can’t remove a track that has been added), but it is possible to clear all the contents of a staged image so that staging can start again. Use the ClearFormatContent method on the IDiscMaster interface to restart staging.


For Audio:

  1. Use CreateAudioTrack to indicate a new audio track is being started on the disc.

  2. Use AddAudioTrackBlocks to add raw audio data to a track. At any point, the application can use the GetxxxAudioBlocks methods to get statistical information like total blocks remaining, or total blocks used.

  3. Use CloseAudioTrack to close out an audio track.

  4. Repeat steps 7-9 until out of space or all audio tracks have been written.

  5. Use the RecordDisc method of IDiscMaster to record the disc.

  6. Close the IMAPI session using IDiscMaster. Closing out the session will wipe out whatever may have been stored in the disc stash.


For Data:

  1. Use AddData to add the contents of folder to the image. The sub-items within a passed in folder become placed in the root of the image file. Use the GetDataBlocks methods to get statistical information like total blocks remaining or total blocks used.

  2. Repeat step 13 until out of space or all the data has been added.


For All Discs:

  1. Use the RecordDisc method of IDiscMaster to record the disc.

  2. Close the IMAPI session using IDiscMaster. Closing out the session will clear the disc stash.

Yüklə 373 Kb.

Dostları ilə paylaş:
1   2   3   4   5   6




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©genderi.org 2024
rəhbərliyinə müraciət

    Ana səhifə