Definition at line 227 of file mainUtil.cpp. References Impala::Core::VideoSet::Mpeg7Doc::AddShot(), Impala::atol(), Impala::FileNameBase(), 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(). 00228 { 00229 typedef Core::VideoSet::VideoSet VideoSet; 00230 typedef Core::VideoSet::Segmentation Segmentation; 00231 typedef Core::VideoSet::Keyframes Keyframes; 00232 typedef Core::VideoSet::Mpeg7Doc Mpeg7Doc; 00233 00234 ILOG_VAR(Impala.Application.Util.DoExportShotMpeg7); 00235 CmdOptions& options = CmdOptions::GetInstance(); 00236 if (options.GetNrArg() < 5) 00237 { 00238 ILOG_ERROR("Need more parameters"); 00239 return; 00240 } 00241 String videoSetName = options.GetArg(1); 00242 int fractions = Impala::atol(options.GetArg(2)); 00243 if ((fractions != 25) && (fractions != 30000)) 00244 ILOG_WARN("Never tried fractions = " << fractions); 00245 bool generateShotNames = Impala::atol(options.GetArg(3)); 00246 bool withKeyframes = Impala::atol(options.GetArg(4)); 00247 00248 VideoSet* vidSet = Core::VideoSet::MakeVideoSet(videoSetName); 00249 SegmentationLocator sLoc(videoSetName, "segmentation", options); 00250 Segmentation* segmentation = SegmentationRepository().Get(sLoc, vidSet); 00251 KeyframesLocator kLoc(videoSetName, "keyframes", options); 00252 Keyframes* keyframes = KeyframesRepository().Get(kLoc, vidSet); 00253 for (int v=0 ; v<vidSet->NrFiles() ; v++) 00254 { 00255 String fileName = vidSet->GetFile(v); 00256 ILOG_INFO("doing file " << fileName); 00257 String id = fileName; 00258 int nrFrames = segmentation->GetNrFramesVideo(v); 00259 Mpeg7Doc mp7(id, fileName, nrFrames, fractions, withKeyframes, "", ""); 00260 for (int s=0 ; s<segmentation->GetNrShotsVideo(v) ; s++) 00261 { 00262 int shot = segmentation->GetFirstShotVideo(v) + s; 00263 String shotName = (generateShotNames) 00264 ? "shot" + MakeString(v+1) + "_" + MakeString(s+1) 00265 : segmentation->GetName(shot); 00266 if (withKeyframes) 00267 { 00268 std::vector<String> names; 00269 std::vector<int> frames; 00270 for (int k=0 ; k<keyframes->GetNrKeyframesShot(shot) ; k++) 00271 { 00272 int key = keyframes->GetFirstKeyframeShot(shot) + k; 00273 String keyName = (generateShotNames) 00274 ? "shot"+MakeString(v+1)+"_"+MakeString(s+1)+"_RKF" 00275 : Impala::FileNameBase(keyframes->GetName(key)); 00276 names.push_back(keyName); 00277 frames.push_back(keyframes->GetFrameNr(key)); 00278 } 00279 mp7.AddShot(shotName, segmentation->GetStart(shot), 00280 segmentation->GetEnd(shot), names, frames); 00281 } 00282 else 00283 { 00284 mp7.AddShot(shotName, segmentation->GetStart(shot), 00285 segmentation->GetEnd(shot)); 00286 } 00287 } 00288 Core::VideoSet::Mpeg7DocWrite(&mp7, vidSet, v); 00289 } 00290 }
Here is the call graph for this function:
|