diff --git a/arch/arm/src/cxd56xx/cxd56_cisif.c b/arch/arm/src/cxd56xx/cxd56_cisif.c index 0086457900..c1d0da5e78 100644 --- a/arch/arm/src/cxd56xx/cxd56_cisif.c +++ b/arch/arm/src/cxd56xx/cxd56_cisif.c @@ -373,7 +373,7 @@ static void cisif_callback_for_intlev(uint8_t code) /* Notify and get next addr */ - g_cxd56_cisif_complete_capture(0, size); + g_cxd56_cisif_complete_capture(0, size, NULL); g_jpgint_receive = false; @@ -413,7 +413,7 @@ static void cisif_ycc_axi_trdn_int(uint8_t code) else { size = cisif_reg_read(CISIF_YCC_DSTRG_CONT); - g_cxd56_cisif_complete_capture(0, size); + g_cxd56_cisif_complete_capture(0, size, NULL); cisif_reg_write(CISIF_YCC_DREAD_CONT, 0); } } @@ -463,7 +463,7 @@ static void cisif_jpg_axi_trdn_int(uint8_t code) else { size = cisif_reg_read(CISIF_JPG_DSTRG_CONT); - g_cxd56_cisif_complete_capture(0, size); + g_cxd56_cisif_complete_capture(0, size, NULL); cisif_reg_write(CISIF_JPG_DREAD_CONT, 0); } } @@ -495,7 +495,7 @@ static void cisif_ycc_err_int(uint8_t code) #endif size = cisif_reg_read(CISIF_YCC_DSTRG_CONT); - g_cxd56_cisif_complete_capture(code, size); + g_cxd56_cisif_complete_capture(code, size, NULL); cisif_reg_write(CISIF_YCC_DREAD_CONT, 0); g_errint_receive = true; } @@ -513,7 +513,7 @@ static void cisif_jpg_err_int(uint8_t code) #endif size = cisif_reg_read(CISIF_JPG_DSTRG_CONT); - g_cxd56_cisif_complete_capture(code, size); + g_cxd56_cisif_complete_capture(code, size, NULL); cisif_reg_write(CISIF_JPG_DREAD_CONT, 0); g_errint_receive = true; } diff --git a/arch/sim/src/sim/sim_video.c b/arch/sim/src/sim/sim_video.c index cddb547723..38dfea1eaf 100644 --- a/arch/sim/src/sim/sim_video.c +++ b/arch/sim/src/sim/sim_video.c @@ -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); } } } diff --git a/drivers/video/video.c b/drivers/video/video.c index 923099d681..ec66781efa 100644 --- a/drivers/video/video.c +++ b/drivers/video/video.c @@ -216,7 +216,8 @@ static bool is_sem_waited(FAR sem_t *sem); static int save_scene_param(enum v4l2_scene_mode mode, uint32_t id, struct v4l2_ext_control *control); -static int video_complete_capture(uint8_t err_code, uint32_t datasize); +static int video_complete_capture(uint8_t err_code, uint32_t datasize, + FAR const struct timeval *ts); static int validate_frame_setting(enum v4l2_buf_type type, uint8_t nr_fmt, FAR video_format_t *vfmt, @@ -3226,7 +3227,8 @@ static int video_unregister(FAR video_mng_t *priv) /* Callback function which device driver call when capture has done. */ -static int video_complete_capture(uint8_t err_code, uint32_t datasize) +static int video_complete_capture(uint8_t err_code, uint32_t datasize, + FAR const struct timeval *ts) { FAR video_mng_t *vmng = (FAR video_mng_t *)g_video_handler; FAR video_type_inf_t *type_inf; @@ -3260,6 +3262,11 @@ static int video_complete_capture(uint8_t err_code, uint32_t datasize) } type_inf->bufinf.vbuf_curr->buf.bytesused = datasize; + if (ts != NULL) + { + type_inf->bufinf.vbuf_curr->buf.timestamp = *ts; + } + video_framebuff_capture_done(&type_inf->bufinf); if (is_sem_waited(&type_inf->wait_capture.dqbuf_wait_flg)) diff --git a/include/nuttx/video/imgdata.h b/include/nuttx/video/imgdata.h index 387c9f7ef7..c36290e6e9 100644 --- a/include/nuttx/video/imgdata.h +++ b/include/nuttx/video/imgdata.h @@ -26,6 +26,7 @@ ****************************************************************************/ #include +#include /**************************************************************************** * Pre-processor Definitions @@ -81,7 +82,8 @@ typedef struct imgdata_interval_s uint32_t denominator; } imgdata_interval_t; -typedef int (*imgdata_capture_t)(uint8_t result, uint32_t size); +typedef int (*imgdata_capture_t)(uint8_t result, uint32_t size, + FAR const struct timeval *ts); /* Structure for Data Control I/F */