Definition at line 358 of file mainUtil.cpp. References Impala::Core::VideoSet::Mpeg7Doc::AddShot(), Impala::atol(), Impala::FileNameBase(), Impala::Core::Stream::RgbDataSrc::FrameRateDen(), Impala::Core::Stream::RgbDataSrc::FrameRateNum(), Impala::CmdOptions::GetArg(), Impala::Core::VideoSet::Segmentation::GetEnd(), Impala::Core::VideoSet::Keyframes::GetFirstKeyframeShot(), Impala::Core::VideoSet::Segmentation::GetFirstShotVideo(), Impala::Core::VideoSet::Keyframes::GetFrameNr(), Impala::CmdOptions::GetInstance(), Impala::Core::VideoSet::Keyframes::GetName(), Impala::Core::VideoSet::Segmentation::GetName(), Impala::CmdOptions::GetNrArg(), Impala::Core::VideoSet::Segmentation::GetNrFramesVideo(), Impala::Core::VideoSet::Keyframes::GetNrKeyframesShot(), Impala::Core::VideoSet::Segmentation::GetNrShotsVideo(), Impala::Core::VideoSet::Segmentation::GetStart(), ILOG_ERROR, ILOG_INFO, ILOG_VAR, ILOG_WARN, Impala::MakeString(), Impala::Core::VideoSet::MakeVideoSet(), and Impala::Core::VideoSet::Mpeg7DocWrite(). Referenced by mainUtil(). 00359 { 00360 typedef Core::VideoSet::VideoSet VideoSet; 00361 typedef Core::VideoSet::Segmentation Segmentation; 00362 typedef Core::VideoSet::Keyframes Keyframes; 00363 typedef Core::VideoSet::Mpeg7Doc Mpeg7Doc; 00364 00365 ILOG_VAR(Impala.Application.Util.DoExportShotMpeg7); 00366 CmdOptions& options = CmdOptions::GetInstance(); 00367 if (options.GetNrArg() < 5) 00368 { 00369 ILOG_ERROR("Need more parameters"); 00370 return; 00371 } 00372 String videoSetName = options.GetArg(1); 00373 int fractions = Impala::atol(options.GetArg(2)); 00374 if ((fractions != 25) && (fractions != 30000)) 00375 ILOG_WARN("Never tried fractions = " << fractions); 00376 bool generateShotNames = Impala::atol(options.GetArg(3)); 00377 bool withKeyframes = Impala::atol(options.GetArg(4)); 00378 00379 VideoSet* vidSet = Core::VideoSet::MakeVideoSet(videoSetName); 00380 SegmentationLocator sLoc(videoSetName, "segmentation", options); 00381 Segmentation* segmentation = SegmentationRepository().Get(sLoc, vidSet); 00382 KeyframesLocator kLoc(videoSetName, "keyframes", options); 00383 Keyframes* keyframes = KeyframesRepository().Get(kLoc, vidSet); 00384 for (int v=0 ; v<vidSet->NrFiles() ; v++) 00385 { 00386 String fileName = vidSet->GetFile(v); 00387 ILOG_INFO("doing file " << fileName); 00388 String id = fileName; 00389 int nrFrames = segmentation->GetNrFramesVideo(v); 00390 int frameRateNum = 0; 00391 int frameRateDen = 0; 00392 if (fractions == 0) 00393 { 00394 Core::Stream::RgbDataSrc* rgbSrc = vidSet->GetVideo(v); 00395 if ((!rgbSrc) || (rgbSrc->FrameRateNum() < 0) 00396 || (rgbSrc->FrameRateDen() < 0)) 00397 { 00398 ILOG_ERROR("Need src with known frame rate"); 00399 continue; 00400 } 00401 frameRateNum = rgbSrc->FrameRateNum(); 00402 frameRateDen = rgbSrc->FrameRateDen(); 00403 if (rgbSrc) 00404 delete rgbSrc; 00405 } 00406 Mpeg7Doc mp7(id, fileName, nrFrames, fractions, withKeyframes, "", "", 00407 frameRateNum, frameRateDen); 00408 for (int s=0 ; s<segmentation->GetNrShotsVideo(v) ; s++) 00409 { 00410 int shot = segmentation->GetFirstShotVideo(v) + s; 00411 String shotName = (generateShotNames) 00412 ? "shot" + MakeString(v+1) + "_" + MakeString(s+1) 00413 : segmentation->GetName(shot); 00414 if (withKeyframes) 00415 { 00416 std::vector<String> names; 00417 std::vector<int> frames; 00418 for (int k=0 ; k<keyframes->GetNrKeyframesShot(shot) ; k++) 00419 { 00420 int key = keyframes->GetFirstKeyframeShot(shot) + k; 00421 String keyName = (generateShotNames) 00422 ? "shot"+MakeString(v+1)+"_"+MakeString(s+1)+"_RKF" 00423 : Impala::FileNameBase(keyframes->GetName(key)); 00424 names.push_back(keyName); 00425 frames.push_back(keyframes->GetFrameNr(key)); 00426 } 00427 mp7.AddShot(shotName, segmentation->GetStart(shot), 00428 segmentation->GetEnd(shot), names, frames); 00429 } 00430 else 00431 { 00432 mp7.AddShot(shotName, segmentation->GetStart(shot), 00433 segmentation->GetEnd(shot)); 00434 } 00435 } 00436 Core::VideoSet::Mpeg7DocWrite(&mp7, vidSet, v); 00437 } 00438 }
Here is the call graph for this function: ![]()
|