From: Anton Mitrofanov Date: Wed, 19 May 2021 16:40:22 +0000 (+0300) Subject: Fix --tcfile-in support X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=88fab191002fa4af4a574395d7dbc4eaa82b657c;p=libx264 Fix --tcfile-in support Accept files created by MKVToolNix version 17.0.0 or newer. --- diff --git a/input/timecode.c b/input/timecode.c index 007bce38..81f12840 100644 --- a/input/timecode.c +++ b/input/timecode.c @@ -100,8 +100,9 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info double *timecodes = NULL; double *fpss = NULL; - ret = fscanf( tcfile_in, "# timecode format v%d", &tcfv ); - FAIL_IF_ERROR( ret != 1 || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" ); + ret = fgets( buff, sizeof(buff), tcfile_in ) != NULL && + (sscanf( buff, "# timecode format v%d", &tcfv ) == 1 || sscanf( buff, "# timestamp format v%d", &tcfv ) == 1); + FAIL_IF_ERROR( !ret || (tcfv != 1 && tcfv != 2), "unsupported timecode format\n" ); #define NO_TIMECODE_LINE (buff[0] == '#' || buff[0] == '\n' || buff[0] == '\r') if( tcfv == 1 ) {