Definition at line 66 of file VideoSetWrapper.h. References Impala::Core::Table::TableTem< Col1T, Col2T, Col3T, Col4T, Col5T, Col6T, Col7T, Col8T, Col9T >::Add(), Impala::Core::Database::RawDataSet::AddFile(), Impala::Core::Array::ArrayListDelete(), CheckFrameSizes(), Impala::Core::IDash::XmlVideo::GetCaseId(), Impala::Core::Database::RawDataSet::GetDatabase(), Impala::Core::Database::RawDataSet::GetFileId(), Impala::Core::IDash::XmlVideo::GetFileName(), Impala::Core::Database::RawDataSet::GetFilePathFrames(), Impala::Core::IDash::XmlShot::GetFrame(), Impala::Core::IDash::XmlVideo::GetFrames(), Impala::Core::IDash::XmlVideo::GetId(), Impala::Core::IDash::XmlVideo::GetLink(), Impala::Core::VideoSet::VideoSet::GetQuidFrame(), Impala::Core::IDash::XmlVideo::GetShotLinkImage(), Impala::Core::IDash::XmlVideo::GetShotLinkXml(), Impala::Core::IDash::XmlVideo::GetShots(), ILOG_ERROR, ILOG_INFO, Impala::Core::IDash::XmlVideo::IsProcessed(), Impala::MakeString(), mKeys, mSegm, mVidSet, mVidTable, Impala::Core::Table::Table::Size(), Impala::Core::IDash::VideoTable::Update(), Impala::Core::VideoSet::Keyframes::Update(), Impala::Core::VideoSet::Segmentation::Update(), Impala::Core::VideoSet::VideoSet::UpdateVideoSet(), Impala::Core::IDash::XmlShot::Valid(), Impala::Core::VideoSet::Keyframes::WriteImageSets(), and Impala::Core::Array::WriteRawListVar(). Referenced by Add(), Impala::Application::IDash::DoProcessAnnotationSet(), and Impala::Application::IDash::mainIDashServer(). 00067 { 00068 int firstShotToAdd = (singleShot >= 0) ? singleShot : 0; 00069 int lastShotToAdd = (singleShot >= 0) ? singleShot+1 : xmlVideo.GetShots(); 00070 String fName = "case_" + xmlVideo.GetCaseId() + "_video_" 00071 + xmlVideo.GetId() + "_file_" + xmlVideo.GetFileName(); 00072 ILOG_INFO("Adding video " << fName << " with " 00073 << lastShotToAdd - firstShotToAdd << " shots"); 00074 if (mVidSet->GetFileId(fName) != -1) 00075 { 00076 ILOG_ERROR("Video " << fName << " already present in set"); 00077 return 0; 00078 } 00079 if (! xmlVideo.IsProcessed()) 00080 { 00081 ILOG_ERROR("Video " << fName << " is not yet processed"); 00082 return 0; 00083 } 00084 if (xmlVideo.GetShots() <= 0) 00085 { 00086 ILOG_ERROR("Video " << fName << " does not have shots"); 00087 return 0; 00088 } 00089 00090 std::vector<int> frames; 00091 std::vector<Array::Array2dScalarUInt8*> imList; 00092 for (int i=firstShotToAdd ; i<lastShotToAdd ; i++) 00093 { 00094 String href = xmlVideo.GetShotLinkXml(i); 00095 XmlShot xmlShot(href); 00096 if (!xmlShot.Valid()) 00097 { 00098 ILOG_ERROR("Shot " << i << " of video " << fName << 00099 " has invalid XML"); 00100 Array::ArrayListDelete(&imList); 00101 return 0; 00102 } 00103 frames.push_back(xmlShot.GetFrame()); 00104 00105 href = xmlVideo.GetShotLinkImage(i); 00106 Link::Curl::Memory mem = Link::Curl::Get(href); 00107 if (mem.size == 0) 00108 { 00109 ILOG_ERROR("Shot " << i << " of video " << fName << 00110 " is missing"); 00111 Array::ArrayListDelete(&imList); 00112 return 0; 00113 } 00114 Array::Array2dScalarUInt8* data = 00115 Array::MakeFromData<Array::Array2dScalarUInt8>((UInt8*) mem.data, 00116 mem.size, 1); 00117 imList.push_back(data); 00118 delete mem.data; 00119 } 00120 frames.push_back(xmlVideo.GetFrames()-1); 00121 CheckFrameSizes(imList); 00122 00123 // data is OK, now really add it 00124 mVidSet->AddFile(fName, -1); 00125 int vidId = mVidSet->GetFileId(fName); 00126 mVidTable->Add(vidId, xmlVideo.GetId(), xmlVideo.GetCaseId(), 00127 xmlVideo.GetLink()); 00128 for (int i=firstShotToAdd ; i<lastShotToAdd ; i++) 00129 { 00130 String sName = "shot_" + MakeString(vidId) + "_" + MakeString(i); 00131 int idx = i - firstShotToAdd; 00132 mSegm->Add(vidId, frames[idx], frames[idx+1]-1, sName); // not ok single 00133 int shotId = mSegm->Size() - 1; 00134 String kName = "keyfr_" + MakeString(vidId) + "_" + MakeString(i); 00135 mKeys->Add(vidId, shotId, frames[idx], kName); 00136 } 00137 00138 mVidSet->UpdateVideoSet(); 00139 mSegm->Update("segmentation"); 00140 mKeys->Update("keyframes"); 00141 mKeys->WriteImageSets(true); 00142 mVidTable->Update("videotable"); 00143 00144 String arName = mVidSet->GetFilePathFrames(vidId, "images.raw", 00145 true, false); 00146 Array::WriteRawListVar(imList, arName, mVidSet->GetDatabase(), true, 00147 true); 00148 Array::ArrayListDelete(&imList); 00149 return mVidSet->GetQuidFrame(vidId, frames[0]); 00150 }
Here is the call graph for this function:
|