# HG changeset patch # User iive # Date 1402418344 0 # Node ID ca7e13830a059ce80cd978a15b2be861086842de # Parent 6db1f7a108038a08a80388d5c748da2f20dd3884 Allow building of v4l2 without clock_gettime(). Add overly verbose message in case monotone timestamps are required by the kernel. diff -r 6db1f7a10803 -r ca7e13830a05 stream/tvi_v4l2.c --- a/stream/tvi_v4l2.c Tue Jun 10 15:41:02 2014 +0000 +++ b/stream/tvi_v4l2.c Tue Jun 10 16:39:04 2014 +0000 @@ -495,6 +495,7 @@ return 0; } +#if HAVE_CLOCK_GETTIME /* ** Gets current timestamp, using specified clock id. ** @return number of microseconds. @@ -505,6 +506,18 @@ clock_gettime(clk_id, &ts); return (long long)ts.tv_sec * 1000000 + ts.tv_nsec / 1000; } +#else +/* +** Gets current timestamp, using system time. +** @return number of microseconds. +*/ +static long long get_curr_timestamp(int clk_id) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + return (long long)tv.tv_sec * 1000000 + tv.tv_usec; +} +#endif /***********************************************************************\ * * @@ -1549,8 +1562,13 @@ return 0; } priv->map[i].len = priv->map[i].buf.length; +#ifdef HAVE_CLOCK_GETTIME priv->clk_id = (priv->map[i].buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) ? CLOCK_MONOTONIC : CLOCK_REALTIME; +#else + if (priv->map[i].buf.flags & V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC) + mp_msg(MSGT_TV, MSGL_WARN, "MPlayer compiled without clock_gettime() that is needed to handle monotone video timestamps from the kernel. Expect desync.\n"); +#endif /* count up to make sure this is correct everytime */ priv->mapcount++;