From 96c4835b29b83f9a3eb1cb6b56bc161658b59ecb Mon Sep 17 00:00:00 2001 From: Anton Mitrofanov Date: Sun, 28 Nov 2010 01:05:02 +0300 Subject: [PATCH] Fix --tcfile-in if timecode v2 file starts from nonzero pts --- input/timecode.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/input/timecode.c b/input/timecode.c index 0158caae..4d9540d8 100644 --- a/input/timecode.c +++ b/input/timecode.c @@ -239,6 +239,7 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info fgets( buff, sizeof(buff), tcfile_in ); ret = sscanf( buff, "%lf", &timecodes[0] ); + timecodes[0] *= 1e-3; /* Timecode format v2 is expressed in milliseconds. */ FAIL_IF_ERROR( ret != 1, "invalid input tcfile for frame 0\n" ) for( num = 1; num < timecodes_num; ) { @@ -310,11 +311,10 @@ static int parse_tcfile( FILE *tcfile_in, timecode_hnd_t *h, video_info_t *info h->pts = malloc( h->stored_pts_num * sizeof(int64_t) ); if( !h->pts ) goto fail; - h->pts[0] = 0; - for( num = 1; num < h->stored_pts_num; num++ ) + for( num = 0; num < h->stored_pts_num; num++ ) { h->pts[num] = timecodes[num] * ((double)h->timebase_den / h->timebase_num) + 0.5; - FAIL_IF_ERROR( h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num ) + FAIL_IF_ERROR( num > 0 && h->pts[num] <= h->pts[num - 1], "invalid timebase or timecode for frame %d\n", num ) } free( timecodes ); -- 2.47.3