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

bool Impala::Core::Stream::RgbDataSrcInfo::ReadInfo ( bool  silent = false  )  [inline, protected]

Definition at line 280 of file RgbDataSrcInfo.h.

References BUFFER_SIZE, GetInfoIOBuffer(), Impala::Util::StringParser::GetInt(), ILOG_DEBUG, ILOG_ERROR, ILOG_WARN, Impala::MakeString(), MarkBadFrame(), Impala::Core::Stream::RgbDataSrc::mAspectRatioDen, Impala::Core::Stream::RgbDataSrc::mAspectRatioNum, mBadFrameNrs, Impala::Core::Stream::RgbDataSrc::mBitRate, Impala::Core::Stream::RgbDataSrc::mBlankFrames, Impala::Core::Stream::RgbDataSrc::mCodecName, Impala::Core::Stream::RgbDataSrc::mCodecTag, Impala::Core::Stream::RgbDataSrc::mDuration, Impala::Core::Stream::RgbDataSrc::mDurationHour, Impala::Core::Stream::RgbDataSrc::mDurationMin, Impala::Core::Stream::RgbDataSrc::mDurationSec, Impala::Core::Stream::RgbDataSrc::mFormatLName, Impala::Core::Stream::RgbDataSrc::mFormatName, mFormatStr, Impala::Core::Stream::RgbDataSrc::mFrameHeight, Impala::Core::Stream::RgbDataSrc::mFrameRateDen, Impala::Core::Stream::RgbDataSrc::mFrameRateNum, Impala::Core::Stream::RgbDataSrc::mFrameWidth, Impala::Core::Stream::RgbDataSrc::mGopSize, mIndex, Impala::Core::Stream::RgbDataSrc::mIndexExists, mInfoVersion, Impala::Core::Stream::RgbDataSrc::mLastFrame, Impala::Core::Stream::RgbDataSrc::mStreamCount, Impala::Core::Stream::RgbDataSrc::mTimeBaseDen, Impala::Core::Stream::RgbDataSrc::mTimeBaseNum, Impala::Core::Stream::RgbDataSrc::mVideoDuration, Impala::Core::Table::Read(), Impala::Util::IOBuffer::Read(), Impala::Core::Stream::RgbDataSrc::SetLeadingBadFrames(), Impala::Core::Table::Table::Size(), Impala::Timer::SplitTime(), Impala::Util::StringParser::TheEnd(), and Impala::StringList::ToString().

Referenced by Impala::Core::Stream::RgbDataSrcLavc_old::Init(), Impala::Core::Stream::RgbDataSrcLavc::ReadIndex(), and RgbDataSrcInfo().

00281     {
00282         ILOG_DEBUG("Reading info file");
00283         Timer timer;
00284         Util::IOBuffer* infoBuf = GetInfoIOBuffer(false, silent);
00285         if (!infoBuf)
00286         {
00287             ILOG_WARN("Reading canceled");
00288             return false;
00289         }
00290 
00291         char buf[BUFFER_SIZE];
00292         infoBuf->Read(buf, BUFFER_SIZE);
00293         char srcName[100];
00294         char formatName[30];
00295         char formatLName[100];
00296         char codecName[30];
00297         char codecTag[5];
00298         char indexExists[5];
00299         
00300         int frameCount;
00301         char badFramesList[10000];
00302         int numberOfLeadingBadFrames;
00303         int res = sscanf(buf, mFormatStr.c_str(),
00304                     srcName,
00305                     formatName,
00306                     formatLName,
00307                     &mBitRate,
00308                     &mStreamCount,
00309                     codecName,
00310                     codecTag,
00311                     &mTimeBaseNum, &mTimeBaseDen,
00312                     &mVideoDuration,
00313                     &mDuration,
00314                     &mDurationHour, &mDurationMin, &mDurationSec,
00315                     &mFrameWidth,
00316                     &mFrameHeight,
00317                     &mAspectRatioNum, &mAspectRatioDen,
00318                     &frameCount,
00319                     &mFrameRateNum, &mFrameRateDen,
00320                     &mGopSize,
00321                     &numberOfLeadingBadFrames,
00322                     badFramesList,
00323                     indexExists);
00324         if (res != 25)
00325         {
00326             ILOG_ERROR("RGB data source info format not compatible; " <<
00327                 "expected version is: " << mInfoVersion);
00328             return false;
00329         }
00330 
00331         //if (frameCount != mLastFrame + 1)
00332         //{
00333         //    ILOG_ERROR("Number of frames according to info file (" << 
00334         //        frameCount << ") does not match currently " <<
00335         //        " established frame count (" << (mLastFrame + 1) << ")");
00336         //    return false;
00337         //}
00338 
00339         //Copy the scanned data to member variables
00340         mLastFrame = frameCount - 1;
00341         mFormatName = formatName;
00342         mFormatLName = formatLName;
00343         mCodecName = codecName;
00344         mCodecTag = codecTag;
00345 
00346         SetLeadingBadFrames(numberOfLeadingBadFrames);
00347         mBadFrameNrs.clear();
00348         const String badFramesListString(badFramesList);
00349         if (badFramesListString != "none")
00350         {
00351             Util::StringParser parser(badFramesListString);
00352             while (!parser.TheEnd())
00353             {
00354                 const int frameNr = parser.GetInt(';', false, true);
00355                 MarkBadFrame(frameNr);
00356             }
00357         }
00358 
00359         if (String(indexExists) == "yes")
00360             mIndexExists = true;
00361         else
00362             mIndexExists = false;
00363 
00364         // for debug log:
00365         {
00366             StringList badFramesString;
00367             for (int i = 0; i < mBadFrameNrs.size(); i++)
00368                 badFramesString << MakeString(mBadFrameNrs[i]);
00369 
00370             sprintf(buf, mFormatStr.c_str(),
00371                         srcName,
00372                         formatName,
00373                         formatLName,
00374                         mBitRate,
00375                         mStreamCount,
00376                         codecName,
00377                         codecTag,
00378                         mTimeBaseNum, mTimeBaseDen,
00379                         mVideoDuration,
00380                         mDuration,
00381                         mDurationHour, mDurationMin, mDurationSec,
00382                         mFrameWidth,
00383                         mFrameHeight,
00384                         mAspectRatioNum, mAspectRatioDen,
00385                         mLastFrame + 1,
00386                         mFrameRateNum, mFrameRateDen,
00387                         mGopSize,
00388                         mBlankFrames,
00389                         badFramesString.ToString(';').c_str(),
00390                         indexExists);
00391             ILOG_DEBUG("\n\n" << buf);
00392         }
00393 
00394         if (mIndexExists)
00395         {   
00396             ILOG_DEBUG("Reading the index attached to info file");
00397             ILOG_DEBUG("  start read " << timer.SplitTime());
00398             Read(mIndex, infoBuf);
00399             ILOG_DEBUG("  done actual read " << timer.SplitTime());
00400             ILOG_DEBUG(mIndex->Size() << " index entries read");
00401         }
00402 
00403         delete infoBuf; 
00404         return true;
00405     }

Here is the call graph for this function:


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