Wednesday, May 10, 2006

exporting a looped movie

Tried exporting a bidirectional movie (plays forward and then plays in reverse). It's smoother than just letting the video jump back to the beginning but there's still a visible transition when the rings change direction.

int PassFrames = m_RangeLast - m_RangeFirst + 1;
int TotalFrames = (PassFrames - 1) * 2;
pd.Create();
int j = m_RangeLast;
pd.SetRange(0, TotalFrames);
for (int i = 0; i < TotalFrames; i++) {
if (i >= PassFrames)
sm.Seek(--j);
sm.Read();
HBITMAP bm = View->MakeDIB(&OutFrameSize, &m_InFrameSize, GetScaleToFit());
bool retc = bta.AddFrame(bm);
DeleteObject(bm);
if (!m_DisplayOutput) // prevent view from painting
View->ValidateRect(NULL); // must revalidate before SetPos
pd.SetPos(i);
if (pd.Canceled())
return(IDCANCEL);
}

No comments: