This is the primary JFIF parsing routine. The main loop steps through all of the JFIF markers and calls DecodeMarker() each time until we reach the end of file or an error. Finally, we invoke the compression signature search function. Processing starts at the file offset m_pAppConfig->nPosStart INPUT: - inFile = Input file pointer PRE: - m_pAppConfig->nPosStart = Starting file offset for d
| 7295 | // - m_pAppConfig->nPosStart = Starting file offset for decode |
| 7296 | // |
| 7297 | void CjfifDecode::ProcessFile(CFile* inFile) |
| 7298 | { |
| 7299 | |
| 7300 | CString strTmp; |
| 7301 | |
| 7302 | // Reset the JFIF decoder state as we may be redoing another file |
| 7303 | Reset(); |
| 7304 | |
| 7305 | // Reset the IMG Decoder state |
| 7306 | if (m_pImgSrcDirty) { |
| 7307 | m_pImgDec->ResetState(); |
| 7308 | } |
| 7309 | |
| 7310 | // Set the statusbar text to Processing... |
| 7311 | |
| 7312 | // Ensure the status bar has been allocated |
| 7313 | // NOTE: The stat bar is NULL if we drag & drop a file onto |
| 7314 | // the JPEGsnoop app icon. |
| 7315 | if (m_pStatBar) { |
| 7316 | m_pStatBar->SetPaneText(0,_T("Processing...")); |
| 7317 | } |
| 7318 | |
| 7319 | |
| 7320 | // Note that we don't clear out the logger (with m_pLog->Reset()) |
| 7321 | // as we want top-level caller to do this. This way we can |
| 7322 | // still insert extra lines from top level. |
| 7323 | |
| 7324 | // GetLength returns ULONGLONG. Abort on large files (>=4GB) |
| 7325 | ULONGLONG nPosFileEnd; |
| 7326 | nPosFileEnd = inFile->GetLength(); |
| 7327 | if (nPosFileEnd > 0xFFFFFFFFUL) { |
| 7328 | strTmp = _T("File too large. Skipping."); |
| 7329 | m_pLog->AddLineErr(strTmp); |
| 7330 | if (m_pAppConfig->bInteractive) |
| 7331 | AfxMessageBox(strTmp); |
| 7332 | return; |
| 7333 | } |
| 7334 | m_nPosFileEnd = static_cast<unsigned long>(nPosFileEnd); |
| 7335 | |
| 7336 | |
| 7337 | unsigned nStartPos; |
| 7338 | nStartPos = m_pAppConfig->nPosStart; |
| 7339 | m_nPos = nStartPos; |
| 7340 | m_nPosEmbedStart = nStartPos; // Save the embedded file start position |
| 7341 | |
| 7342 | strTmp.Format(_T("Start Offset: 0x%08X"),nStartPos); |
| 7343 | m_pLog->AddLine(strTmp); |
| 7344 | |
| 7345 | |
| 7346 | // ---------------------------------------------------------------- |
| 7347 | |
| 7348 | // Test for AVI file |
| 7349 | // - Detect header |
| 7350 | // - start from beginning of file |
| 7351 | DecodeAvi(); |
| 7352 | // TODO: Should we skip decode of file if not MJPEG? |
| 7353 | |
| 7354 |
no test coverage detected