Beispiel #1
0
void VDInputFileFLM::Init(const wchar_t *filename) {
	bool valid = false;

	mFile.open(filename, nsVDFile::kRead | nsVDFile::kDenyWrite | nsVDFile::kOpenExisting);
	sint64 fsize = mFile.size();
	FilmstripHeader	mHeader;
	if (fsize >= 36) {
		mFile.seek(fsize - 36);
		
		char hdrbuf[36];
		mFile.read(hdrbuf, 36);

		mHeader.Read(hdrbuf);

		if (mHeader.Validate()) {
			mFrameSize	= (uint32)mHeader.width * ((uint32)mHeader.height + (uint32)mHeader.leading) * 4;

			if ((uint64)mFrameSize * (uint16)mHeader.numFrames + 36 <= fsize)
				valid = true;
		}
	}

	if (!valid)
		throw MyError("%ls does not appear to be a valid Adobe filmstrip file.", mFile.getFilenameForError());

	mVisibleFrameSize	= (uint32)mHeader.width * (uint32)mHeader.height * 4;
	mFrameWidth			= (uint32)mHeader.width;
	mFrameHeight		= (uint32)mHeader.height;
	mFrameCount			= (uint32)mHeader.numFrames;
	mFrameRate.Assign((uint32)mHeader.framesPerSec, 1);
}
Beispiel #2
0
	DetectionConfidence DetectBySignature(const void *pHeader, sint32 nHeaderSize, const void *pFooter, sint32 nFooterSize, sint64 nFileSize) {
		if (nFooterSize >= 36) {
			const uint8 *buf = (const uint8 *)pFooter;
			FilmstripHeader hdr;

			hdr.Read(buf + nFooterSize - 36);
			if (hdr.Validate())
				return kDC_High;
		}

		return kDC_None;
	}
Beispiel #3
0
	int DetectBySignature(const void *pHeader, sint32 nHeaderSize, const void *pFooter, sint32 nFooterSize, sint64 nFileSize) {
		if (nFooterSize >= 36) {
			const uint8 *buf = (const uint8 *)pFooter;
			FilmstripHeader hdr;

			hdr.Read(buf + nFooterSize - 36);
			if (hdr.Validate())
				return 1;
		}

		return -1;
	}