Mac Developer Library

Developer

IOCDMedia Class Reference

Options
Deployment Target:

On This Page

IOCDMedia

The IOCDMedia class is a random-access disk device abstraction for CDs.

The IOCDMedia class is a random-access disk device abstraction for CDs. It extends the IOMedia class by implementing special CD APIs, such as readCD, and publishing the TOC as a property of the IOCDMedia object.

  • Declaration

    virtual IOReturn getSpeed( UInt16 *kilobytesPerSecond);

    Parameters

    kilobytesPerSecond

    Returns the current speed used for data transfers, in kB/s.

    kCDSpeedMin specifies the minimum speed for all CD media (1X). kCDSpeedMax specifies the maximum speed supported in hardware.

    Return Value

    Returns the status of the operation.

    Discussion

    Get the current speed used for data transfers.

  • Declaration

    virtual CDTOC * getTOC();

    Return Value

    Returns a pointer to the TOC buffer (do not deallocate).

    Discussion

    Get the full Table Of Contents.

    All CDTOC fields passed across I/O Kit APIs are guaranteed to be binary-encoded (no BCD-encoded numbers are ever passed).

  • Declaration

    virtual void read( IOService *client, UInt64 byteStart, IOMemoryDescriptor *buffer, IOStorageAttributes *attributes, IOStorageCompletion *completion);

    Parameters

    client

    Client requesting the read.

    byteStart

    Starting byte offset for the data transfer.

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    attributes

    Attributes of the data transfer. See IOStorageAttributes. It is the responsibility of the callee to maintain the information for the duration of the data transfer, as necessary.

    completion

    Completion routine to call once the data transfer is complete. It is the responsibility of the callee to maintain the information for the duration of the data transfer, as necessary.

    Discussion

    Read data from the storage object at the specified byte offset into the specified buffer, asynchronously. When the read completes, the caller will be notified via the specified completion action.

    The buffer will be retained for the duration of the read.

  • Declaration

    #ifdef __LP64__ virtual void readCD( IOService *client, UInt64 byteStart, IOMemoryDescriptor *buffer, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageAttributes *attributes, IOStorageCompletion *completion); #else /* !__LP64__ */ virtual void readCD( IOService *client, UInt64 byteStart, IOMemoryDescriptor *buffer, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageCompletion completion); #endif /* !__LP64__ */

    Parameters

    client

    Client requesting the read.

    byteStart

    Starting byte offset for the data transfer (see sectorArea parameter).

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    sectorArea

    Sector area(s) to read. The sum of each area's size defines the natural block size of the media for the call. This should be taken into account when computing the address of byteStart. See IOCDTypes.h.

    sectorType

    Sector type that is expected. The data transfer is terminated as soon as data is encountered that does not match the expected type.

    attributes

    Attributes of the data transfer. See IOStorageAttributes. It is the responsibility of the callee to maintain the information for the duration of the data transfer, as necessary.

    completion

    Completion routine to call once the data transfer is complete. It is the responsibility of the callee to maintain the information for the duration of the data transfer, as necessary.

    Discussion

    Read data from the CD media object at the specified byte offset into the specified buffer, asynchronously. Special areas of the CD sector can be read via this method, such as the header and subchannel data. When the read completes, the caller will be notified via the specified completion action.

    The buffer will be retained for the duration of the read.

  • Declaration

    #ifdef __LP64__ virtual IOReturn readCD( IOService *client, UInt64 byteStart, IOMemoryDescriptor *buffer, CDSectorArea sectorArea, CDSectorType sectorType, IOStorageAttributes *attributes = 0, UInt64 *actualByteCount = 0); #else /* !__LP64__ */ virtual IOReturn readCD( IOService *client, UInt64 byteStart, IOMemoryDescriptor *buffer, CDSectorArea sectorArea, CDSectorType sectorType, UInt64 *actualByteCount = 0); #endif /* !__LP64__ */

    Parameters

    client

    Client requesting the read.

    byteStart

    Starting byte offset for the data transfer (see sectorArea parameter).

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    sectorArea

    Sector area(s) to read. The sum of each area's size defines the natural block size of the media for the call. This should be taken into account when computing the address of byteStart. See IOCDTypes.h.

    sectorType

    Sector type that is expected. The data transfer is terminated as soon as data is encountered that does not match the expected type.

    attributes

    Attributes of the data transfer. See IOStorageAttributes.

    actualByteCount

    Returns the actual number of bytes transferred in the data transfer.

    Return Value

    Returns the status of the data transfer.

    Discussion

    Read data from the CD media object at the specified byte offset into the specified buffer, synchronously. Special areas of the CD sector can be read via this method, such as the header and subchannel data. When the read completes, this method will return to the caller. The actual byte count field is optional.

  • Declaration

    virtual IOReturn readDiscInfo( IOMemoryDescriptor *buffer, UInt16 *actualByteCount);

    Parameters

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    actualByteCount

    Returns the actual number of bytes transferred in the data transfer.

    Return Value

    Returns the status of the data transfer.

    Discussion

    Issue an MMC READ DISC INFORMATION command.

  • Declaration

    virtual IOReturn readISRC( UInt8 track, CDISRC isrc);

    Parameters

    track

    Track number from which to read the ISRC.

    isrc

    Buffer for the ISRC data. Buffer contents will be zero-terminated.

    Return Value

    Returns the status of the operation.

    Discussion

    Read the International Standard Recording Code for the specified track.

  • Declaration

    virtual IOReturn readMCN( CDMCN mcn);

    Parameters

    mcn

    Buffer for the MCN data. Buffer contents will be zero-terminated.

    Return Value

    Returns the status of the operation.

    Discussion

    Read the Media Catalog Number (also known as the Universal Product Code).

  • Declaration

    virtual IOReturn readTOC( IOMemoryDescriptor *buffer, CDTOCFormat format, UInt8 formatAsTime, UInt8 trackOrSessionNumber, UInt16 *actualByteCount);

    Parameters

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    format

    As documented by MMC.

    formatAsTime

    As documented by MMC.

    trackOrSessionNumber

    As documented by MMC.

    actualByteCount

    Returns the actual number of bytes transferred in the data transfer.

    Return Value

    Returns the status of the data transfer.

    Discussion

    Issue an MMC READ TOC/PMA/ATIP command.

  • Declaration

    virtual IOReturn readTrackInfo( IOMemoryDescriptor *buffer, UInt32 address, CDTrackInfoAddressType addressType, UInt16 *actualByteCount);

    Parameters

    buffer

    Buffer for the data transfer. The size of the buffer implies the size of the data transfer.

    address

    As documented by MMC.

    addressType

    As documented by MMC.

    actualByteCount

    Returns the actual number of bytes transferred in the data transfer.

    Return Value

    Returns the status of the data transfer.

    Discussion

    Issue an MMC READ TRACK INFORMATION command.

  • Declaration

    virtual IOReturn setSpeed( UInt16 kilobytesPerSecond);

    Parameters

    kilobytesPerSecond

    Speed to be used for data transfers, in kB/s.

    kCDSpeedMin specifies the minimum speed for all CD media (1X). kCDSpeedMax specifies the maximum speed supported in hardware.

    Return Value

    Returns the status of the operation.

    Discussion

    Set the speed to be used for data transfers.