Mac Developer Library

Developer

IOCDMedia Class Reference

Options
Deployment Target:

On This Page
Language:

IOCDMedia

Inheritance


  • IOCDMedia

Conforms To


Not Applicable

Import Statement


Not Applicable

Objective-C

@import Kernel;

Availability


Available in OS X v10.6 and later.

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

    C++

    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

    C++

    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

    C++

    virtual void read( IOService *client, UInt64byteStart, 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

    C++

    #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

    C++

    #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

    C++

    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

    C++

    virtual IOReturn readISRC( UInt8track, CDISRCisrc);

    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

    C++

    virtual IOReturn readMCN( CDMCNmcn);

    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

    C++

    virtual IOReturn readTOC( IOMemoryDescriptor *buffer, CDTOCFormatformat, UInt8formatAsTime, UInt8trackOrSessionNumber, 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

    C++

    virtual IOReturn readTrackInfo( IOMemoryDescriptor *buffer, UInt32address, CDTrackInfoAddressTypeaddressType, 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

    C++

    virtual IOReturn setSpeed( UInt16kilobytesPerSecond);

    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.