[aravis] gv_stream: frame id is a 16 bit value.



commit e6cbc727dc83b0d404ef18b340aef20ea08bc5ec
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sat May 14 21:57:55 2011 +0200

    gv_stream: frame id is a 16 bit value.

 src/arvfakegvcamera.c |    2 +-
 src/arvgvsp.c         |   11 ++++++-----
 src/arvgvsp.h         |   13 +++++++------
 3 files changed, 14 insertions(+), 12 deletions(-)
---
diff --git a/src/arvfakegvcamera.c b/src/arvfakegvcamera.c
index 7d53f95..177fbd0 100644
--- a/src/arvfakegvcamera.c
+++ b/src/arvfakegvcamera.c
@@ -93,7 +93,7 @@ arv_fake_gv_camera_thread (void *user_data)
 	void *packet_buffer;
 	size_t packet_size;
 	size_t payload = 0;
-	guint32 frame_id = 0;
+	guint16 frame_id = 0;
 	guint16 block_id;
 	ptrdiff_t offset;
 	guint32 gv_packet_size;
diff --git a/src/arvgvsp.c b/src/arvgvsp.c
index 8e799b1..4c02bf0 100644
--- a/src/arvgvsp.c
+++ b/src/arvgvsp.c
@@ -32,7 +32,7 @@
 
 static ArvGvspPacket *
 arv_gvsp_packet_new (ArvGvspPacketType packet_type,
-		     guint32 frame_id, guint32 packet_id, size_t data_size, void *buffer, size_t *buffer_size)
+		     guint16 frame_id, guint32 packet_id, size_t data_size, void *buffer, size_t *buffer_size)
 {
 	ArvGvspPacket *packet;
 	size_t packet_size;
@@ -49,7 +49,8 @@ arv_gvsp_packet_new (ArvGvspPacketType packet_type,
 	else
 		packet = g_malloc (packet_size);
 
-	packet->header.frame_id = g_htonl (frame_id);
+	packet->header.packet_type = 0;
+	packet->header.frame_id = g_htons (frame_id);
 	packet->header.packet_infos = g_htonl ((packet_id & ARV_GVSP_PACKET_INFOS_ID_MASK) |
 					       ((packet_type << ARV_GVSP_PACKET_INFOS_TYPE_POS) &
 						ARV_GVSP_PACKET_INFOS_TYPE_MASK));
@@ -58,7 +59,7 @@ arv_gvsp_packet_new (ArvGvspPacketType packet_type,
 }
 
 ArvGvspPacket *
-arv_gvsp_packet_new_data_leader	(guint32 frame_id, guint32 packet_id,
+arv_gvsp_packet_new_data_leader	(guint16 frame_id, guint32 packet_id,
 				 guint64 timestamp, ArvPixelFormat pixel_format,
 				 guint32 width, guint32 height,
 				 guint32 x_offset, guint32 y_offset,
@@ -87,7 +88,7 @@ arv_gvsp_packet_new_data_leader	(guint32 frame_id, guint32 packet_id,
 }
 
 ArvGvspPacket *
-arv_gvsp_packet_new_data_trailer (guint32 frame_id, guint32 packet_id,
+arv_gvsp_packet_new_data_trailer (guint16 frame_id, guint32 packet_id,
 				  void *buffer, size_t *buffer_size)
 {
 	ArvGvspPacket *packet;
@@ -107,7 +108,7 @@ arv_gvsp_packet_new_data_trailer (guint32 frame_id, guint32 packet_id,
 }
 
 ArvGvspPacket *
-arv_gvsp_packet_new_data_block (guint32 frame_id, guint32 packet_id,
+arv_gvsp_packet_new_data_block (guint16 frame_id, guint32 packet_id,
 				size_t size, void *data,
 				void *buffer, size_t *buffer_size)
 {
diff --git a/src/arvgvsp.h b/src/arvgvsp.h
index 3f57b5c..cdb5b30 100644
--- a/src/arvgvsp.h
+++ b/src/arvgvsp.h
@@ -41,7 +41,8 @@ typedef enum {
 } ArvGvspPacketType;
 
 typedef struct {
-	guint32 frame_id;
+	guint16 packet_type;
+	guint16 frame_id;
 	guint32 packet_infos;
 } __attribute__((__packed__)) ArvGvspHeader;
 
@@ -66,14 +67,14 @@ typedef struct {
 	guint8 data[];
 } ArvGvspPacket;
 
-ArvGvspPacket *		arv_gvsp_packet_new_data_leader		(guint32 frame_id, guint32 packet_id,
+ArvGvspPacket *		arv_gvsp_packet_new_data_leader		(guint16 frame_id, guint32 packet_id,
 								 guint64 timestamp, ArvPixelFormat pixel_format,
 								 guint32 width, guint32 height,
 								 guint32 x_offset, guint32 y_offset,
 								 void *buffer, size_t *buffer_size);
-ArvGvspPacket *		arv_gvsp_packet_new_data_trailer	(guint32 frame_id, guint32 packet_id,
+ArvGvspPacket *		arv_gvsp_packet_new_data_trailer	(guint16 frame_id, guint32 packet_id,
 								 void *buffer, size_t *buffer_size);
-ArvGvspPacket *		arv_gvsp_packet_new_data_block		(guint32 frame_id, guint32 packet_id,
+ArvGvspPacket *		arv_gvsp_packet_new_data_block		(guint16 frame_id, guint32 packet_id,
 								 size_t size, void *data,
 								 void *buffer, size_t *buffer_size);
 char * 			arv_gvsp_packet_to_string 		(const ArvGvspPacket *packet, size_t packet_size);
@@ -93,10 +94,10 @@ arv_gvsp_packet_get_packet_id (const ArvGvspPacket *packet)
 	return g_ntohl (packet->header.packet_infos) & ARV_GVSP_PACKET_INFOS_ID_MASK;
 }
 
-static inline guint32
+static inline guint16
 arv_gvsp_packet_get_frame_id (const ArvGvspPacket *packet)
 {
-	return g_ntohl (packet->header.frame_id);
+	return g_ntohs (packet->header.frame_id);
 }
 
 static inline guint32



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