Getting DVD Volume information
This page shows you how to get the number of titles included in the DVD. Please note that error handling codes are omitted to keep the sample code simple.
Sample code
The following sample code shows how to get the number of titles included in the DVD. This sample code plays DVD in the DVD drive. If the DVD drive is empty, this sample will not work.
#include <stdio.h>
#include <dshow.h>
int
main()
{
IDvdGraphBuilder *pDvdGraphBuilder;
IDvdInfo2 *pDvdInfo2;
CoInitialize(NULL);
CoCreateInstance(CLSID_DvdGraphBuilder,
NULL,
CLSCTX_INPROC_SERVER,
IID_IDvdGraphBuilder,
(LPVOID *)&pDvdGraphBuilder);
AM_DVD_RENDERSTATUS stat;
pDvdGraphBuilder->RenderDvdVideoVolume(NULL,
AM_DVD_HWDEC_PREFER, &stat);
pDvdGraphBuilder->GetDvdInterface(IID_IDvdInfo2,
(LPVOID *)&pDvdInfo2);
ULONG numVolumes;
ULONG curVolume;
DVD_DISC_SIDE discSide;
ULONG numTitles;
pDvdInfo2->GetDVDVolumeInfo(&numVolumes,
&curVolume, &discSide, &numTitles);
printf("number of volumes : %u\n", numVolumes);
printf("current volume : %u\n", curVolume);
switch (discSide) {
case DVD_SIDE_A:
printf("DVD side A\n");
break;
case DVD_SIDE_B:
printf("DVD side B\n");
break;
}
printf("number of titles : %u\n", numTitles);
pDvdInfo2->Release();
pDvdGraphBuilder->Release();
CoUninitialize();
return 0;
}
The first argument of GetDVDVolumeInfo returns the number of volumes included in the DVD.
The second argument returns the current volume number.
The third argument returns side A or side B.
The forth argument returns total number of titles included in the DVD disk.