| Framework | DVDPlayback |
| Companion guide | |
| Declared in | DVDPlayback.h |
DVD Playback is a core technology introduced in Mac OS X version 10.3. Mac OS X applications can use DVD Playback to display a DVD-Video recording located on an optical disc or a mass storage device such as a hard drive. DVD Playback makes it easy for applications to incorporate basic video playback features such as selecting a title from a menu and playing the title, as well as advanced features such as bookmarks, video clips, and multiple viewing angles.
DVDIsValidMediaRef
DVDOpenMediaFile
DVDOpenMediaVolume
DVDHasMedia
DVDCloseMediaFile
DVDCloseMediaVolume
DVDGetVideoDevice Deprecated in Mac OS X v10.5
DVDIsSupportedDevice Deprecated in Mac OS X v10.5
DVDSetVideoDevice Deprecated in Mac OS X v10.5
DVDSwitchToDevice Deprecated in Mac OS X v10.5
DVDSetVideoWindowID
DVDGetVideoWindowID
DVDGetNativeVideoSize
DVDGetAspectRatio
DVDGetFormatStandard
DVDGetVideoBounds Deprecated in Mac OS X v10.5
DVDGetVideoPort Deprecated in Mac OS X v10.5
DVDSetVideoBounds Deprecated in Mac OS X v10.5
DVDSetVideoPort Deprecated in Mac OS X v10.5
These functions are used to access audio streams in the current title.
DVDSetAudioStream
DVDGetAudioStream
DVDGetNumAudioStreams
DVDGetAudioStreamFormat
DVDGetAudioStreamFormatByStream
You can use these functions to access the current video playback position relative to the beginning or end of the title.
DVDEnableWebAccess
DVDIsPlaying
DVDIsPaused
DVDPlay
DVDPause
DVDResume
DVDStop
DVDScan
DVDGetScanRate
DVDGetState
DVDStepFrame
DVDSleep
DVDWakeUp
These functions are used to adjust the playback audio volume, relative to the current system volume.
These functions are used to access menus, navigate between menu buttons in response to keyboard or mouse events, and perform the actions that buttons represent.
DVDHasMenu
DVDIsOnMenu
DVDGoToMenu
DVDReturnToTitle
DVDGoBackOneLevel
DVDDoUserNavigation
DVDDoButtonActivate
DVDGetButtoninfo
DVDGetButtonPosition
DVDDoMenuClick Deprecated in Mac OS X v10.5
DVDDoMenuMouseOver Deprecated in Mac OS X v10.5
These functions are used to access chapters in the current title.
These functions are used to access subpictures in the current title.
DVDDisplaySubPicture
DVDIsDisplayingSubPicture
DVDSetSubPictureStream
DVDGetSubPictureStream
DVDGetNumSubPictureStreams
These functions are used to access language codes that determine which subpicture, audio stream, or menu is used.
DVDSetDefaultSubPictureLanguageCode
DVDGetSubPictureLanguageCode
DVDGetSubPictureLanguageCodeByStream
DVDSetDefaultAudioLanguageCode
DVDGetAudioLanguageCode
DVDGetAudioLanguageCodeByStream
DVDSetDefaultMenuLanguageCode
DVDGetMenuLanguageCode
DVDGetBookmark
DVDGotoBookmark
DVDGetLastPlayBookmark
DVDSetLastPlayBookmark
DVDClearLastPlayBookmark
These functions are used to access region codes on a DVD-Video disc or a DVD drive.
DVDRegisterEventCallBack
DVDUnregisterEventCallBack
DVDIsRegisteredEventCallBack
DVDSetTimeEventRate
DVDGetTimeEventRate
DVDGetMediaVolumeName
DVDHasNextChapter
DVDHasPreviousChapter
DVDIdle
DVDSetAspectRatio
DVDUpdateVideo
DVDGetVideoKeyColor Deprecated in Mac OS X v10.5
Sets the video playback position to the beginning of the disc.
OSStatus DVDClearLastPlayBookmark ( void );
A result code. See “DVD Playback Result Codes.”
This function sets the video playback position to the beginning of the disc, but does not begin playing the media. Calling this function is equivalent to calling the function DVDStop twice in succession. Before calling this function, media needs to be open.
DVDPlayback.h
Closes a previously opened VIDEO_TS media folder on a mass storage device.
OSStatus DVDCloseMediaFile ( void );
A result code. See “DVD Playback Result Codes.”
This function closes a VIDEO_TS media folder that was previously opened using the function DVDOpenMediaFile. If necessary, this function stops playback before closing the folder. You must call this function before attempting to open another media folder.
DVDPlayback.h
Closes a previously opened VIDEO_TS media folder on a DVD-Video disc.
OSStatus DVDCloseMediaVolume ( void );
A result code. See “DVD Playback Result Codes.”
This function closes a VIDEO_TS media folder that was previously opened using the function DVDOpenMediaVolume. If necessary, this function stops playback before closing the folder. You must call this function before attempting to open another media folder.
DVDPlayback.hTurns the display of subpictures on or off.
OSStatus DVDDisplaySubPicture ( Boolean inDisplay );
A Boolean value that specifies whether to display subpictures in the current title. To display subpictures, specify TRUE. To hide subpictures, specify FALSE.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open and video playback started. You can use this function to display or hide additional bitmap graphic elements such as subtitles.
DVDPlayback.h
Ends the current DVD-Video playback session.
OSStatus DVDDispose ( void );
A result code. See “DVD Playback Result Codes.”
You call this function when you’re finished using DVD Playback, usually when your application quits.
DVDPlayback.h
Selects and activates a menu button by index.
OSStatus DVDDoButtonActivate ( SInt32 inIndex );
The 1-based index of the menu button the user has selected.
A result code. See “DVD Playback Result Codes.”
If the index coincides with an active button, this function executes the action corresponding to the button.
DVDPlayback.h
Allows the user to navigate between menu buttons.
OSStatus DVDDoUserNavigation ( DVDUserNavigation inNavigation );
A user-navigation constant that specifies the direction the user is navigating in the menu. For a list of possible values, see “User Navigation Directions.”
A result code. See “DVD Playback Result Codes.”
You should call this function whenever the user navigates between buttons in the menu using the keyboard. This function moves the focus to the button. If you pass in kDVDUserNavigationEnter, the button action is executed.
DVDPlayback.hTurns DVD@ccess support on or off.
OSStatus DVDEnableWebAccess ( Boolean inEnable );
To turn on support for DVD@ccess, specify TRUE. To turn off DVD@ccess support, specify FALSE.
A result code. See “DVD Playback Result Codes.”
DVD@ccess is a feature in Apple’s DVD Studio Pro that allows the DVD-Video author to embed external links to web-based resources and activate these links during video playback. Some users may find this feature to be intrusive, so DVD@ccess support is turned off by default.
DVDPlayback.hGets the camera angle displayed.
OSStatus DVDGetAngle ( UInt16 *outAngleNum );
A pointer to an integer. On return, the integer contains the 1-based index of the current camera angle.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open and video playback started.
DVDPlayback.h
Gets the aspect ratio of the current title or menu.
OSStatus DVDGetAspectRatio ( DVDAspectRatio *outRatio );
A pointer to a DVDAspectRatio variable. On return, the variable specifies the aspect ratio of the current title. For a list of possible aspect ratios, see “Aspect Ratios.”
A result code. See “DVD Playback Result Codes.”
The aspect ratio of the video can change whenever a different title or menu is displayed. You can use this function together with DVDGetNativeVideoSize to calculate the bounds of the video area in a window.
DVDPlayback.h
Gets the current audio language code and extension.
OSStatus DVDGetAudioLanguageCode ( DVDLanguageCode *outCode, DVDAudioExtensionCode *outExtension );
A pointer to a language code variable. On return, the variable contains the language code for the current audio stream. For a list of possible values, see “Language Codes.”
A pointer to an audio extension code variable. On return, the variable contains the audio extension code for the current audio stream. For a list of possible values, see “Audio Extension Codes.”
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the audio language code and extension for a specified stream.
OSStatus DVDGetAudioLanguageCodeByStream ( UInt16 inStreamNum, DVDLanguageCode *outCode, DVDAudioExtensionCode *outExtension );
An integer in the range 1 to 8 that specifies an audio stream in the current title.
A pointer to a language code variable. On return, the variable contains the language code for the specified audio stream. For a list of possible values, see “Language Codes.”
A pointer to an audio extension code variable. On return, the variable contains the audio extension code for the specified audio stream. For a list of possible values, see “Audio Extension Codes.”
A result code. See “DVD Playback Result Codes.”
DVDPlayback.hGets the audio stream currently being used.
OSStatus DVDGetAudioStream ( UInt16 *outStreamNum );
A pointer to an integer. On return, the integer contains the number of the current audio stream, or 0 if the current title has no audio streams.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open and video playback started.
DVDPlayback.h
Gets the current audio stream format.
OSStatus DVDGetAudioStreamFormat ( DVDAudioFormat *outFormat, UInt32 *outBitsPerSample, UInt32 *outSamplesPerSecond, UInt32 *outChannels );
A pointer to an audio format variable. On return, the variable contains the audio format of the audio stream for the current title. For a list of possible formats, see “Audio Stream Formats.”
A pointer to an integer. On return, the integer contains the number of bits per sample in the current audio stream.
A pointer to an integer. On return, the integer contains the number of samples per second in the current audio stream.
A pointer to an integer. On return, the integer contains the number of audio channels in the current audio stream.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open and video playback started.
DVDPlayback.h
Gets the audio format for a specified stream.
OSStatus DVDGetAudioStreamFormatByStream ( UInt32 inStreamNum, DVDAudioFormat *outFormat, UInt32 *outBitsPerSample, UInt32 *outSamplesPerSecond, UInt32 *outChannels );
An integer that specifies an audio stream in the current title.
A pointer to an audio format variable. On return, the variable contains the audio format of the audio stream for the current title. For a list of possible formats, see “Audio Stream Formats.”
A pointer to an integer. On return, the integer contains the number of bits per sample in the current audio stream.
A pointer to an integer. On return, the integer contains the number of samples per second in the current audio stream.
A pointer to an integer. On return, the integer contains the number of audio channels in the current audio stream.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open.
DVDPlayback.hGets the current playback audio volume setting (0 - 255) .
OSStatus DVDGetAudioVolume ( UInt16 *outVolume );
A pointer to an integer. On return, the integer contains the current playback volume in the range 0 to 255.
A result code. See “DVD Playback Result Codes.”
This function passes back the current playback audio volume setting. For more information, see DVDSetAudioVolume.
DVDPlayback.hGets video playback volume information (minimum, maximum, and current volume).
OSStatus DVDGetAudioVolumeInfo ( UInt16 *outMinVolume, UInt16 *outCurVolume, UInt16 *outMaxVolume );
A pointer to an integer. On return, the integer contains the minimum video playback volume. This parameter is optional; you may specify NULL.
A pointer to an integer. On return, the integer contains the current video playback volume. This parameter is optional; you may specify NULL.
A pointer to an integer. On return, the integer contains the maximum video playback volume. This parameter is optional; you may specify NULL.
A result code. See “DVD Playback Result Codes.”
Currently the minimum and maximum volumes are always 0 and 255.
DVDPlayback.h
Requests a bookmark to the current play position.
OSStatus DVDGetBookmark ( void *outBookMarkData, UInt32 *ioBookMarkDataSize );
A generic pointer to memory for a bookmark in your calling program, or NULL. On return, this memory contains the new bookmark.
The size of this memory should be equal to or greater than the actual size of a bookmark in bytes. To determine the actual size of a bookmark, see the Discussion below.
On entry, a pointer to an integer that contains the size of your bookmark memory. If you haven’t allocated memory for a bookmark, set this size to zero. On return, the integer’s value is the actual size of a new bookmark. See the Discussion below.
A result code. See “DVD Playback Result Codes.”
This function is used when playing media on a DVD-Video disc. Before calling this function, the media needs to be open and playing. This function passes back a bookmark to the current play position in the current DVD-Video playback session.
To request a play bookmark, you need to call this function twice. The first call determines the minimum required size for the bookmark:
UInt32 size = 0; |
DVDGetBookmark (NULL, &size); |
After you allocate sufficient memory for the bookmark, call this function again to create the bookmark, passing it the location and size of your bookmark memory:
void *bookmark = malloc (size); |
OSStatus err = DVDGetBookmark (bookmark, &size); |
For information about requesting a bookmark when the media is not playing, see DVDGetLastPlayBookmark.
DVDPlayback.hGets information about all available menu buttons in the current title, domain, or content.
OSStatus DVDGetButtoninfo ( UInt32 *numberOfButtons, UInt32 *selectedButton, UInt32 *forcedActivateButton, UInt32 *userButtonOffset, UInt32 *numberOfUserButtons );
A pointer to an integer. On return, the integer contains the number of buttons in the current menu.
A pointer to an integer. On return, the integer contains the 1-based index of the selected button.
A pointer to an integer. On return, the integer contains the index of the button whose action is performed when a specified period of time elapses after the menu is first displayed.
A pointer to an integer. On return, the integer contains the index of the first user-selectable button. If the number of user-selectable buttons in a menu is smaller than the total number of buttons, this index may be greater than zero.
A pointer to an integer. On return, the integer contains the number of user-selectable buttons in the current menu.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.hGets the position and default action of a menu button.
OSStatus DVDGetButtonPosition ( UInt32 index, CGRect *outRect, UInt32 *autoAction );
The zero-based index of a menu button. If your button index is 1-based, you should decrement the index before you pass it to this function.
A pointer to a Quartz rectangle. On return, the rectangle contains the position and dimensions of the specified button in window local coordinates.
A pointer to an integer flag. On return, a value of 1 indicates the button is a forced activate button—that is, the button’s action is executed immediately when the button is selected. A value of 0 indicates the button is not a forced activate button.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.hGets the current chapter.
OSStatus DVDGetChapter ( UInt16 *outChapterNum );
A pointer to an integer. On return, the integer contains the current chapter number.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the region codes available on a DVD-Video disc.
OSStatus DVDGetDiscRegionCode ( DVDRegionCode *outCode );
A pointer to a DVDRegionCode variable. On return, the variable contains a bitfield that specifies one or more region codes. For more information about region codes, see “Region Codes.”
A result code. See “DVD Playback Result Codes.”
This function passes back the region codes assigned to the DVD-Video disc that’s currently in use. Before calling this function, you need to call the function DVDOpenMediaVolume to open the media folder on the disc.
To test whether a disc is authorized for playback in region n, you need to compute the bitwise AND of outCode with region code n. If the result is equal to region code n, the disc is authorized for playback in region n. For example, this source code shows how to test whether a disc is authorized for playback in region 1:
const DVDRegionCode myRegionCode1 = kDVDRegionCode1; |
DVDRegionCode outCode; |
DVDGetDiscRegionCode (&outCode); |
if ((~outCode & ~myRegionCode1) == ~myRegionCode1) { |
// media supports region 1 |
} |
DVDPlayback.h
Gets the region code assigned to a DVD drive, and finds how many additional region code changes are permitted.
OSStatus DVDGetDriveRegionCode ( DVDRegionCode *outCode, SInt16 *outNumberChangesLeft );
A pointer to a DVDRegionCode variable. On return, the variable specifies the region code that’s assigned to the DVD drive currently in use. If the drive was never initialized, the region code is kDVDRegionCodeUninitialized. For more information about region codes, see “Region Codes.”
A pointer to an integer. On return, the integer contains the number of region code changes remaining for this drive.
A result code. See “DVD Playback Result Codes.”
This function passes back the region code assigned to the DVD drive that’s currently in use. Before calling this function, you need to call the function DVDOpenMediaVolume to open the media folder on a disc that’s mounted in the drive.
To test whether region n is assigned to a drive, you need to compute the bitwise AND of outCode with region code n. If the result is equal to region code n, the drive can play discs that are authorized for playback in region n. For example, this source code shows how to test whether region 1 is assigned to a drive:
const DVDRegionCode myRegionCode1 = kDVDRegionCode1; |
DVDRegionCode outCode; |
SInt16 outNumberChangesLeft; |
DVDGetDriveRegionCode (&outCode, &outNumberChangesLeft); |
if ((~outCode & ~myRegionCode1) == ~myRegionCode1) { |
// media supports region 1 |
} |
DVDPlayback.h
Gets the video broadcast format of current DVD-Video media.
OSStatus DVDGetFormatStandard ( DVDFormat *outFormat );
A pointer to a DVDFormat variable. On return, the variable contains the video broadcast format of the current media. For a list of possible values, see “ Video Broadcast Formats.”
A result code. See “DVD Playback Result Codes.”
This function determines which video broadcast format (NTSC or PAL) is used in the current media. Before calling this function, DVD-Video media needs to be open.
DVDPlayback.hReturns the current value of a general parameter (GPRM) register.
OSStatus DVDGetGPRMValue ( UInt32 index, UInt32 *value );
An integer index that specifies the desired GPRM register. The valid range is 1 to 16.
A pointer to an integer. On return, the integer contains the current value of the specified GPRM register.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Requests a bookmark to the last play position.
OSStatus DVDGetLastPlayBookmark ( void *outBookMarkData, UInt32 *ioBookMarkDataSize );
A generic pointer to memory for a bookmark in your calling program, or NULL. On return, this memory contains the last bookmark after the first Stop command.
The size of this memory should be equal to or greater than the actual size of a bookmark in bytes. To determine the actual size of a bookmark, see the discussion below.
On entry, a pointer to an integer that contains the size of your bookmark memory. If you haven’t allocated memory for a bookmark, set this size to zero. On return, the integer’s value is the actual size of a new bookmark. See the Discussion below.
A result code. See “DVD Playback Result Codes.”
This function is used when playing media on a DVD-Video disc. Before calling this function, the media needs to be open.
This function passes back a bookmark to the last play position in the current DVD-Video playback session. A last play bookmark represents the exact stop position after calling the function DVDStop.
To request the last play bookmark, you need to call this function twice. The first call determines the minimum required size for the bookmark:
UInt32 size = 0; |
DVDGetBookmark (NULL, &size); |
After you allocate sufficient memory for the bookmark, call this function again to create the bookmark, passing it the location and size of your bookmark memory:
void *bookmark = malloc (size); |
OSStatus err = DVDGetBookmark (bookmark, &size); |
For information about requesting a bookmark when the media is playing, see DVDGetBookmark.
DVDPlayback.h
Gets a unique identifier for a media folder.
OSStatus DVDGetMediaUniqueID ( DVDDiscID outDiscID );
An 8-byte array of type DVDDiscID. On return, this array contains the unique identifier of the current media.
A result code. See “DVD Playback Result Codes.”
This function passes back a 64-bit identifier that can help you distinguish between different media folders. While the identifiers generated by this function are not guaranteed to be unique (see below), duplicate identifiers are extremely rare.
There are two known limitations of this function:
Two copies of the same DVD that are produced at different times do not necessarily have the same identifier. This can happen when the two media folders have minor differences.
Two different DVDs with similar content—collections of episodes from a television series, for example—do not always have different identifiers. This can happen when the two media folders are identical.
DVDPlayback.h
Gets the volume name of the current media as a Core Foundation string.
OSStatus DVDGetMediaVolumeCFName ( CFStringRef *outDiscVolumeCFName );
On return, a pointer to the volume name of the current media. If you need to save this Core Foundation string for later use, you should retain it.
A result code. See “DVD Playback Result Codes.”
This function passes back the media volume name as a Core Foundation string. This is the name seen on the desktop when Mac OS X mounts a DVD-Video disc. For information about using Core Foundation strings, see CFString Reference.
DVDPlayback.hGets the volume name of the current media as a C string.
OSStatus DVDGetMediaVolumeName ( char **outDiscVolumeName );
A pointer to a C string. On return, the C string is the volume name of the current media. You are not responsible for allocating a buffer for the string.
A result code. See “DVD Playback Result Codes.”
This function passes back the volume name of the current media as a C string. This is the name seen on the desktop when Mac OS X mounts a DVD-Video disc.
This function has a serious limitation: it does not support volume names with multiple byte characters. For this reason, applications running in Mac OS X version 10.4 or later should use the replacement function DVDGetMediaVolumeCFName instead.
DVDPlayback.hGets the menu language code for the current title.
OSStatus DVDGetMenuLanguageCode ( DVDLanguageCode *outCode );
A pointer to a language code variable. On return, the variable contains the menu language code for the current title. For a list of possible values, see “Language Codes.”
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the native width and height in pixels of the current title.
OSStatus DVDGetNativeVideoSize ( UInt16 *outWidth, UInt16 *outHeight );
A pointer to an integer. On return, the integer contains the native width of the current title.
A pointer to an integer. On return, the integer contains the native height of the current title.
A result code. See “DVD Playback Result Codes.”
The native dimensions of a title are specified by the author of the DVD-Video media. The width and height are typically 720 x 480 pixels for the NTSC video format and 720 x 576 pixels for the PAL video format.
DVDPlayback.hGets the number of camera angles currently available.
OSStatus DVDGetNumAngles ( UInt16 *outNumAngles );
On return, a pointer to the number of different camera angles in the current title. DVD-Video media supports up to 9 camera angles.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.hGets the number of audio streams currently available.
OSStatus DVDGetNumAudioStreams ( UInt16 *outNumStreams );
A pointer to an integer. On return, the integer contains the number of audio streams available in the current title.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open.
DVDPlayback.hGets the number of chapters in the specified title.
OSStatus DVDGetNumChapters ( UInt16 inTitleNum, UInt16 *outNumChapters );
An integer in the range 1 to 99 that specifies a title on the current media.
A pointer to an integer. On return, the integer contains the number of chapters in the specified title.
A result code. See “DVD Playback Result Codes.”
If the specified chapter does not exist, this function does nothing and returns an error.
DVDPlayback.hGets the number of subpicture streams currently available.
OSStatus DVDGetNumSubPictureStreams ( UInt16 *outNumStreams );
On return, a pointer to the number of subpicture streams available in the current title. DVD-Video media supports up to 32 subpicture streams per title.
A result code. See “DVD Playback Result Codes.”
Before calling this function, DVD-Video media needs to be open and video playback started.
DVDPlayback.hGets the number of titles available on the media.
OSStatus DVDGetNumTitles ( UInt16 *outNumTitles );
A pointer to an integer. On return, the integer contains the number of titles on the current media in the range 0 to 99.
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the current scan direction and scan rate.
OSStatus DVDGetScanRate ( DVDScanRate *outRate, DVDScanDirection *outDirection );
A pointer to a DVDScanRate variable. On return, the variable contains the current scan rate. For a list of possible values, see “Scan Rates.”
A pointer to a DVDScanDirection variable. On return, the variable contains the current scan direction. For a list of possible values, see “Scan Directions.”
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the state of the current DVD-Video playback session.
OSStatus DVDGetState ( DVDState *outState );
A pointer to a DVDState variable. On return, the variable contains the state of the current playback session. For a list of possible values, see “Playback States.”
A result code. See “DVD Playback Result Codes.”
DVDPlayback.h
Gets the subpicture language code and extension for the current subpicture stream.
OSStatus DVDGetSubPictureLanguageCode ( DVDLanguageCode *outCode, DVDSubpictureExtensionCode *outExtension );
A pointer to a language code variable. On return, the variable contains the language code for the current subpicture. For a list of possible values, see “Language Codes.”
A pointer to a subpicture extension va