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

bool Impala::Core::Stream::RgbDataSrcLavc_old::PrepareForReading (  )  [inline, private]

Definition at line 567 of file RgbDataSrcLavc_old.h.

References ILOG_DEBUG, and ILOG_ERROR.

Referenced by Init().

00568     {
00569         ILOG_DEBUG("Preparing for reading video stream...");
00570 
00571 #ifdef FFMPEG_52
00572         ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb->pos=" << mFormatCtx->pb->pos);
00573         int result = av_seek_frame(mFormatCtx, mVideoStreamIndex, 0, AVSEEK_FLAG_BYTE | AVSEEK_FLAG_ANY);
00574         ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb->pos=" << mFormatCtx->pb->pos << "; result = " << result);
00575         //result = av_seek_frame(mFormatCtx, mVideoStreamIndex, 0, AVSEEK_FLAG_BYTE | AVSEEK_FLAG_ANY);
00576         //ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb->pos=" << mFormatCtx->pb->pos << "; result = " << result);
00577 #else
00578         ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb.pos=" << mFormatCtx->pb.pos);
00579         const int flags = AVSEEK_FLAG_BYTE | AVSEEK_FLAG_ANY;
00580         int result = av_seek_frame(mFormatCtx, mVideoStreamIndex, 0, flags);
00581         ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb.pos=" << mFormatCtx->pb.pos << "; result = " << result);
00582         //result = av_seek_frame(mFormatCtx, mVideoStreamIndex, 0, AVSEEK_FLAG_BYTE | AVSEEK_FLAG_ANY);
00583         //ILOG_DEBUG("[PrepareForReading] stream's curdts=" << mVideoStream->cur_dts << " mPacket->dts=" << mPacket->dts << " mPacket->pts=" << mPacket->pts << " mPacket->size=" << mPacket->size << "; pb.pos=" << mFormatCtx->pb.pos << "; result = " << result);
00584 #endif
00585 
00586         if (result < 0)
00587         {
00588             ILOG_ERROR("[PrepareForReading] av_seek_frame returned " << result);
00589             return false;
00590         }
00591 
00592         if (mCodecCtx->codec->flush != NULL)
00593             mCodecCtx->codec->flush(mCodecCtx);
00594 
00595         mBlankFrames = 0;
00596         int currentFrameNr = -1;
00597         const bool startAtKeyFrame = false; // SK: I think we should start at a keyframe; Taylan did not; what does VirtualDub do? Might a first frame be non-keyframe but readable nevertheless?
00598         bool isValidFrame = false;
00599         bool isKeyFrame = false;
00600         while (!isValidFrame || (startAtKeyFrame && !isKeyFrame))
00601         {
00602             const bool gotFrame = (DecodeNextFrame(isValidFrame, isKeyFrame) == 0);
00603             if (!gotFrame) // indicates eof or error
00604                 return false; 
00605             currentFrameNr++;
00606             if (!isValidFrame)
00607             {
00608                 MarkBadFrame(currentFrameNr);
00609                 mBlankFrames++;
00610             }
00611         }
00612 
00613         ConvertFrameToRgb();
00614 
00615         mCurrentFrameNr = mBufferedFrameNr = currentFrameNr;
00616         ILOG_DEBUG("Prepared for reading video stream; detected " << mBlankFrames << " leading invalid frame(s)");
00617         return true;
00618     }


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