mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 07:45:00 +01:00
add timecode format parser
git-svn-id: svn://localhost/ardour2/branches/3.0@13479 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
1f1cba3814
commit
55c7a3bf01
2 changed files with 20 additions and 0 deletions
|
|
@ -623,6 +623,24 @@ std::string timecode_format_sampletime (
|
||||||
return timecode_format_time(t);
|
return timecode_format_time(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool parse_timecode_format(std::string tc, Timecode::Time &TC) {
|
||||||
|
char negative[2];
|
||||||
|
char ignored[2];
|
||||||
|
TC.subframes = 0;
|
||||||
|
if (sscanf (tc.c_str(), "%[- ]%" PRId32 ":%" PRId32 ":%" PRId32 "%[:;]%" PRId32,
|
||||||
|
negative, &TC.hours, &TC.minutes, &TC.seconds, ignored, &TC.frames) != 6) {
|
||||||
|
TC.hours = TC.minutes = TC.seconds = TC.frames = 0;
|
||||||
|
TC.negative = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (negative[0]=='-') {
|
||||||
|
TC.negative = true;
|
||||||
|
} else {
|
||||||
|
TC.negative = false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
timecode_to_sample(
|
timecode_to_sample(
|
||||||
Timecode::Time& timecode, int64_t& sample,
|
Timecode::Time& timecode, int64_t& sample,
|
||||||
|
|
|
||||||
|
|
@ -112,6 +112,8 @@ std::string timecode_format_sampletime (
|
||||||
double timecode_frames_per_second, bool timecode_drop_frames
|
double timecode_frames_per_second, bool timecode_drop_frames
|
||||||
);
|
);
|
||||||
|
|
||||||
|
bool parse_timecode_format(std::string tc, Timecode::Time &TC);
|
||||||
|
|
||||||
void
|
void
|
||||||
timecode_to_sample(
|
timecode_to_sample(
|
||||||
Timecode::Time& timecode, int64_t& sample,
|
Timecode::Time& timecode, int64_t& sample,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue