next up previous contents index
Next: DVD settings Up: CDDA settings Previous: CDDA settings   Contents   Index

CDDAI_TOC

Query the table of content of the CD-Audio

DWORD DVDQueryAttribute (CDDAI_TOC, dwArg);

Arguments
dwArg DWORD dwArg:

Return value
Zero if successful.

Remarks
If a track does not exist, its length will be 0xFFFFFFFF.

Here is a small code :


#define LBA_TO_MSF(LBN) ((0x00FF0000 & (((LBN)/(60*75))  $<<$ 16)) \(\vert \)  $\backslash$ 

(0x0000FF00 & (((LBN)%(60*75))/75 $<<$ 8)) \(\vert \) $\backslash$
(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 $[101]$;
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 $[0]$ = FMPOpenDiscPlayback (&FMPOpenStruct);

if (tmp $[0]$ != 0) {
printf("Failed to open the playback$\backslash$n");
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; i $<=$ 10; i$++$ ) {
if ( tmp $[i]$ == 0xffffffff ) {
printf("Cannot get duration of the track %d$\backslash$n", i);
}
else {
MSF = LBA_TO_MSF( tmp $[i]$);
bMin = (BYTE)MSF_M(MSF);
bSec = (BYTE)MSF_S(MSF);
bFrame = (BYTE)MSF_F(MSF);
printf ("TRACK %d: %d: %d: %d $\backslash$n", i, bMin, bSec, bFrame);
}
}
FMPClose();
MPEGDriverUnload();
}

Figure 7.2: CDDAI_TOC Operating Systems and Streaming Models
\begin{figure}\centering\begin{tabular}{\vert l\vert c\vert c\vert c\vert c\vert...
...s CE & & & & & \\
Linux & & & & & $\bullet$\\
\hline
\end{tabular}\end{figure}


next up previous contents index
Next: DVD settings Up: CDDA settings Previous: CDDA settings   Contents   Index
mabelsha 2002-03-26