Freigeben über


Fundamental DVD-Video API Interfaces (Windows CE 5.0)

Send Feedback

A DVD-Video API application needs to establish a connection to the DVD-Video data through COM interfaces that connect to the data source, provide an interface to the data, and provide an interface for navigation.

Connecting to the Data Source

Before the application can read any data, it must first establish a connection to the DVD-Video data source through a DVDData object. The IDVDROM interface represents the DVD-Video data source to the player application.

The technical details concerning how the Windows CE device hosting the player application interacts with the physical medium are encapsulated within the IDVDROM interface, shielding the player application from this complexity.

IDVDROM *  pDisk;

HRESULT hres = CoCreateInstance(
    CLSID_DVDData,         //Class identifier (CLSID) of the object
    NULL,                  //Object is or is not part of an aggregate 
    CLSCTX_INPROC_SERVER,  //Context for running executable code
    IID_IDVDROM,           //Interface identifier
    (LPVOID *)&pDisk
);

The IDVDROM interface represents the source of the DVD-Video data. It does not represent the data itself. An application that has obtained a pointer to an IDVDROM interface has the ability to connect to a DVD-Video data source. It has not actually made the connection yet. The IDVDROM::Bind method ties the DVDData object to a specific media source.

The following code example shows the IDVDROM interface being bound to command line parameters contained in lpCmdLine or a default CD-ROM drive.

if (lpCmdLine && (lpCmdLine[0] != L'\0'))
{
    hres = pDisk->Bind(lpCmdLine);
}
else
{
    hres = pDisk->Bind(TEXT("\\cd-rom"));
}

After the media source is bound, subsequent DVD-Video API calls are applied to that media source until the IDVDROM::Unbind method is called.

Obtaining an Interface to the Data

An application must obtain an IDVDVideoVolume interface in order to work with the data stored in a DVD-Video source. This interface provides access to the data tables defined by the DVD-Video standard.

hres = pDisk->QueryInterface(IID_IDVDVideoVolume, (LPVOID *) &pVolume);

As with the IDVDROM interface, IDVDVideoVolume does not contain any default data upon creation. An IDVDVideoVolume interface must be initialized with data from the source bound to the DVDData object. This is done through an IDVDROM interface as shown in the following code example.

hres = pVolume->InitData(pDisk);

Obtaining a Navigation Interfaces

An IDVDVideoVolume interface provides your application with the program data contained within a DVD-Video recording. It does not provide a way for your application to navigate through that data. A DVDNavigationManager object manages the interactions between the user's input and the DVD-Video volume and directs the appropriate output to the DVD-Video renderer.

The IDVDNavigationManager interface to a DVDNavigationManager object allows you to set and read the global playback context, such as system parameters (SPRMs) and renderer capabilities, for your application.

The following code example shows how you can instantiate a DVDNavigationManager object and obtain an IDVDNavigationManager interface to it.

IDVDNavigationManager *pNavMan;

hres = CoCreateInstance(
    CLSID_DVDNavigationManager,  //Class identifier (CLSID) of the object
    NULL,                        //Object is or is not part of an aggregate 
    CLSCTX_INPROC_SERVER,        //Context for running executable code
    IID_IDVDNavigationManager,   //Interface identifier
    (LPVOID *)&pNavMan
);

The IDVDUserOperation interface allows your application to actually navigate the DVD-Video data through methods that represent the operational functionality recommended in Annex J functionality of DVD Forum Specification.

The following code example shows how to obtain a pointer to an IDVDUserOperation interface and associate the navigation manager with a DVD-Video volume.

IDVDUserOperation *pAnnexJ;
hres = pNavMan->QueryInterface(IID_IDVDUserOperation,
                               (LPVOID *) &pAnnexJ);
hres = pNavMan->SetVolume(pVolume);

if (SUCCEEDED(hres))
{
  hres = pNavMan->SetVolume(pVolume);
  // ...
}

See Also

Creating a Simple DVD Player | Implementing First Play

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.