MCPcopy Create free account
hub / github.com/MediaArea/MediaInfoLib / ToSeconds

Method ToSeconds

Source/MediaInfo/TimeCode.cpp:860–885  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

858
859//---------------------------------------------------------------------------
860double TimeCode::ToSeconds(bool TimeIsDropFrame) const
861{
862 if (!IsSet())
863 return 0;
864
865 const auto FrameRate = (int64_t)GetFramesMax() + 1;
866 double Result;
867 if (TimeIsDropFrame)
868 {
869 auto SecondsTotal = GetHours() * 3600
870 + GetMinutes() * 60
871 + GetSeconds();
872 const auto Frames = SecondsTotal * FrameRate + GetFrames();
873 Result = ((double)Frames) / FrameRate;
874 }
875 else
876 {
877 Result = ((double)ToFrames()) / FrameRate;
878 if (Is1001fps())
879 Result *= 1.001;
880 }
881 if (IsNegative())
882 Result = -Result;
883
884 return Result;
885}
886
887//***************************************************************************
888//

Callers 6

File_ProbeCaption_SetMethod · 0.80
FileHeader_ParseMethod · 0.80
Data_ParseMethod · 0.80
frameFormat_CheckFunction · 0.80
File_Adm.cppFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected