/* this parses a name-value pair of npt:xxx, smpte:xxx etc. */ double cmml_sec_parse (const char * str) { char timespec[16]; if (str == NULL) return -1.0; if (sscanf (str, "npt:%16s", timespec) == 1) { return parse_npt (str+4); /* could be longer than 16 :) */ } if (sscanf (str, "smpte-24:%16s", timespec) == 1) { return parse_smpte (str+9, 24.0); } if (sscanf (str, "smpte-24-drop:%16s", timespec) == 1) { return parse_smpte (str+14, 23.976); } if (sscanf (str, "smpte-25:%16s", timespec) == 1) { return parse_smpte (str+9, 25.0); } if (sscanf (str, "smpte-30:%16s", timespec) == 1) { return parse_smpte (str+9, 30.0); } if (sscanf (str, "smpte-30-drop:%16s", timespec) == 1) { return parse_smpte (str+14, 29.97); } if (sscanf (str, "smpte-50:%16s", timespec) == 1) { return parse_smpte (str+9, 50.0); } if (sscanf (str, "smpte-60:%16s", timespec) == 1) { return parse_smpte (str+9, 60); } if (sscanf (str, "smpte-60-drop:%16s", timespec) == 1) { return parse_smpte (str+14, 59.94); } /* default is npt */ return parse_npt(str); }
double anx_parse_time (const char * str) { char timespec[16]; if (str == NULL) return -1.0; if (sscanf (str, "npt:%16s", timespec) == 1) { return parse_npt (timespec); } if (sscanf (str, "smpte-24:%16s", timespec) == 1) { return parse_smpte (timespec, 24.0); } if (sscanf (str, "smpte-24-drop:%16s", timespec) == 1) { return parse_smpte (timespec, 23.976); } if (sscanf (str, "smpte-25:%16s", timespec) == 1) { return parse_smpte (timespec, 25.0); } if (sscanf (str, "smpte-30:%16s", timespec) == 1) { return parse_smpte (timespec, 30.0); } if (sscanf (str, "smpte-30-drop:%16s", timespec) == 1) { return parse_smpte (timespec, 29.97); } if (sscanf (str, "smpte-50:%16s", timespec) == 1) { return parse_smpte (timespec, 50.0); } if (sscanf (str, "smpte-60:%16s", timespec) == 1) { return parse_smpte (timespec, 60); } if (sscanf (str, "smpte-60-drop:%16s", timespec) == 1) { return parse_smpte (timespec, 59.94); } return parse_npt(str); }