Reuse the ParseSubTime in TimeFromString.
This commit is contained in:
1 parent
0ef2593efa
commit
2f9de48bdf
2 files changed
+6
-10
No files matched your search
@@ -248,7 +248,10 @@ unsigned ParseSubTime(const char *time, unsigned secondScale, BOOL hasSign)
|
||||
}
|
||||
|
||||
if (sscanf(time, "%u:%u:%u%[,.:]%u", &hour, &minute, &second, separator, &subsecond) < 5) {
|
||||
return 0;
|
||||
subsecond = 0;
|
||||
if (sscanf(time, "%u:%u:%u", &hour, &minute, &second) < 3) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (second > 60) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import "MP42Utilities.h"
|
||||
#import "MP42SubUtilities.h"
|
||||
|
||||
NSString * StringFromTime(long long time, long timeScale)
|
||||
{
|
||||
@@ -32,15 +33,7 @@ NSString * StringFromTime(long long time, long timeScale)
|
||||
|
||||
MP42Duration TimeFromString(NSString *time_string, MP42Duration timeScale)
|
||||
{
|
||||
int hour, minute, second, frame;
|
||||
MP42Duration timeval;
|
||||
|
||||
sscanf([time_string UTF8String], "%d:%02d:%02d.%03d",&hour, &minute, &second, &frame);
|
||||
|
||||
timeval = hour * 60 * 60 + minute * 60 + second;
|
||||
timeval = timeScale * timeval + frame;
|
||||
|
||||
return timeval;
|
||||
return ParseSubTime(time_string.UTF8String, timeScale, NO);
|
||||
}
|
||||
|
||||
BOOL isTrackMuxable(NSString *formatName)
|
||||
|
||||
Reference in new issue
Block a user