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