[aravis] fake-gv-camera: fix image timestamp.



commit 9a596ae989ae755adb4e205db8d9e129d4c491bc
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sat Jun 5 19:14:19 2010 +0200

    fake-gv-camera: fix image timestamp.

 src/arvfakecamera.c |    5 ++++-
 src/arvgvsp.c       |    4 ++--
 2 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/arvfakecamera.c b/src/arvfakecamera.c
index 241219b..32e89fc 100644
--- a/src/arvfakecamera.c
+++ b/src/arvfakecamera.c
@@ -185,7 +185,7 @@ arv_fake_camera_fill_buffer (ArvFakeCamera *camera, ArvBuffer *buffer)
 	buffer->width = width;
 	buffer->height = height;
 	buffer->status = ARV_BUFFER_STATUS_SUCCESS;
-	buffer->timestamp_ns = time.tv_sec * 1000000000LL + time.tv_nsec;
+	buffer->timestamp_ns = ((guint64) time.tv_sec) * 1000000000LL + time.tv_nsec;
 	buffer->frame_id = camera->priv->frame_id++;
 	buffer->pixel_format = _get_register (camera, ARV_FAKE_CAMERA_REGISTER_PIXEL_FORMAT);
 
@@ -346,6 +346,9 @@ arv_fake_camera_new (const char *serial_number)
 	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_GAIN_RAW, 0);
 	arv_fake_camera_write_register (fake_camera, ARV_FAKE_CAMERA_REGISTER_GAIN_MODE, 0);
 
+	arv_fake_camera_write_register (fake_camera, ARV_GVBS_TIMESTAMP_TICK_FREQUENCY_HIGH, 0);
+	arv_fake_camera_write_register (fake_camera, ARV_GVBS_TIMESTAMP_TICK_FREQUENCY_LOW, 1000000000);
+
 	return fake_camera;
 }
 
diff --git a/src/arvgvsp.c b/src/arvgvsp.c
index f9cf186..326c884 100644
--- a/src/arvgvsp.c
+++ b/src/arvgvsp.c
@@ -73,8 +73,8 @@ arv_gvsp_packet_new_data_leader	(guint32 frame_id, guint16 block_id,
 
 		leader = (ArvGvspDataLeader *) &packet->data;
 		leader->data0 = 0;
-		leader->timestamp_high = g_htonl ((guint64) (timestamp / 1000000000LL));
-		leader->timestamp_low  = g_htonl ((guint64) (timestamp % 1000000000LL));
+		leader->timestamp_high = g_htonl (((guint64) timestamp >> 32));
+		leader->timestamp_low  = g_htonl ((guint64) timestamp & 0xffffffff);
 		leader->pixel_format = g_htonl (pixel_format);
 		leader->width = g_htonl (width);
 		leader->height = g_htonl (height);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]