objective c - Working with QTTime in milliseconds -
i current time of qtmovieview
so:
qttime time = self.movieview.movie.currenttime;
and put smpte form
nsstring *smpte_string; int days, hour, minute, second, frame; long long result; result = time.timevalue / time.timescale; // second frame = (time.timevalue % time.timescale) / 100; second = result % 60; result = result / 60; // minute minute = result % 60; result = result / 60; // hour hour = result % 24; days = result; smpte_string = [nsstring stringwithformat:@"%02d:%02d:%02d:%02d", hour, minute, second, frame]; // hh:mm:ss:ff
but don't want have end frame number. want end in milliseconds (hh:mm:ss.mil)
the following should work:
double second = (double)time.timevalue / (double)time.timescale; int result = second / 60; second -= 60 * result; int minute = result % 60; result = result / 60; int hour = result % 24; int days = result / 24; nsstring *smpte_string = [nsstring stringwithformat:@"%02d:%02d:%06.3f", hour, minute, second];
the seconds computed double
instead of int
, printed millisecond precision using %06.3f
format.
(note days = result
in code not correct.)
if prefer integer arithmetic can compute milliseconds qttime time
with
long long milli = (1000 * (time.timevalue % time.timescale)) / time.timescale;
Comments
Post a Comment