Initial
This commit is contained in:
BIN
codec/Debug/FOURCC.obj
Normal file
BIN
codec/Debug/FOURCC.obj
Normal file
Binary file not shown.
BIN
codec/Debug/VIDC.obj
Normal file
BIN
codec/Debug/VIDC.obj
Normal file
Binary file not shown.
BIN
codec/Debug/codec.lib
Normal file
BIN
codec/Debug/codec.lib
Normal file
Binary file not shown.
BIN
codec/Debug/vc60.idb
Normal file
BIN
codec/Debug/vc60.idb
Normal file
Binary file not shown.
BIN
codec/Debug/vc60.pdb
Normal file
BIN
codec/Debug/vc60.pdb
Normal file
Binary file not shown.
24
codec/FOURCC.CPP
Normal file
24
codec/FOURCC.CPP
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <codec/fourcc.hpp>
|
||||
|
||||
DWORD FOURCC::makeFOURCC(String driverName)const
|
||||
{
|
||||
char *lpDriverName=(char*)driverName;
|
||||
if(4!=driverName.length())return FALSE;
|
||||
return MKFOURCC(lpDriverName[0],lpDriverName[1],lpDriverName[2],lpDriverName[3]);
|
||||
}
|
||||
|
||||
String FOURCC::makeFOURCCString(void)const
|
||||
{
|
||||
String fccString;
|
||||
|
||||
fccString.reserve(5);
|
||||
((char*)fccString)[0]=(BYTE)(mFOURCC&0xFF);
|
||||
((char*)fccString)[1]=(BYTE)((mFOURCC>>0x08)&0xFF);
|
||||
((char*)fccString)[2]=(BYTE)((mFOURCC>>0x10)&0xFF);
|
||||
((char*)fccString)[3]=(BYTE)((mFOURCC>>0x18)&0xFF);
|
||||
return fccString;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
92
codec/FOURCC.HPP
Normal file
92
codec/FOURCC.HPP
Normal file
@@ -0,0 +1,92 @@
|
||||
#ifndef _AVIFILE_FOURCC_HPP_
|
||||
#define _AVIFILE_FOURCC_HPP_
|
||||
#ifndef _COMMON_WINDOWS_HPP_
|
||||
#include <common/windows.hpp>
|
||||
#endif
|
||||
#ifndef _COMMON_STRING_HPP_
|
||||
#include <common/string.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_AVIDEFS_HPP_
|
||||
#include <avifile/avidefs.hpp>
|
||||
#endif
|
||||
|
||||
class FOURCC
|
||||
{
|
||||
public:
|
||||
FOURCC(void);
|
||||
FOURCC(String driverName);
|
||||
FOURCC(DWORD fccValue);
|
||||
FOURCC(const FOURCC &someFOURCC);
|
||||
virtual ~FOURCC();
|
||||
FOURCC &operator=(const FOURCC &someFOURCC);
|
||||
WORD operator==(const FOURCC &someFOURCC)const;
|
||||
String toString(void)const;
|
||||
DWORD toDWORD(void)const;
|
||||
operator DWORD(void)const;
|
||||
private:
|
||||
DWORD makeFOURCC(String stringFOURCC)const;
|
||||
String makeFOURCCString(void)const;
|
||||
VFWFOURCC mFOURCC;
|
||||
};
|
||||
|
||||
inline
|
||||
FOURCC::FOURCC(void)
|
||||
: mFOURCC(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC::FOURCC(const FOURCC &someFOURCC)
|
||||
{
|
||||
*this=someFOURCC;
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC::FOURCC(String stringFOURCC)
|
||||
: mFOURCC(makeFOURCC(stringFOURCC))
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC::FOURCC(DWORD fccValue)
|
||||
: mFOURCC(fccValue)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC::~FOURCC()
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
String FOURCC::toString(void)const
|
||||
{
|
||||
return makeFOURCCString();
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC::operator DWORD(void)const
|
||||
{
|
||||
return mFOURCC;
|
||||
}
|
||||
|
||||
inline
|
||||
DWORD FOURCC::toDWORD(void)const
|
||||
{
|
||||
return mFOURCC;
|
||||
}
|
||||
|
||||
inline
|
||||
FOURCC &FOURCC::operator=(const FOURCC &someFOURCC)
|
||||
{
|
||||
mFOURCC=(DWORD)someFOURCC;
|
||||
return *this;
|
||||
}
|
||||
|
||||
inline
|
||||
WORD FOURCC::operator==(const FOURCC &someFOURCC)const
|
||||
{
|
||||
return (DWORD)*this==(DWORD)someFOURCC;
|
||||
}
|
||||
#endif
|
||||
|
||||
291
codec/VIDC.CPP
Normal file
291
codec/VIDC.CPP
Normal file
@@ -0,0 +1,291 @@
|
||||
#include <codec/vidc.hpp>
|
||||
#include <codec/fourcc.hpp>
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::openDriver(const DriverName &driverName)
|
||||
{
|
||||
return openDriver(driverName.driverLoadName());
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::openDriver(DWORD fccHandler)
|
||||
{
|
||||
DriverName driverName;
|
||||
|
||||
if(!locateDriver(fccHandler,driverName))return FailResult;
|
||||
return openDriver(driverName);
|
||||
}
|
||||
|
||||
WORD VideoCodec::enumerateDrivers(Block<DriverName> &driverStrings)
|
||||
{
|
||||
Profile systemProfile("SYSTEM.INI","UNSET");
|
||||
String sectionName("DRIVERS32");
|
||||
String videoCodecID("VIDC");
|
||||
String driverType;
|
||||
String driverName;
|
||||
String driverLoadName;
|
||||
Block<String> driversBlock;
|
||||
|
||||
driverStrings.remove();
|
||||
systemProfile.readProfileBlock(sectionName,driversBlock);
|
||||
if(!driversBlock.size())return FALSE;
|
||||
for(short itemIndex=0;itemIndex<driversBlock.size();itemIndex++)
|
||||
{
|
||||
driverType=driversBlock[itemIndex].betweenString(0,'.');
|
||||
if(driverType.isNull())continue;
|
||||
driverType.upper();
|
||||
if(!(driverType==videoCodecID))continue;
|
||||
driverName=driversBlock[itemIndex].betweenString('.','=');
|
||||
if(driverName.isNull())continue;
|
||||
driverLoadName=driversBlock[itemIndex].betweenString('=',0);
|
||||
if(driverLoadName.isNull())continue;
|
||||
driverStrings.insert(&DriverName(driverName,driverLoadName));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
WORD VideoCodec::locateDriver(DWORD fccType,DriverName &driverName)
|
||||
{
|
||||
Block<DriverName> driverNames;
|
||||
String fccString;
|
||||
WORD driverCount;
|
||||
|
||||
::OutputDebugString(String("\nsearching for a driver to handle type '")+FOURCC(fccType).toString()+String("'\n"));
|
||||
enumerateDrivers(driverNames);
|
||||
if(0==(driverCount=driverNames.size()))return FALSE;
|
||||
for(short itemIndex=0;itemIndex<driverCount;itemIndex++)
|
||||
{
|
||||
fccString=driverNames[itemIndex].driverName();
|
||||
::OutputDebugString(driverNames[itemIndex].driverName()+String(":")+driverNames[itemIndex].driverLoadName()+String("\n"));
|
||||
if(fccType==FOURCC(fccString)){driverName=driverNames[itemIndex];return TRUE;}
|
||||
fccString.lower();
|
||||
if(fccType==FOURCC(fccString)){driverName=driverNames[itemIndex];return TRUE;}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::openDriver(const String &driverLoadName)
|
||||
{
|
||||
closeDriver();
|
||||
if((mhVideoCodec=::LoadLibrary(driverLoadName))<(HINSTANCE)HINSTANCE_ERROR)mhVideoCodec=(HINSTANCE)0;
|
||||
if(!mhVideoCodec)return FailResult;
|
||||
mlpfnDriverProc=(LPFNDRIVERPROC)::GetProcAddress(mhVideoCodec,"DriverProc");
|
||||
if(!mlpfnDriverProc){closeDriver();return FailResult;}
|
||||
return OkResult;
|
||||
}
|
||||
|
||||
void VideoCodec::closeDriver(void)
|
||||
{
|
||||
if(!mhVideoCodec)return;
|
||||
::FreeLibrary(mhVideoCodec);
|
||||
mhVideoCodec=(HINSTANCE)0;
|
||||
mlpfnDriverProc=0;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::driverProc(ICMOpen &someICMOpen)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
mDriverID=(DWORD)((mlpfnDriverProc)(DriverID,(HDRVR)DriverHandle,DRV_OPEN,0L,(LONG)&someICMOpen));
|
||||
return (ReturnCode)mDriverID;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::driverProc(ICMInfo &someICMInfo)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_GETINFO,(LONG)&someICMInfo,(LONG)someICMInfo.size()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::getCompressFormat(BitmapInfo &srcBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_GET_FORMAT,(LONG)&srcBitmapInfo.getBITMAPINFO(),0L));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::getCompressFormat(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_GET_FORMAT,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::getFormat(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_GET_FORMAT,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::getFormat(BitmapInfo &srcBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_GET_FORMAT,(LONG)&srcBitmapInfo.getBITMAPINFO(),0));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::getPalette(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_GET_PALETTE,(LONG)&srcBitmapInfo.getBITMAPINFOHEADER(),(LONG)&dstBitmapInfo.getBITMAPINFOHEADER()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::driverLoad(void)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,DRV_LOAD,0L,0L));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::driverEnable(void)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,DRV_ENABLE,0L,0L));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::canCompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
returnCode=(ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_QUERY,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::canCompress(BitmapInfo &srcBitmapInfo)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
returnCode=(ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_QUERY,(LONG)&srcBitmapInfo.getBITMAPINFO(),0));
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmCompressBegin(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return BadFormatResult;
|
||||
try{return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_BEGIN,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));}
|
||||
catch(...){::OutputDebugString("[VideoCodec::icmCompressBegin]Exception!");return FailResult;}
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmCompressEnd(void)
|
||||
{
|
||||
if(!mlpfnDriverProc)return BadFormatResult;
|
||||
try{return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS_END,0L,0L));}
|
||||
catch(...){::OutputDebugString("[VideoCodec::icmCompressEnd]Exception");return FailResult;}
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmCompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData)
|
||||
{
|
||||
ICMCompress icmCompress;
|
||||
DWORD chunkID;
|
||||
|
||||
icmCompress.srcBitmapInfoHeaderPtr(srcBitmapInfo);
|
||||
icmCompress.dstBitmapInfoHeaderPtr(dstBitmapInfo);
|
||||
icmCompress.srcInputPtr(srcMovieData);
|
||||
icmCompress.dstOutputPtr(dstMovieData);
|
||||
icmCompress.chunkID(&chunkID);
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_COMPRESS,(LONG)&icmCompress,ICMCompress::size()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::compressFrame(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
if(BadFormatResult==canCompress(srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==getCompressFormat(srcBitmapInfo,dstBitmapInfo))return FailResult;
|
||||
dstMovieData.size(dstBitmapInfo.sizeImage());
|
||||
if(!dstMovieData.size())return FailResult;
|
||||
if(OkResult!=(returnCode=icmCompress(srcBitmapInfo,dstBitmapInfo,srcMovieData,dstMovieData)))return FailResult;
|
||||
return OkResult;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::canDecompress(BitmapInfo &someBitmapInfo)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
returnCode=(ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_QUERY,(LONG)&someBitmapInfo.getBITMAPINFO(),0L));
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::canDecompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
returnCode=(ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_QUERY,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmDecompressBegin(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo)
|
||||
{
|
||||
if(!mlpfnDriverProc)return BadFormatResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_BEGIN,(LONG)&srcBitmapInfo.getBITMAPINFO(),(LONG)&dstBitmapInfo.getBITMAPINFO()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmDecompressEnd(void)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS_END,0L,0L));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmDecompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData)
|
||||
{
|
||||
ICMDecompress icmDecompress;
|
||||
|
||||
if(!mlpfnDriverProc)return BadFormatResult;
|
||||
icmDecompress.flags(ICMDecompress::HurryUp);
|
||||
icmDecompress.srcBitmapInfoHeaderPtr(srcBitmapInfo);
|
||||
icmDecompress.dstBitmapInfoHeaderPtr(dstBitmapInfo);
|
||||
icmDecompress.srcInputPtr(srcMovieData);
|
||||
icmDecompress.dstInputPtr(dstMovieData);
|
||||
icmDecompress.chunkID(0x01);
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_DECOMPRESS,(LONG)&icmDecompress,ICMDecompress::size()));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::icmConfigure(HWND hDisplayWindow)
|
||||
{
|
||||
if(!mlpfnDriverProc)return FailResult;
|
||||
|
||||
return (ReturnCode)((mlpfnDriverProc)(mDriverID,(HDRVR)DriverHandle,ICM_CONFIGURE,(LONG)hDisplayWindow,0L));
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::decompressFrame(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
if(BadFormatResult==canDecompress(srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==getFormat(srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==getFormat(srcBitmapInfo,dstBitmapInfo))return FailResult;
|
||||
dstMovieData.size(dstBitmapInfo.sizeImage());
|
||||
if(BitmapInfo::TrueColor==dstBitmapInfo.bitCount())
|
||||
{
|
||||
dstBitmapInfo.bitCount(BitmapInfo::Bit8);
|
||||
if(BadFormatResult==canDecompress(srcBitmapInfo,dstBitmapInfo))return FailResult;
|
||||
if(ICERR_OK !=getPalette(srcBitmapInfo,dstBitmapInfo))return FailResult;
|
||||
dstMovieData.size(dstBitmapInfo.sizeImage());
|
||||
}
|
||||
if(BadFormatResult==icmDecompressBegin(srcBitmapInfo,dstBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==icmDecompress(srcBitmapInfo,dstBitmapInfo,srcMovieData,dstMovieData))return FailResult;
|
||||
if(OkResult!=icmDecompressEnd())return FailResult;
|
||||
return OkResult;
|
||||
}
|
||||
|
||||
VideoCodec::ReturnCode VideoCodec::decompressFrame(BitmapInfo &srcBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData)
|
||||
{
|
||||
ReturnCode returnCode(FailResult);
|
||||
|
||||
if(!mlpfnDriverProc)return returnCode;
|
||||
if(BadFormatResult==canDecompress(srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==getFormat(srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==getFormat(srcBitmapInfo,srcBitmapInfo))return FailResult;
|
||||
dstMovieData.size(srcBitmapInfo.sizeImage());
|
||||
if(BitmapInfo::TrueColor==srcBitmapInfo.bitCount())
|
||||
{
|
||||
srcBitmapInfo.bitCount(BitmapInfo::Bit8);
|
||||
if(BadFormatResult==canDecompress(srcBitmapInfo,srcBitmapInfo))return FailResult;
|
||||
if(OkResult!=getPalette(srcBitmapInfo,srcBitmapInfo))return FailResult;
|
||||
dstMovieData.size(srcBitmapInfo.sizeImage());
|
||||
}
|
||||
if(BadFormatResult==icmDecompressBegin(srcBitmapInfo,srcBitmapInfo))return FailResult;
|
||||
if(BadFormatResult==icmDecompress(srcBitmapInfo,srcBitmapInfo,srcMovieData,dstMovieData))return FailResult;
|
||||
if(OkResult!=icmDecompressEnd())return FailResult;
|
||||
return OkResult;
|
||||
}
|
||||
88
codec/VIDC.HPP
Normal file
88
codec/VIDC.HPP
Normal file
@@ -0,0 +1,88 @@
|
||||
#ifndef _AVIFILE_VIDEOCODEC_HPP_
|
||||
#define _AVIFILE_VIDEOCODEC_HPP_
|
||||
#ifndef _COMMON_PROFILE_HPP_
|
||||
#include <common/profile.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_AVIDEFS_HPP_
|
||||
#include <avifile/avidefs.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_DRIVERNAME_HPP_
|
||||
#include <avifile/drvname.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_ICMOPEN_HPP_
|
||||
#include <avifile/icmopen.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_ICMINFO_HPP_
|
||||
#include <avifile/icminfo.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_ICMDECOMPRESS_HPP_
|
||||
#include <avifile/icmdcprs.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_ICMCOMPRESS_HPP_
|
||||
#include <avifile/icmcprs.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_FOURCC_HPP_
|
||||
#include <avifile/fourcc.hpp>
|
||||
#endif
|
||||
#ifndef _AVIFILE_AVIBITMAP_HPP_
|
||||
#include <avifile/avibmp.hpp>
|
||||
#endif
|
||||
|
||||
class VideoCodec
|
||||
{
|
||||
public:
|
||||
enum ReturnCode{OkResult=ICERR_OK,FailResult=ICERR_UNSUPPORTED,BadFormatResult=ICERR_BADFORMAT};
|
||||
typedef LRESULT (FAR PASCAL *LPFNDRIVERPROC)(DWORD dwID,HDRVR hdrvr,UINT uMsg,LONG lParam1,LONG lParam2);
|
||||
VideoCodec(void);
|
||||
virtual ~VideoCodec();
|
||||
void closeDriver(void);
|
||||
static WORD enumerateDrivers(Block<DriverName> &driverStrings);
|
||||
WORD locateDriver(DWORD fccType,DriverName &driverName);
|
||||
ReturnCode openDriver(DWORD fccType);
|
||||
ReturnCode openDriver(const String &driverName);
|
||||
ReturnCode openDriver(const DriverName &driverName);
|
||||
ReturnCode driverLoad(void);
|
||||
ReturnCode driverEnable(void);
|
||||
|
||||
ReturnCode canCompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode canCompress(BitmapInfo &srcBitmapInfo);
|
||||
ReturnCode canDecompress(BitmapInfo &someBitmapInfo);
|
||||
ReturnCode canDecompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode getCompressFormat(BitmapInfo &srcBitmapInfo);
|
||||
ReturnCode getCompressFormat(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode getFormat(BitmapInfo &srcBitmapInfo);
|
||||
ReturnCode getFormat(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
|
||||
ReturnCode getPalette(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode driverProc(ICMOpen &someICMOpen);
|
||||
ReturnCode driverProc(ICMInfo &someICMInfo);
|
||||
ReturnCode decompressFrame(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData);
|
||||
ReturnCode decompressFrame(BitmapInfo &srcBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData);
|
||||
ReturnCode compressFrame(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData);
|
||||
ReturnCode icmConfigure(HWND hDisplayWindow);
|
||||
private:
|
||||
enum {DriverID=0x01,DriverHandle=0x01};
|
||||
ReturnCode icmDecompressBegin(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode icmDecompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData);
|
||||
ReturnCode icmDecompressEnd(void);
|
||||
ReturnCode icmCompressBegin(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo);
|
||||
ReturnCode icmCompressEnd(void);
|
||||
ReturnCode icmCompress(BitmapInfo &srcBitmapInfo,BitmapInfo &dstBitmapInfo,MovieData &srcMovieData,MovieData &dstMovieData);
|
||||
|
||||
DWORD mDriverID;
|
||||
HINSTANCE mhVideoCodec;
|
||||
LPFNDRIVERPROC mlpfnDriverProc;
|
||||
};
|
||||
|
||||
inline
|
||||
VideoCodec::VideoCodec(void)
|
||||
: mhVideoCodec(0), mlpfnDriverProc(0), mDriverID(0)
|
||||
{
|
||||
}
|
||||
|
||||
inline
|
||||
VideoCodec::~VideoCodec()
|
||||
{
|
||||
closeDriver();
|
||||
}
|
||||
#endif
|
||||
100
codec/codec.dsp
Normal file
100
codec/codec.dsp
Normal file
@@ -0,0 +1,100 @@
|
||||
# Microsoft Developer Studio Project File - Name="codec" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Static Library" 0x0104
|
||||
|
||||
CFG=codec - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "codec.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "codec.mak" CFG="codec - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "codec - Win32 Release" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE "codec - Win32 Debug" (based on "Win32 (x86) Static Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "codec - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ELSEIF "$(CFG)" == "codec - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /Gz /MTd /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /D "STRICT" /D "__FLAT__" /YX /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LIB32=link.exe -lib
|
||||
# ADD BASE LIB32 /nologo
|
||||
# ADD LIB32 /nologo
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "codec - Win32 Release"
|
||||
# Name "codec - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\FOURCC.CPP
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\VIDC.CPP
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
29
codec/codec.dsw
Normal file
29
codec/codec.dsw
Normal file
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "codec"=.\codec.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
BIN
codec/codec.ncb
Normal file
BIN
codec/codec.ncb
Normal file
Binary file not shown.
BIN
codec/codec.opt
Normal file
BIN
codec/codec.opt
Normal file
Binary file not shown.
16
codec/codec.plg
Normal file
16
codec/codec.plg
Normal file
@@ -0,0 +1,16 @@
|
||||
<html>
|
||||
<body>
|
||||
<pre>
|
||||
<h1>Build Log</h1>
|
||||
<h3>
|
||||
--------------------Configuration: codec - Win32 Debug--------------------
|
||||
</h3>
|
||||
<h3>Command Lines</h3>
|
||||
|
||||
|
||||
|
||||
<h3>Results</h3>
|
||||
codec.lib - 0 error(s), 0 warning(s)
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user