drivers/video: add timestamp support

Add support for timestamp and change in related drivers

Signed-off-by: Peter Bee <bijunda1@xiaomi.com>
This commit is contained in:
Peter Bee
2023-02-06 17:08:31 +08:00
committed by Xiang Xiao
parent 74ce3b81d3
commit 2ebccd82b6
4 changed files with 23 additions and 9 deletions
+6 -1
View File
@@ -46,6 +46,7 @@ typedef struct
imgdata_capture_t capture_cb;
uint32_t buf_size;
uint8_t *next_buf;
struct timeval *next_ts;
struct host_video_dev_s *vdev;
} sim_video_priv_t;
@@ -336,6 +337,8 @@ int sim_video_uninitialize(void)
void sim_video_loop(void)
{
sim_video_priv_t *priv = &g_sim_video_priv;
struct timespec ts;
struct timeval tv;
int ret;
if (priv->next_buf)
@@ -343,7 +346,9 @@ void sim_video_loop(void)
ret = host_video_dqbuf(priv->vdev, priv->next_buf, priv->buf_size);
if (ret > 0)
{
priv->capture_cb(0, ret);
clock_gettime(CLOCK_MONOTONIC, &ts);
TIMESPEC_TO_TIMEVAL(&tv, &ts);
priv->capture_cb(0, ret, &tv);
}
}
}