|
Opening Streams in an AVI File and Closing the File
The following example opens all the streams in an AVI file using the AVIFileGetStream function. If an error is encountered, the file is closed.
// InsertAVIFile - opens the streams in an AVI file.
//
// pfile - file-interface pointer from AVIFileOpen
//
// Global variables
// gcpavi - count of the number of streams in an AVI file
// gapavi[] = array of stream-interface pointers
- oid InsertAVIFile(PAVIFILE pfile, HWND hwnd, LPSTR lpszFile)
{
int i;
gcpavi = 0;
// Open the streams until a stream is not available.
for (i = gcpavi; i < MAXNUMSTREAMS; i++) {
gapavi[i] = NULL;
if (AVIFileGetStream(pfile, &gapavi[i], 0L, i - gcpavi)
!= AVIERR_OK)
break;
if (gapavi[i] == NULL)
break;
}
// Display error message-stream not found.
if (gcpavi == i)
{
ErrMsg("Unable to open %s", lpszFile);
if (pfile) // If file is open, close it
AVIFileRelease(pfile);
return;
}
else {
gcpavi = i - 1;
}
// .
// . Place functions to process data here.
// .
}
Related Links
Software for Delphi and C++ Builder developers
Software for Visual Studio .NET developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET
More Online Helps
Win32 Programmer's Reference (win32.hlp)
OLE Programmer's Reference (ole.hlp)
Microsoft Windows Pen API Programmer's Reference (penapi.hlp)
Microsoft Windows Sockets 2 Reference (sock2.hlp)
Microsoft Windows Telephony API (TAPI) Programmer's Reference (tapi.hlp)
Unix Manual Pages
|