X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Ftimecode.c;h=7f7363d64724284591e75edd238f4745d5f623b1;hb=HEAD;hp=f5559de3f89778532be23cb67df25d91bd189093;hpb=9511cdf6b08b5a6657ecaee9441cf453d1e0baff;p=melted_gui diff --git a/src/timecode.c b/src/timecode.c index f5559de..7f7363d 100644 --- a/src/timecode.c +++ b/src/timecode.c @@ -42,3 +42,17 @@ char* frames2tc(int f, float fps, char* buf) } +int tc2frames(char* tc, float fps, int *f) +{ + int hh, mm, ss, ff; + + *f = 0; + + if(4 != sscanf(tc, "%d:%d:%d:%d", + &hh, &mm, &ss, &ff)) + return -1; + + *f = ff + fps * (ss + 60 * (mm + 60 * hh)); + + return 0; +}