void VDPositionControlW32::UpdateString(VDPosition pos) {
	wchar_t buf[512];

	if (pos < 0)
		pos = mPosition;

	bool success = false;
	if (mpCB)
		success = mpCB->GetFrameString(buf, sizeof buf / sizeof buf[0], pos);

	if (!success) {
		if (mFrameRate.getLo()) {
			int ms, sec, min;
			long ticks = (long)mFrameRate.scale64ir(pos * 1000);

			ms  = ticks %1000; ticks /= 1000;
			sec	= ticks %  60; ticks /=  60;
			min	= ticks %  60; ticks /=  60;

			success = (unsigned)swprintf(buf, sizeof buf / sizeof buf[0], L" Frame %I64d (%d:%02d:%02d.%03d)", (sint64)pos, ticks, min, sec, ms) < sizeof buf / sizeof buf[0];
		} else
			success = (unsigned)swprintf(buf, sizeof buf / sizeof buf[0], L" Frame %I64d", (sint64)pos) < sizeof buf / sizeof buf[0];
	}

	if (success) {
		HWND hwndFrame = GetDlgItem(mhwnd, IDC_FRAME);

		VDSetWindowTextW32(hwndFrame, buf);
	}
}
Exemple #2
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);
}
Exemple #3
0
sint32 VDVideoFilterInput::Prepare() {
	VDPixmap& outformat = *mpContext->mpOutput->mpFormat;
	const BITMAPINFOHEADER& srcformat = *mpSource->getDecompressedFormat();

	outformat.w			= srcformat.biWidth;
	outformat.h			= srcformat.biHeight;
	outformat.format	= nsVDPixmap::kPixFormat_XRGB8888;

	const VDFraction rate(mpSource->asStream()->getRate());

	mpContext->mpOutput->mFrameRateHi	= rate.getHi();
	mpContext->mpOutput->mFrameRateLo	= rate.getLo();
	mpContext->mpOutput->mLength		= mpSource->asStream()->getLength();
	mpContext->mpOutput->mStart			= 0;

	return 0;
}
Exemple #4
0
sint64 VDAudioFilterNewRate::Seek(sint64 us) {
	mOutputBuffer.Flush();
	mpContext->mpOutputs[0]->mCurrentLevel = 0;
	return mRatio.scale64r(us);
}
Exemple #5
0
void VDVideoWindow::SetSourcePAR(const VDFraction& fr) {
	mSourcePAR = 0;
	if (fr.getLo())
		mSourcePAR = fr.asDouble();
	UpdateSourcePARMenuItem();
}
Exemple #6
0
void VDRenderFrameMap::Init(const vdfastvector<IVDVideoSource *>& videoSources, VDPosition nSrcStart, VDFraction srcStep, const FrameSubset *pSubset, VDPosition nFrameCount, bool bDirect) {
	VDPosition directLast = -1;
	int sourceLast = -1;
	IVDVideoSource *pVS = NULL;
	VDPosition len = 0;

	mFrameMap.reserve((size_t)nFrameCount);
	for(VDPosition frame = 0; frame < nFrameCount; ++frame) {
		VDPosition timelineFrame = nSrcStart + srcStep.scale64t(frame);
		VDPosition srcFrame = timelineFrame;
		int source = 0;

		if (pSubset) {
			bool masked;
			srcFrame = pSubset->lookupFrame((int)srcFrame, masked, source);
			if (srcFrame < 0)
				break;
		} else {
			if (srcFrame < 0 || srcFrame >= len)
				break;
		}

		if (sourceLast != source) {
			sourceLast = source;
			pVS = videoSources[source];
			len = pVS->asStream()->getLength();
			directLast = -1;
		}

		// we need to preserve this so filter timing isn't screwed up across drop frames
		VDPosition origSrcFrame = srcFrame;
		srcFrame = pVS->getRealDisplayFrame(srcFrame);

		if (bDirect) {
			VDPosition key = pVS->nearestKey((LONG)srcFrame);

			if (directLast < key)
				directLast = key;
			else if (directLast > srcFrame)
				directLast = key;
			else {
				while(directLast < srcFrame) {
					++directLast;

					if (pVS->getDropType(directLast) != VideoSource::kDroppable)
						break;
				}
			}

			srcFrame = directLast;
		}

		FrameEntry ent;
		ent.mSrcIndex = source;
		ent.mTimelineFrame = timelineFrame;
		ent.mDisplayFrame = srcFrame;
		ent.mOrigDisplayFrame = origSrcFrame;

		mFrameMap.push_back(ent);
	}

	mMaxFrame = mFrameMap.size();

	mInvalidEntry.mSrcIndex = -1;
	mInvalidEntry.mTimelineFrame = -1;
	mInvalidEntry.mDisplayFrame = -1;
}