|
Mac Dev Center
Mac OS X Reference Library Drivers, Kernel, & Hardware: User-Space Device Access Disc Recording Framework Reference
|
DRTrackDataProduction |
| Declared In: |
Informal protocol describing methods implemented by a track data producer.
The DRTrackDataProduction informal protocol defines those methods that a track data producer instance can implement. A track data producer is the object that is resposible for providing the track data to the burn engine on request.
In concept a track data producer similar to an NSTable data source in Cocoa. Each producer method receives a pointer to the track it should produce data for. There is one method that must be implemented - produceDataForTrack:intoBuffer:length:atAddress:blockSize:ioFlags: .
The methods of this protocol will be called in roughly this order:
If verification of the disc is not requested, or a track omits or defines DRVerificationTypeKey to be DRVerificationTypeNone , then prepareTrackForVerification: , verifyDataForTrack:inBuffer:length:atAddress:blockSize:ioFlags: and cleanupTrackAfterVerification: will not be called.
During a burn, produceDataForTrack:intoBuffer:length:atAddress:blockSize:ioFlags: is called very frequently in a real-time thread. Because of this, it is of utmost importance that this method very effficient and does not perform any long task, since by doing so, the burn may fail because data is not available to write to the disc.
Cleans up the track after the burn completes.
Cleans up the track after the verification completes.
Estimates the size of the track to be burned.
Prepares the track for burning.
Prepare the track to be verified.
Produces the track data.
Produces the pregap data.
Cleans up the track after the burn completes.
Checks the integrity track pregap after a burn.
cleanupTrackAfterBurn: |
Cleans up the track after the burn completes.
trackThe track object being burned
YES to indicate that the burn should proceed and NO to indicate a failure occurred.
Called after burning is complete. Typically you'll clean up what was setup in prepareTrackForBurn. Since this method is called after the laser is turned off and the burn is finished, this method can perform time consuming tasks.
cleanupTrackAfterVerification: |
Cleans up the track after the verification completes.
trackThe track object being burned
Return YES to indicate success, NO to indicate failure.
Once the verification phase is complete, this method is called. The class implementing the method has a chance to do anything up to and including failing the verification.
estimateLengthOfTrack: |
Estimates the size of the track to be burned.
- (uint64_t) estimateLengthOfTrack:(DRTrack*)track;
trackThe track object for which to estimate the size
The number of blocks of data that the track will occupy. The estimate should be reasonably accurate, and no smaller than the actual size that will be needed.
This message is sent outside of a burn cycle in response to a -estimateLength message sent to the track.
prepareTrack:forBurn:toMedia: |
Prepares the track for burning.
- (BOOL) prepareTrack:(DRTrack*)track forBurn:(DRBurn*)burn toMedia:(NSDictionary*)mediaInfo;
trackThe track object being burned
burnThe burn object controlling the burn
mediaInfoThe media being burned to. This is the same dictionary as returned by -[DRDevice status] .
YES to indicate that the burn should proceed and NO to indicate a failure occurred.
Called before any burning starts. Do any sort of setup that needs to be performed (such as opening files). This method can calculate and update the exact track length that will be burned.
Since this method is called before the laser is turned on, this method can perform time consuming tasks.
prepareTrackForVerification: |
Prepare the track to be verified.
trackThe track object being burned
YES to indicate that the verification should proceed and NO to indicate a failure occurred.
This method is called after the burn complets writing data to disc and before verification phase starts. Now would be a good time to prepare to produce data again by rewinding to the start of files, etc.
produceDataForTrack:intoBuffer:length:atAddress:blockSize:ioFlags: |
Produces the track data.
- (uint32_t) produceDataForTrack:(DRTrack*)track intoBuffer:(char*)buffer length:(uint32_t)bufferLength atAddress:(uint64_t)address blockSize:(uint32_t)blockSize ioFlags:(uint32_t*)flags;
trackThe track object being burned
bufferThe buffer to place data into
bufferLengthThe length of buffer
addressThe on-disc address of where data will be written
blockSizethe size of each block on the disc. It's best to return a multiple of this size.
flagsflags
The number of bytes produced.
This method is called many times over the course of a burn to obtain data for the track. The buffer passed in will be a multiple of blockSize (bufferLength == blockSize * N, where N > 1) and should be filled as full as possible with data. address is the sector address on the disc from the start of the track that is the buffer will be written to.
Since while burning, keeping the drive's buffer full is of utmost importance, you should not perform lengthy operations or block for data in this method. This method should return the number of bytes actually in the buffer or 0 to indicate that there was an error producing the data..
producePreGapForTrack:intoBuffer:length:atAddress:blockSize:ioFlags: |
Produces the pregap data.
- (uint32_t) producePreGapForTrack:(DRTrack*)track intoBuffer:(char*)buffer length:(uint32_t)bufferLength atAddress:(uint64_t)address blockSize:(uint32_t)blockSize ioFlags:(uint32_t*)flags;
trackThe track object being burned
bufferThe buffer to place data into
bufferLengthThe length of buffer
addressThe on-disc address of where data will be written
blockSizethe size of each block on the disc. It's best to return a multiple of this size.
flagsflags
The number of bytes produced.
This method is called to obtain data for the track's pregap. If the DRPreGapLengthKey key is present in the track properties, the track producer will be asked for the pregap data first. If the producer implements this selector, then it's the responsibility of the producer to provide data for the pregap, otherwise that length of silence will be produced by DiscRecording.
The buffer passed in will be a multiple of blockSize (bufferLength == blockSize * N, where N > 1) and should be filled as full as possible with data. address is the sector address on the disc from the start of the track that is the buffer will be written to.
Since while burning, keeping the drive's buffer full is of utmost importance, you should not perform lengthy operations or block for data in this method. This method should return the number of bytes actually in the buffer or 0 to indicate that there was an error producing the data..
verifyDataForTrack:inBuffer:length:atAddress:blockSize:ioFlags: |
Cleans up the track after the burn completes.
- (BOOL) verifyDataForTrack:(DRTrack*)track inBuffer:(const char*)buffer length:(uint32_t)bufferLength atAddress:(uint64_t)address blockSize:(uint32_t)blockSize ioFlags:(uint32_t*)flags;
trackThe track object being burned
bufferThe data read in from the track to compare with
bufferLengthThe length of buffer
addressThe on-disc address of where data will was read from.
blockSizethe size of each block on the disc. It's best to return a multiple of this size.
flagsflags
YES to indicate that the data compared successfully and NO to indicate a failure occurred.
If the class implementing this method asks for a verification type of DRVerificationTypeReceiveData, then a series of calls to this method will start. It's up to the class to reproduce the data again and compare it to the data passed in buffer. The buffer passed in will be a multiple of blockSize (bufferLength == blockSize * N, where N > 1). address is the sector address on the disc from the start of the track that is the buffer was written to.
verifyPreGapForTrack:inBuffer:length:atAddress:blockSize:ioFlags: |
Checks the integrity track pregap after a burn.
- (BOOL) verifyPreGapForTrack:(DRTrack*)track inBuffer:(const char*)buffer length:(uint32_t)bufferLength atAddress:(uint64_t)address blockSize:(uint32_t)blockSize ioFlags:(uint32_t*)flags;
trackThe track object being burned
bufferThe data read in from the track to compare with
bufferLengthThe length of buffer
addressThe on-disc address of where data will was read from.
blockSizethe size of each block on the disc. It's best to return a multiple of this size.
flagsflags
YES to indicate that the data compared successfully and NO to indicate a failure occurred.
If the class implementing this method asks for a verification type of DRVerificationTypeReceiveData, then a series of calls to this method will start. It's up to the class to reproduce the pregap again and compare it to the data passed in buffer. The buffer passed in will be a multiple of blockSize (bufferLength == blockSize * N, where N > 1). address is the sector address on the disc from the start of the track that is the buffer was written to.
Last Updated: 2009-08-12