Here is a small code :
#define LBA_TO_MSF(LBN) ((0x00FF0000 & (((LBN)/(60*75))16))
![]()
![]()
(0x0000FF00 & (((LBN)%(60*75))/758))
![]()
![]()
(0x000000FF & (((LBN)%(60*75))%75) ))#define MSF_M(MSF) ((MSF)
16) & (0x000000FF))
#define MSF_S(MSF) ((MSF)8) & (0x000000FF))
#define MSF_F(MSF) ((MSF) & 0x000000FF))
void getTracksDuration()
{
FMP_OPENSTRUCT FMPOpenStruct;
DWORD tmp;
DWORD MSF, i;
BYTE bSec, bMin, bFrame;MPEGDriverEntry(DRIVE_NUMBER);
FMPOpenStruct.dwStructSize = sizeof (FMP_OPENSTRUCT);
FMPOpenStruct.bDriverNumber = DRIVE_NUMBER;
FMPOpenStruct.dwSize = 32 * 1024;
FMPOpenStruct.dwCount = 10;
FMPOpenStruct.pCallback = NULL;
FMPOpenStruct.dwContext = 0;
FMPOpenStruct.sFileName = NULL;
FMPOpenStruct.dwFlags = FMPF_DVD;
FMPOpenStruct.bDiscContent = FMPC_UNKNOWN;
FMPOpenStruct.bFileSystem = 0x00;
tmp= FMPOpenDiscPlayback (&FMPOpenStruct);
if (tmp!= 0) {
printf("Failed to open the playbackn");
return;
}
memset ( tmp, 0, 101 * sizeof(DWORD));
DVDQueryAttribute ( CDDAI_TOC, (DWORD)tmp );
TOC starts from the element 1 of the 'tmp'
print first ten elements of the TOC
for ( i = 1; i10; i
) {
if ( tmp== 0xffffffff ) {
printf("Cannot get duration of the track %dn", i);
}
else {
MSF = LBA_TO_MSF( tmp);
bMin = (BYTE)MSF_M(MSF);
bSec = (BYTE)MSF_S(MSF);
bFrame = (BYTE)MSF_F(MSF);
printf ("TRACK %d: %d: %d: %dn", i, bMin, bSec, bFrame);
}
}
FMPClose();
MPEGDriverUnload();
}