2002-03-10 00:29:33 +01:00
|
|
|
/*
|
|
|
|
* Copyright 1999 Marcus Meissner
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
1999-02-05 10:41:55 +01:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <assert.h>
|
1999-03-25 16:52:09 +01:00
|
|
|
#include <string.h>
|
1999-03-14 17:35:05 +01:00
|
|
|
#include "windef.h"
|
1999-02-05 10:41:55 +01:00
|
|
|
#include "windows.h"
|
|
|
|
#include "mmsystem.h"
|
|
|
|
#include "vfw.h"
|
|
|
|
|
|
|
|
|
2001-01-05 04:42:54 +01:00
|
|
|
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE prev, LPSTR cmdline, int show)
|
1999-02-05 10:41:55 +01:00
|
|
|
{
|
2004-09-22 04:46:38 +02:00
|
|
|
unsigned int n;
|
1999-02-05 10:41:55 +01:00
|
|
|
HRESULT hres;
|
|
|
|
PAVIFILE avif;
|
|
|
|
PAVISTREAM vids,auds;
|
|
|
|
AVIFILEINFO afi;
|
|
|
|
AVISTREAMINFO asi;
|
|
|
|
|
2003-12-02 06:33:26 +01:00
|
|
|
AVIFileInit();
|
2003-10-16 21:12:49 +02:00
|
|
|
if (GetFileAttributes(cmdline) == INVALID_FILE_ATTRIBUTES) {
|
1999-02-05 10:41:55 +01:00
|
|
|
fprintf(stderr,"Usage: aviinfo <avifilename>\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-12-02 06:33:26 +01:00
|
|
|
hres = AVIFileOpen(&avif,cmdline,OF_READ,NULL);
|
1999-02-05 10:41:55 +01:00
|
|
|
if (hres) {
|
|
|
|
fprintf(stderr,"AVIFileOpen: 0x%08lx\n",hres);
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-12-02 06:33:26 +01:00
|
|
|
hres = AVIFileInfo(avif,&afi,sizeof(afi));
|
1999-02-05 10:41:55 +01:00
|
|
|
if (hres) {
|
|
|
|
fprintf(stderr,"AVIFileInfo: 0x%08lx\n",hres);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
fprintf(stderr,"AVI File Info:\n");
|
|
|
|
fprintf(stderr,"\tdwMaxBytesPerSec: %ld\n",afi.dwMaxBytesPerSec);
|
2002-05-29 00:42:11 +02:00
|
|
|
#define FF(x) if (afi.dwFlags & AVIFILEINFO_##x) fprintf(stderr,#x",");
|
1999-02-05 10:41:55 +01:00
|
|
|
fprintf(stderr,"\tdwFlags: 0x%lx (",afi.dwFlags);
|
|
|
|
FF(HASINDEX);FF(MUSTUSEINDEX);FF(ISINTERLEAVED);FF(WASCAPTUREFILE);
|
|
|
|
FF(COPYRIGHTED);
|
|
|
|
fprintf(stderr,")\n");
|
|
|
|
#undef FF
|
2002-05-29 00:42:11 +02:00
|
|
|
#define FF(x) if (afi.dwCaps & AVIFILECAPS_##x) fprintf(stderr,#x",");
|
1999-02-05 10:41:55 +01:00
|
|
|
fprintf(stderr,"\tdwCaps: 0x%lx (",afi.dwCaps);
|
|
|
|
FF(CANREAD);FF(CANWRITE);FF(ALLKEYFRAMES);FF(NOCOMPRESSION);
|
|
|
|
fprintf(stderr,")\n");
|
|
|
|
#undef FF
|
|
|
|
fprintf(stderr,"\tdwStreams: %ld\n",afi.dwStreams);
|
|
|
|
fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",afi.dwSuggestedBufferSize);
|
|
|
|
fprintf(stderr,"\tdwWidth: %ld\n",afi.dwWidth);
|
|
|
|
fprintf(stderr,"\tdwHeight: %ld\n",afi.dwHeight);
|
|
|
|
fprintf(stderr,"\tdwScale: %ld\n",afi.dwScale);
|
|
|
|
fprintf(stderr,"\tdwRate: %ld\n",afi.dwRate);
|
|
|
|
fprintf(stderr,"\tdwLength: %ld\n",afi.dwLength);
|
|
|
|
fprintf(stderr,"\tdwEditCount: %ld\n",afi.dwEditCount);
|
|
|
|
fprintf(stderr,"\tszFileType: %s\n",afi.szFileType);
|
|
|
|
|
|
|
|
for (n = 0;n<afi.dwStreams;n++) {
|
|
|
|
char buf[5];
|
|
|
|
PAVISTREAM ast;
|
|
|
|
|
2003-12-02 06:33:26 +01:00
|
|
|
hres = AVIFileGetStream(avif,&ast,0,n);
|
1999-02-05 10:41:55 +01:00
|
|
|
if (hres) {
|
|
|
|
fprintf(stderr,"AVIFileGetStream %d: 0x%08lx\n",n,hres);
|
|
|
|
exit(1);
|
|
|
|
}
|
2003-12-02 06:33:26 +01:00
|
|
|
hres = AVIStreamInfo(ast,&asi,sizeof(asi));
|
1999-02-05 10:41:55 +01:00
|
|
|
if (hres) {
|
|
|
|
fprintf(stderr,"AVIStreamInfo %d: 0x%08lx\n",n,hres);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
fprintf(stderr,"Stream %d:\n",n);
|
|
|
|
buf[4]='\0';memcpy(buf,&(asi.fccType),4);
|
|
|
|
fprintf(stderr,"\tfccType: %s\n",buf);
|
|
|
|
memcpy(buf,&(asi.fccHandler),4);
|
|
|
|
fprintf(stderr,"\tfccHandler: %s\n",buf);
|
|
|
|
fprintf(stderr,"\tdwFlags: 0x%08lx\n",asi.dwFlags);
|
|
|
|
fprintf(stderr,"\tdwCaps: 0x%08lx\n",asi.dwCaps);
|
|
|
|
fprintf(stderr,"\twPriority: %d\n",asi.wPriority);
|
|
|
|
fprintf(stderr,"\twLanguage: %d\n",asi.wLanguage);
|
|
|
|
fprintf(stderr,"\tdwScale: %ld\n",asi.dwScale);
|
|
|
|
fprintf(stderr,"\tdwRate: %ld\n",asi.dwRate);
|
|
|
|
fprintf(stderr,"\tdwStart: %ld\n",asi.dwStart);
|
|
|
|
fprintf(stderr,"\tdwLength: %ld\n",asi.dwLength);
|
|
|
|
fprintf(stderr,"\tdwInitialFrames: %ld\n",asi.dwInitialFrames);
|
|
|
|
fprintf(stderr,"\tdwSuggestedBufferSize: %ld\n",asi.dwSuggestedBufferSize);
|
|
|
|
fprintf(stderr,"\tdwQuality: %ld\n",asi.dwQuality);
|
|
|
|
fprintf(stderr,"\tdwSampleSize: %ld\n",asi.dwSampleSize);
|
|
|
|
fprintf(stderr,"\tdwEditCount: %ld\n",asi.dwEditCount);
|
|
|
|
fprintf(stderr,"\tdwFormatChangeCount: %ld\n",asi.dwFormatChangeCount);
|
|
|
|
fprintf(stderr,"\tszName: %s\n",asi.szName);
|
|
|
|
switch (asi.fccType) {
|
|
|
|
case streamtypeVIDEO:
|
|
|
|
vids = ast;
|
|
|
|
break;
|
2002-06-01 01:06:46 +02:00
|
|
|
case streamtypeAUDIO:
|
1999-02-05 10:41:55 +01:00
|
|
|
auds = ast;
|
|
|
|
break;
|
|
|
|
default: {
|
|
|
|
char type[5];
|
|
|
|
type[4]='\0';memcpy(type,&(asi.fccType),4);
|
|
|
|
|
|
|
|
fprintf(stderr,"Unhandled streamtype %s\n",type);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2003-12-02 06:33:26 +01:00
|
|
|
AVIStreamRelease(ast);
|
1999-02-05 10:41:55 +01:00
|
|
|
}
|
2003-12-02 06:33:26 +01:00
|
|
|
AVIFileRelease(avif);
|
|
|
|
AVIFileExit();
|
2002-06-01 01:06:46 +02:00
|
|
|
return 0;
|
1999-02-05 10:41:55 +01:00
|
|
|
}
|