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

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

Definition at line 720 of file VideoAccessObject.h.

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

Referenced by VideoAccessObject().

00721     {
00722         mVideoCodecCtx = mVideoStream->codec;
00723         
00724         AVCodec* codec = avcodec_find_decoder(mVideoCodecCtx->codec_id);
00725         if (codec == NULL) 
00726         {
00727             ILOG_ERROR("Codec not found for: " << mSrcAddress);
00728             return false;
00729         }
00730 
00731         int result = avcodec_open(mVideoCodecCtx, codec);
00732         if (result < 0) 
00733         {
00734             ILOG_ERROR("Could not open codec " << codec->name << " (id: " << 
00735                 codec->id << ") for: " << mSrcAddress << " (" << result << ")");
00736             return false;
00737         }
00738 
00739 #ifdef FFMPEG_52
00740         if (sws_isSupportedInput(mVideoCodecCtx->pix_fmt) < 0)
00741         {
00742             ILOG_ERROR("sws conversion does not support pixel format (" << 
00743                 mVideoCodecCtx->pix_fmt << ") of: " << mSrcAddress);
00744             return false;
00745         }
00746 #endif
00747 
00748         mSwsContext = sws_getContext(
00749             mVideoCodecCtx->width, mVideoCodecCtx->height, mVideoCodecCtx->pix_fmt, 
00750             mVideoCodecCtx->width, mVideoCodecCtx->height, PIX_FMT_RGB24, 
00751             SWS_BICUBIC, NULL, NULL, NULL);
00752         if (mSwsContext == NULL) 
00753         {
00754             ILOG_ERROR("Failed to initialize image conversion context for: " << 
00755                 mSrcAddress);
00756             return false;
00757         }
00758 
00759         if (codec != mVideoCodecCtx->codec)
00760         {
00761             ILOG_ERROR("Codec found is not same as codec stored (" << 
00762                 MakeString(codec->id) << " vs. " << 
00763                 MakeString(mVideoCodecCtx->codec->id) << ") for: " << 
00764                 mSrcAddress);
00765         }
00766 
00767         return true;
00768     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:20:39 2011 for ImpalaSrc by  doxygen 1.5.1