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

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

Definition at line 426 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().

00427     {
00428         bool lastDecodedFrameIsValid = true;
00429         while (mLastDecodedFrameNr < mTargetFrameNr)
00430         {
00431             const int nextFrameNr = mLastDecodedFrameNr + 1;
00432 
00433                         if (mVideoAccessor->FrameCanBeRead(nextFrameNr))
00434                         {
00435                 bool foundValidFrame;
00436                 bool isKeyFrame; // not actually used
00437                 const int decodingResult = mVideoAccessor->
00438                     DecodeNextFrame(&foundValidFrame, &isKeyFrame, 0);
00439                 const bool gotFrame = (decodingResult == 0);
00440                 if (!gotFrame)
00441                 {
00442                     // may occur at eof if the video was not scanned in advance
00443                     if (mLastFrame == LASTFRAME_UNKNOWN)
00444                     {
00445                         mLastFrame = mLastDecodedFrameNr; 
00446                         ILOG_DEBUG("Assuming we arrived at eof; " <<
00447                             "frame count established is: " << mLastFrame + 1);
00448                     }
00449                     return false;
00450                 }
00451                         
00452                 lastDecodedFrameIsValid = FrameValid(nextFrameNr);
00453                 if (lastDecodedFrameIsValid && !foundValidFrame)
00454                 {
00455                     // may occur for bad frames if the video was not scanned in advance
00456                     MarkBadFrame(nextFrameNr);
00457                     lastDecodedFrameIsValid = false;
00458                 }
00459                 else if (!lastDecodedFrameIsValid && foundValidFrame)
00460                 {
00461                     ILOG_WARN("Did not expect to read a valid frame for " << 
00462                         nextFrameNr);
00463                 }
00464                         }
00465             else
00466             {
00467                 if (FrameValid(nextFrameNr))
00468                 {
00469                     // may occur when the video was not scanned in advance
00470                     MarkBadFrame(nextFrameNr);
00471                 }
00472                 lastDecodedFrameIsValid = false;
00473             }
00474 
00475             mLastDecodedFrameNr = nextFrameNr;
00476         }
00477         return lastDecodedFrameIsValid;
00478     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:17:43 2010 for ImpalaSrc by  doxygen 1.5.1