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

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

Definition at line 330 of file RgbDataSrcLavc_old.h.

References Impala::CmdOptions::GetInstance(), Impala::CmdOptions::GetString(), ILOG_DEBUG, ILOG_ERROR, ILOG_INFO, Impala::Core::Stream::RgbDataSrc::mBitRate, mFormatCtx, Impala::Core::Stream::RgbDataSrc::mFormatLName, Impala::Core::Stream::RgbDataSrc::mFormatName, Impala::Core::Stream::RgbDataSrc::mSrcName, and SetJumpMethod().

Referenced by Init().

00331     {
00332         // Open video file 
00333         CmdOptions& options = CmdOptions::GetInstance();
00334         String dataServer = options.GetString("dataServer");
00335         String srcAddress = mSrcName;
00336         if (!dataServer.empty())
00337             srcAddress = "dataserver:" + mSrcName;
00338 
00339         int result = av_open_input_file(&mFormatCtx, 
00340                                  srcAddress.c_str(), NULL, 0, NULL);
00341 
00342         if (result != 0)
00343         {
00344             ILOG_ERROR("Return value from av_open_input_file(): " << result);
00345             throw (LAVCException("Unable to open: " + mSrcName, 0));
00346             return false;
00347         }
00348 
00349 #if LIBAVFORMAT_VERSION_INT >= ((51<<16)+(14<<8)+0) // from version 51.14.0 on
00350         if (mFormatCtx->iformat->flags & AVFMT_GENERIC_INDEX)
00351         {
00352             // if flag not initially cleared, may result in invalid data;
00353             // mFormatCtx is not available until input file is opened
00354             mFormatCtx->iformat->flags -= AVFMT_GENERIC_INDEX;
00355             ILOG_DEBUG("Flag cleared: mFormatCtx->iformat->flags -= " <<
00356                 "AVFMT_GENERIC_INDEX");
00357 
00358             // re-open the file
00359             result = av_open_input_file(&mFormatCtx, 
00360                                  srcAddress.c_str(), NULL, 0, NULL);
00361         }
00362 #endif
00363 
00364         // Retrieve stream information
00365         if (av_find_stream_info(mFormatCtx) < 0) 
00366             throw LAVCException("Could not find stream info in: " + mSrcName, 0);
00367 
00368         // Dump information about file onto standard error
00369         dump_format(mFormatCtx, 0, mSrcName.c_str(), false);
00370 
00371         mFormatCtx->flags |= AVFMT_FLAG_GENPTS;
00372 
00373         mBitRate     = mFormatCtx->bit_rate;
00374         mFormatName  = mFormatCtx->iformat->name;
00375         mFormatLName = mFormatCtx->iformat->long_name;
00376         ILOG_INFO("Format name is: " << mFormatLName << " (" << mFormatName << ")");
00377         
00378         if ((mFormatName == "avi") ||
00379             (mFormatName == "mov,mp4,m4a,3gp,3g2,mj2"))
00380         {
00381             SetJumpMethod("pts");
00382         }
00383         else
00384         {
00385              //SK, 16-Mar-2009: It appears the following clause should
00386              //  never be used anyway.
00387 //#if LIBAVFORMAT_VERSION_INT >= ((51<<16)+(14<<8)+0) 
00388 //            // SK, 11-Mar-2009: this appeared not to work out well for AVI:
00389 //            int oldFlags = mFormatCtx->iformat->flags;
00390 //            ILOG_DEBUG("Changing mFormatCtx->iformat->flags from " << 
00391 //                oldFlags << " into " << (oldFlags | AVFMT_GENERIC_INDEX));
00392 //            mFormatCtx->iformat->flags |= AVFMT_GENERIC_INDEX;
00393 //#endif
00394         }
00395 
00396         return true;
00397     }

Here is the call graph for this function:


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