mirror of
https://github.com/apache/nuttx.git
synced 2026-06-08 01:42:58 +08:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user