Definition at line 455 of file RgbDataSrcLavc_old.h. References ILOG_INFO, and Impala::MakeString(). Referenced by Init(). 00456 { 00457 // Get a pointer to the codec context for the video stream 00458 mCodecCtx = mVideoStream->codec; 00459 00460 // Find the decoder for the video stream 00461 mCodec = avcodec_find_decoder(mCodecCtx->codec_id); 00462 if (mCodec == NULL) 00463 throw LAVCException("Codec not found for: " + mSrcName, 0); 00464 00465 // Open codec 00466 if (avcodec_open(mCodecCtx, mCodec) < 0) 00467 throw LAVCException("Could not open codec (id=" + 00468 MakeString(mCodecCtx->codec_id) + ", name=" + 00469 mCodecName + ") for: " + mSrcName, 0); 00470 00471 mFrameWidth = mCodecCtx->width; 00472 mFrameHeight = mCodecCtx->height; 00473 00474 mAspectRatioNum = mCodecCtx->sample_aspect_ratio.num; 00475 mAspectRatioDen = mCodecCtx->sample_aspect_ratio.den; 00476 00477 mGopSize = mCodecCtx->gop_size; 00478 00479 // setup image conversion context 00480 mSwsContext = sws_getContext( 00481 mFrameWidth, mFrameHeight, mCodecCtx->pix_fmt, 00482 mFrameWidth, mFrameHeight, PIX_FMT_RGB24, 00483 SWS_BICUBIC, NULL, NULL, NULL); 00484 if (mSwsContext == NULL) 00485 throw LAVCException( 00486 "Failed to initialize image conversion context for: " + 00487 mSrcName, 0); 00488 00489 00490 char buf[5]; 00491 #ifdef WIN32 00492 _snprintf( 00493 #else 00494 snprintf( 00495 #endif 00496 buf, sizeof(buf), "%c%c%c%c", 00497 mCodecCtx->codec_tag & 0xff, 00498 (mCodecCtx->codec_tag >> 8) & 0xff, 00499 (mCodecCtx->codec_tag >> 16) & 0xff, 00500 (mCodecCtx->codec_tag >> 24) & 0xff); 00501 mCodecTag = buf; 00502 00503 00504 mCodecName = mCodec->name; 00505 00506 ILOG_INFO("Opened codec (id=" << mCodecCtx->codec_id << 00507 ", name=" << mCodecName << ") for: " << mSrcName); 00508 00509 if (mCodecName == "mpeg1video") 00510 { 00511 // "mpeg1video" is troublesome with presentation timestamps, 00512 SetJumpMethod("pos"); 00513 } 00514 00515 return true; 00516 }
Here is the call graph for this function:
|