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

bool Impala::Core::Stream::Lavc::VideoAccessObject::InitCodecContext (  )  [inline, private]

Definition at line 658 of file VideoAccessObject.h.

References ILOG_ERROR, Impala::MakeString(), mSrcAddress, mSwsContext, mVideoCodecCtx, and mVideoStream.

Referenced by VideoAccessObject().

00659     {
00660         mVideoCodecCtx = mVideoStream->codec;
00661         
00662         AVCodec* codec = avcodec_find_decoder(mVideoCodecCtx->codec_id);
00663         if (codec == NULL) 
00664         {
00665             ILOG_ERROR("Codec not found for: " << mSrcAddress);
00666             return false;
00667         }
00668 
00669         int result = avcodec_open(mVideoCodecCtx, codec);
00670         if (result < 0) 
00671         {
00672             ILOG_ERROR("Could not open codec " << codec->name << " (id: " << 
00673                 codec->id << ") for: " << mSrcAddress << " (" << result << ")");
00674             return false;
00675         }
00676 
00677         mSwsContext = sws_getContext(
00678             mVideoCodecCtx->width, mVideoCodecCtx->height, mVideoCodecCtx->pix_fmt, 
00679             mVideoCodecCtx->width, mVideoCodecCtx->height, PIX_FMT_RGB24, 
00680             SWS_BICUBIC, NULL, NULL, NULL);
00681 
00682         if (mSwsContext == NULL) 
00683         {
00684             ILOG_ERROR("Failed to initialize image conversion context for: " << 
00685                 mSrcAddress);
00686             return false;
00687         }
00688 
00689         if (codec != mVideoCodecCtx->codec)
00690         {
00691             ILOG_ERROR("Codec found is not same as codec stored (" << 
00692                 MakeString(codec->id) << " vs. " << 
00693                 MakeString(mVideoCodecCtx->codec->id) << ") for: " << 
00694                 mSrcAddress);
00695         }
00696 
00697         return true;
00698     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:18:42 2010 for ImpalaSrc by  doxygen 1.5.1