[MPlayer-dev-eng] [PATCH] use correct type of timestamps when recording from v4l2, fix #2176

Ivan Kalvachev ikalvachev at gmail.com
Thu Mar 27 22:07:00 CET 2014

On 3/4/14, Jarek Czekalski <jarekczek at poczta.onet.pl> wrote:
> Mencoder should detect whether timestamps used by v4l2 come from
> monotonic or realtime clock. This is important for Linux kernels >=3.10.
> Details in bug report #2176 [1]
> Patch for stream/tvi_v4l2.c against r36970 attached.
> [1] https://trac.mplayerhq.hu/ticket/2176

At first look the patch looks OK.
I have one nitpick, according to the man page, clock_gettime() comes
from POSIX.1-2001.

We already define POSIX_C_SOURCE=200112, so it should be available by
default, but it might need "-lrt" for linking for version prior to
glibc 2.17 .

It might be good idea to have a configure check for the library . Also
the detection and/or _POSIX_TIMERS (from unistd.h) should be used to
implement fallback to gettimeofday() .
Otherwise this change might break the build on older systems.

In few days I'll test how your current patch works. It would be great
if you can come up with updated patch containing configure check. If
not I guess I'll try to write one myself and commit it separately.

Best Regards.

More information about the MPlayer-dev-eng mailing list