MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / read_time_from_string

Function read_time_from_string

libhb/decsrtsub.c:68–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66};
67
68static int
69read_time_from_string( const char* timeString, struct start_and_end *result )
70{
71 // for ex. 00:00:15,248 --> 00:00:16,545
72
73 long hours1, minutes1, seconds1, milliseconds1,
74 hours2, minutes2, seconds2, milliseconds2;
75 int scanned;
76
77 scanned = sscanf(timeString, "%ld:%ld:%ld,%ld --> %ld:%ld:%ld,%ld\n",
78 &hours1, &minutes1, &seconds1, &milliseconds1,
79 &hours2, &minutes2, &seconds2, &milliseconds2);
80 if (scanned != 8)
81 {
82 scanned = sscanf(timeString, "%ld:%ld:%ld.%ld --> %ld:%ld:%ld.%ld\n",
83 &hours1, &minutes1, &seconds1, &milliseconds1,
84 &hours2, &minutes2, &seconds2, &milliseconds2);
85 if (scanned != 8)
86 {
87 return 0;
88 }
89 }
90 result->start =
91 milliseconds1 + seconds1*1000 + minutes1*60*1000 + hours1*60*60*1000;
92 result->end =
93 milliseconds2 + seconds2*1000 + minutes2*60*1000 + hours2*60*60*1000;
94 return 1;
95}
96
97static int utf8_fill( hb_work_private_t * pv )
98{

Callers 1

srt_readFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected