diff options
author | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-03-11 21:57:09 +0100 |
---|---|---|
committer | Alfred E. Heggestad <alfred.heggestad@gmail.com> | 2018-04-07 12:25:39 +0200 |
commit | 09c1b0287be9a7c33dffb11d2bad9286142be3a2 (patch) | |
tree | 80c3fda138c96b0dcc76135bbf36134af1c0252b /src | |
parent | b3bd9972e0633451eecff834297d3cc139d69b4b (diff) |
vidsrc: add timestamp to the frame API
timestamps for v4l and v4l2
test: add timestamp to vidsrc mock
v4l2: print framerate
vidloop: save timestamps and print duration
test with timebase of 65536
v4l2: scale timestamp to VIDEO_TIMEBASE
minor fixes
Diffstat (limited to 'src')
-rw-r--r-- | src/video.c | 5 | ||||
-rw-r--r-- | src/vidutil.c | 6 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/video.c b/src/video.c index 4caf728..e21b626 100644 --- a/src/video.c +++ b/src/video.c @@ -453,10 +453,13 @@ static void encode_rtp_send(struct vtx *vtx, struct vidframe *frame) * * @note This function has REAL-TIME properties */ -static void vidsrc_frame_handler(struct vidframe *frame, void *arg) +static void vidsrc_frame_handler(struct vidframe *frame, uint64_t timestamp, + void *arg) { struct vtx *vtx = arg; + /* XXX: save timestamp(s) and pass to encoder */ + ++vtx->frames; ++vtx->stats.src_frames; diff --git a/src/vidutil.c b/src/vidutil.c index abdddf7..4df0d73 100644 --- a/src/vidutil.c +++ b/src/vidutil.c @@ -50,3 +50,9 @@ double video_calc_seconds(uint64_t rtp_ts) return timestamp; } + + +double video_timestamp_to_seconds(uint64_t timestamp) +{ + return (double)timestamp / (double)VIDEO_TIMEBASE; +} |