Mac Developer Library

Developer

DRTrack Class Reference

Options
Deployment Target:

On This Page

DRTrack

The DRTrack class represents a track on the burned disc.

About tracks

A DRTrack provides data to the for the burn and contains a description of the track on disc (length, block type, data format, etc). Data is provided for the burn in a real-time thread. It is up to the track to provide this data in a timely manner, otherwise a burn underrun can occur and ruin a disc.

Data Production

DRTracks do not typically store or cache the data to be written to disk, instead the data is streamed to the disc from some data producer as it's needed. This is accomplished through an object associated with the track when the track is created called the track producer. A track producer is a class you create that implements the DRTrackDataProduction informal protocol. This protocol defines all of the methods that a track object will call during a burn to obtain data.

Track Properties

A DRTrack object contains several properties which define the track for the burn. These properties are stored in an NSDictionary and are accessed through the properties and setProperties: methods.

There are several properties that are required to be present and if they are not, will cause the burn to fail. These are:

The possible values of these properties are defined in the Mt. Fuji (IFF-8090i) specification for CD/DVD devices. It's up to you to understand the possible values and meanings of each.

All other keys contained in the properties dictionary are optional and can be omitted.

  • Asks the track producer for a size estimate.

    Declaration

    - (uint64_t) estimateLength;

    Return Value

    The estimated length of the track.

    Discussion

    This method calls the track producer to ask it to estimate the size needed for its data.

    For some types of track, this call may be very expensive. For example, a DRFilesystemTrack may need to iterate folders on disk to provide an accurate estimate, which (if a large number of files and folders are involved) can cause this call to take 30 seconds or more. Since your main thread should not be allowed to block for this long, you may wish to call this function on a separate thread.

  • Initializes a DRTrack with the producer

    Declaration

    - (id) initWithProducer:(id)producer;

    Parameters

    producer

    The object to use as the data producer

    Return Value

    A DRTrack

  • Returns the properties dictionary of the track.

    Declaration

    - (NSDictionary*) properties;

    Return Value

    An NSDictionary containing the properties of the track.

  • Sets the properties dictionary of the track

    Declaration

    - (void) setProperties:(NSDictionary*)properties;

    Parameters

    properties

    NSDictionary of the properties to set.

  • Tests the production speed for a specified interval.

    Declaration

    - (float) testProductionSpeedForInterval:(NSTimeInterval)interval;

    Parameters

    interval

    The length of the test in seconds.

    Return Value

    The maximum speed data can be produced at.

    Discussion

    Runs a fake "production" cycle, repeatedly asking the receiver for data by calling it's producer's produceDataIntoBuffer:length:atAddress:blockSize:ioFlags: for the specified time interval.

    Use this function to verify that the the production code can produce data fast enough to satisfy the data throughput requirements of the burn.

    Returns the calculated maximum speed the at which the receiver can produce data. This value should be used when setting up a burn to limit the burn speed

  • Tests the production speed for a specified byte count.

    Declaration

    - (float) testProductionSpeedForLength:(uint32_t)length;

    Parameters

    length

    The length of the test in bytes.

    Return Value

    The maximum speed data can be produced at.

    Discussion

    Runs a fake "production" cycle, repeatedly asking the receiver for data by calling it's producer's produceDataIntoBuffer:length:atAddress:blockSize:ioFlags: until the specified length number of bytes have been produced.

    Use this function to verify that the the production code can produce data fast enough to satisfy the data throughput requirements of the burn.

    Returns the calculated maximum speed the at which the receiver can produce data. This value should be used when setting up a burn to limit the burn speed