Definition at line 1181 of file RgbDataSrcLavc_old.h. References ILOG_DEBUG, ILOG_ERROR, and ILOG_WARN. Referenced by JumpToKeyFrame(). 01182 { 01183 if (!mIndexExists) 01184 return; 01185 01186 String refHash = FrameHash(frameNr); 01187 //if (refHash == "") //If it's an avi file there is no hash check 01188 //{ 01189 // mIsFrameAccurate = true; 01190 // return; 01191 //} 01192 01193 //Array2dVec3UInt8* arr = new Array2dVec3UInt8(FrameWidth(), 01194 // FrameHeight(), 0, 0, 01195 // DataPtr(),true,false); 01196 //String hash = Array::MD5Hash(arr); 01197 //delete arr; 01198 String hash = CalcHash(); 01199 01200 ILOG_DEBUG("[CheckMD5Hash] frameNr=" << frameNr << " hash_calculated=" << hash << " hash_found=" << refHash); 01201 01202 mIsFrameAccurate = (hash==refHash); 01203 if (!mFixIndexIfBroken) 01204 { 01205 if (!mIsFrameAccurate) 01206 { 01207 ILOG_ERROR("Jumping to Frame("<<frameNr<<") ends in Frame(" 01208 <<GetFrameFromHash(hash)<<")"); 01209 01210 } 01211 return; 01212 } 01213 01214 //if it's not frame accurate, we have to relocate our position 01215 if (!mIsFrameAccurate) 01216 { 01217 if (true) 01218 { 01219 ILOG_ERROR("SK: Index is not correct for video: " << mSrcName); 01220 throw LAVCException("Index is not correct", 0); 01221 } 01222 01223 01224 if (frameNr==mLastFixNr) 01225 { 01226 mFixCnt++; 01227 if (mFixCnt>10) 01228 { 01229 String msg = "Cannot Fix video: " + mSrcName; 01230 ILOG_ERROR(msg << "; try with src=LAVC_NOIDX"); 01231 throw LAVCException(msg, 0); 01232 } 01233 } 01234 else{ 01235 mFixCnt=0; 01236 mLastFixNr=frameNr; 01237 } 01238 01239 ILOG_WARN("Fixing Frame Accuracy for frame "<<frameNr 01240 <<" (ended in "<<GetFrameFromHash(hash)<<")"); 01241 01242 //Find the broken key frame that we couldn't jump to 01243 //and discard it from the index 01244 int BrokenKey = GetSeekableFrame(frameNr); 01245 01246 int fNr = frameNr; 01247 int cNr = mBufferedFrameNr; 01248 01249 while (--fNr) 01250 { 01251 ILOG_DEBUG("Checking for previous Non-Broken @ "<< fNr); 01252 01253 if (fNr < 0) 01254 { 01255 ILOG_ERROR("fNr is negative (" << fNr << ") and cannot be used as a column index"); 01256 return; 01257 } 01258 01259 if ( (UInt32) fNr < mBlankFrames) 01260 { 01261 ILOG_DEBUG("fNr (" << fNr << ") is less than mBlankFrames (" << mBlankFrames << ")"); 01262 return; 01263 } 01264 if (fNr==mBlankFrames) 01265 break; 01266 01267 if (GetSeekableFrame(fNr) != BrokenKey) 01268 break; 01269 } 01270 01271 ILOG_DEBUG("Found Previous Non-Broken frame " << fNr); 01272 01273 int PrevKey = GetSeekableFrame(fNr); 01274 if (PrevKey < 0) 01275 { 01276 ILOG_ERROR("PrevKey has negative value: " << PrevKey); 01277 return; 01278 } 01279 int64_t PrevKeyPos = GetPos(fNr); 01280 ILOG_DEBUG("Previous Non-Broken for Keyframe " << PrevKey); 01281 01282 fNr++; 01283 while (GetSeekableFrame(fNr)==BrokenKey) 01284 { 01285 ILOG_DEBUG("Resetting keyframe Information for "<<fNr); 01286 SetKey(fNr,PrevKey); 01287 SetPos(fNr,PrevKeyPos); 01288 fNr++; 01289 } 01290 ILOG_DEBUG("Retrying..."); 01291 01292 //Jump(GetPos(0), AVSEEK_FLAG_BYTE, 2, 2); 01293 //mBufferedFrameNr = mBlankFrames; 01294 Reset(); 01295 ReadFrameData(); 01296 } 01297 else 01298 { 01299 ILOG_DEBUG("Frame Accuracy OK for frame "<<frameNr); 01300 } 01301 }
|