Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

bool Impala::Core::Stream::RgbDataSrcLavc::ReadToTarget (  )  [inline, private]

Definition at line 445 of file RgbDataSrcLavc.h.

References Impala::Core::Stream::Lavc::VideoAccessStrategy::FrameCanBeRead(), Impala::Core::Stream::RgbDataSrcInfo::FrameValid(), ILOG_DEBUG, ILOG_WARN, Impala::Core::Stream::RgbDataSrc::LASTFRAME_UNKNOWN, Impala::Core::Stream::RgbDataSrcInfo::MarkBadFrame(), mLastDecodedFrameNr, Impala::Core::Stream::RgbDataSrc::mLastFrame, Impala::Core::Stream::RgbDataSrc::mTargetFrameNr, and mVideoAccessor.

Referenced by ReadFrameData().

00446     {
00447         bool lastDecodedFrameIsValid = true;
00448         while (mLastDecodedFrameNr < mTargetFrameNr)
00449         {
00450             const int nextFrameNr = mLastDecodedFrameNr + 1;
00451 
00452                         if (mVideoAccessor->FrameCanBeRead(nextFrameNr))
00453                         {
00454                 bool foundValidFrame;
00455                 bool isKeyFrame; // not actually used
00456                 const int decodingResult = mVideoAccessor->
00457                     DecodeNextFrame(&foundValidFrame, &isKeyFrame, 0);
00458                 const bool gotFrame = (decodingResult == 0);
00459                 if (!gotFrame)
00460                 {
00461                     // may occur at eof if the video was not scanned in advance
00462                     if (mLastFrame == LASTFRAME_UNKNOWN)
00463                     {
00464                         mLastFrame = mLastDecodedFrameNr; 
00465                         ILOG_DEBUG("Assuming we arrived at eof; " <<
00466                             "frame count established is: " << mLastFrame + 1);
00467                     }
00468                     return false;
00469                 }
00470                         
00471                 lastDecodedFrameIsValid = FrameValid(nextFrameNr);
00472                 if (lastDecodedFrameIsValid && !foundValidFrame)
00473                 {
00474                     // may occur for bad frames if the video was not scanned in advance
00475                     MarkBadFrame(nextFrameNr);
00476                     lastDecodedFrameIsValid = false;
00477                 }
00478                 else if (!lastDecodedFrameIsValid && foundValidFrame)
00479                 {
00480                     ILOG_WARN("Did not expect to read a valid frame for " << 
00481                         nextFrameNr);
00482                 }
00483                         }
00484             else
00485             {
00486                 if (FrameValid(nextFrameNr))
00487                 {
00488                     // may occur when the video was not scanned in advance
00489                     MarkBadFrame(nextFrameNr);
00490                 }
00491                 lastDecodedFrameIsValid = false;
00492             }
00493 
00494             mLastDecodedFrameNr = nextFrameNr;
00495         }
00496         return lastDecodedFrameIsValid;
00497     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:33 2011 for ImpalaSrc by  doxygen 1.5.1