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

long Impala::Core::VideoSet::Mpeg7Doc::GetMediaDuration ( DOMNode mediaTime  )  [inline, private]

Definition at line 776 of file Mpeg7Doc.h.

References Impala::Util::StringParser::AdvanceP(), Impala::Util::StringParser::Contains(), Impala::Util::StringParser::Eat(), Impala::Util::XmlDoc::GetChildNode(), Impala::Util::XmlDoc::GetElementValue(), and Impala::Util::StringParser::GetInt().

Referenced by AddShot(), and ReadData().

00777     {
00778         DOMNode* duration = GetChildNode(mediaTime, "MediaDuration", true);
00779         String s = GetElementValue(duration);
00780         // e.g. s = PT00H00M04S2122N30000F
00781         Util::StringParser p(s);
00782         p.Eat('T'); // T is begin of duration
00783         long total = 0;
00784         if (p.Contains("H"))
00785         {
00786             total += p.GetInt('H') * 3600;
00787             p.AdvanceP(1);
00788         }
00789         if (p.Contains("M"))
00790         {
00791             total += p.GetInt('M') * 60;
00792             p.AdvanceP(1);
00793         }
00794         if (p.Contains("S"))
00795         {
00796             total += p.GetInt('S');
00797             p.AdvanceP(1);
00798         }
00799         long fractions = p.GetInt('N');
00800         p.AdvanceP(1);
00801         long nrFractions = p.GetInt('F');
00802         long dur = total*nrFractions + fractions;
00803         if (nrFractions == 30000) // probably NTSC with time unit PT1001N30000F
00804             dur /= 1001;
00805         return dur;
00806     }

Here is the call graph for this function:


Generated on Fri Mar 19 11:30:50 2010 for ImpalaSrc by  doxygen 1.5.1