[aravis] gvsp: rename packet_type to content_type.



commit a8741539a1e0c7ee80df9551baa5a39c5689565b
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sat May 14 23:28:43 2011 +0200

    gvsp: rename packet_type to content_type.
    
    packet_type will be the first 2 bytes at the beginning of the
    gvsp packet.

 docs/reference/aravis/aravis-sections.txt |    7 +++--
 src/arvgvsp.c                             |   32 ++++++++++++++--------------
 src/arvgvsp.h                             |   21 ++++++++++---------
 src/arvgvstream.c                         |    8 +++---
 4 files changed, 35 insertions(+), 33 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index ac3820e..fc3f83f 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -949,7 +949,7 @@ arv_gvsp_packet_get_data_size
 arv_gvsp_packet_get_frame_id
 arv_gvsp_packet_get_height
 arv_gvsp_packet_get_packet_id
-arv_gvsp_packet_get_packet_type
+arv_gvsp_packet_get_content_type
 arv_gvsp_packet_get_pixel_format
 arv_gvsp_packet_get_timestamp
 arv_gvsp_packet_get_width
@@ -962,9 +962,10 @@ arv_gvsp_packet_new_data_trailer
 <SUBSECTION Private>
 ArvGvspPacket
 ArvGvspPacketType
+ArvGvspContentType
 ARV_GVSP_PACKET_INFOS_ID_MASK
-ARV_GVSP_PACKET_INFOS_TYPE_MASK
-ARV_GVSP_PACKET_INFOS_TYPE_POS
+ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_MASK
+ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_POS
 ARV_GVSP_PACKET_PROTOCOL_OVERHEAD
 </SECTION>
 
diff --git a/src/arvgvsp.c b/src/arvgvsp.c
index 4c02bf0..c317172 100644
--- a/src/arvgvsp.c
+++ b/src/arvgvsp.c
@@ -31,7 +31,7 @@
 #include <string.h>
 
 static ArvGvspPacket *
-arv_gvsp_packet_new (ArvGvspPacketType packet_type,
+arv_gvsp_packet_new (ArvGvspContentType content_type,
 		     guint16 frame_id, guint32 packet_id, size_t data_size, void *buffer, size_t *buffer_size)
 {
 	ArvGvspPacket *packet;
@@ -52,8 +52,8 @@ arv_gvsp_packet_new (ArvGvspPacketType packet_type,
 	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));
+					       ((content_type << ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_POS) &
+						ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_MASK));
 
 	return packet;
 }
@@ -67,7 +67,7 @@ arv_gvsp_packet_new_data_leader	(guint16 frame_id, guint32 packet_id,
 {
 	ArvGvspPacket *packet;
 
-	packet = arv_gvsp_packet_new (ARV_GVSP_PACKET_TYPE_DATA_LEADER,
+	packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_DATA_LEADER,
 				      frame_id, packet_id, sizeof (ArvGvspDataLeader), buffer, buffer_size);
 
 	if (packet != NULL) {
@@ -93,7 +93,7 @@ arv_gvsp_packet_new_data_trailer (guint16 frame_id, guint32 packet_id,
 {
 	ArvGvspPacket *packet;
 
-	packet = arv_gvsp_packet_new (ARV_GVSP_PACKET_TYPE_DATA_TRAILER,
+	packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_DATA_TRAILER,
 				      frame_id, packet_id, sizeof (ArvGvspDataTrailer), buffer, buffer_size);
 
 	if (packet != NULL) {
@@ -114,7 +114,7 @@ arv_gvsp_packet_new_data_block (guint16 frame_id, guint32 packet_id,
 {
 	ArvGvspPacket *packet;
 
-	packet = arv_gvsp_packet_new (ARV_GVSP_PACKET_TYPE_DATA_BLOCK,
+	packet = arv_gvsp_packet_new (ARV_GVSP_CONTENT_TYPE_DATA_BLOCK,
 				      frame_id, packet_id, size, buffer, buffer_size);
 
 	if (packet != NULL)
@@ -143,36 +143,36 @@ arv_enum_to_string (GType type,
 }
 
 static const char *
-arv_gvsp_packet_type_to_string (ArvGvspPacketType value)
+arv_gvsp_content_type_to_string (ArvGvspContentType value)
 {
-	return arv_enum_to_string (ARV_TYPE_GVSP_PACKET_TYPE, value);
+	return arv_enum_to_string (ARV_TYPE_GVSP_CONTENT_TYPE, value);
 }
 
 char *
 arv_gvsp_packet_to_string (const ArvGvspPacket *packet, size_t packet_size)
 {
 	ArvGvspDataLeader *leader;
-	ArvGvspPacketType packet_type;
+	ArvGvspContentType content_type;
 	GString *string;
 	char *c_string;
 	int i, j, index;
 
 	string = g_string_new ("");
 
-	packet_type = (g_ntohl (packet->header.packet_infos) & ARV_GVSP_PACKET_INFOS_TYPE_MASK) >>
-		ARV_GVSP_PACKET_INFOS_TYPE_POS;
+	content_type = (g_ntohl (packet->header.packet_infos) & ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_MASK) >>
+		ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_POS;
 
-	g_string_append_printf (string, "packet_type  = %s\n", arv_gvsp_packet_type_to_string (packet_type));
+	g_string_append_printf (string, "content_type  = %s\n", arv_gvsp_content_type_to_string (content_type));
 
-	switch (packet_type) {
-		case ARV_GVSP_PACKET_TYPE_DATA_LEADER:
+	switch (content_type) {
+		case ARV_GVSP_CONTENT_TYPE_DATA_LEADER:
 			leader = (ArvGvspDataLeader *) &packet->data;
 			g_string_append_printf (string, "width        = %d\n", g_ntohl (leader->width));
 			g_string_append_printf (string, "height       = %d\n", g_ntohl (leader->height));
 			break;
-		case ARV_GVSP_PACKET_TYPE_DATA_TRAILER:
+		case ARV_GVSP_CONTENT_TYPE_DATA_TRAILER:
 			break;
-		case ARV_GVSP_PACKET_TYPE_DATA_BLOCK:
+		case ARV_GVSP_CONTENT_TYPE_DATA_BLOCK:
 			break;
 	}
 
diff --git a/src/arvgvsp.h b/src/arvgvsp.h
index cdb5b30..e6dad12 100644
--- a/src/arvgvsp.h
+++ b/src/arvgvsp.h
@@ -29,16 +29,16 @@
 G_BEGIN_DECLS
 
 #define ARV_GVSP_PACKET_INFOS_ID_MASK		0x00ffffff
-#define ARV_GVSP_PACKET_INFOS_TYPE_MASK		0xff000000
-#define ARV_GVSP_PACKET_INFOS_TYPE_POS		24
+#define ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_MASK	0xff000000
+#define ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_POS	24
 
 #define ARV_GVSP_PACKET_PROTOCOL_OVERHEAD	(20 + 8 + 8)		/* IP + UDP + GVSP headers */
 
 typedef enum {
-	ARV_GVSP_PACKET_TYPE_DATA_LEADER = 	0x01,
-	ARV_GVSP_PACKET_TYPE_DATA_TRAILER = 	0x02,
-	ARV_GVSP_PACKET_TYPE_DATA_BLOCK =	0x03
-} ArvGvspPacketType;
+	ARV_GVSP_CONTENT_TYPE_DATA_LEADER = 	0x01,
+	ARV_GVSP_CONTENT_TYPE_DATA_TRAILER = 	0x02,
+	ARV_GVSP_CONTENT_TYPE_DATA_BLOCK =	0x03
+} ArvGvspContentType;
 
 typedef struct {
 	guint16 packet_type;
@@ -81,11 +81,12 @@ char * 			arv_gvsp_packet_to_string 		(const ArvGvspPacket *packet, size_t packe
 void 			arv_gvsp_packet_debug 			(const ArvGvspPacket *packet, size_t packet_size,
 								 ArvDebugLevel level);
 
-static inline ArvGvspPacketType
-arv_gvsp_packet_get_packet_type	(const ArvGvspPacket *packet)
+static inline ArvGvspContentType
+arv_gvsp_packet_get_content_type	(const ArvGvspPacket *packet)
 {
-	return (ArvGvspPacketType) ((g_ntohl (packet->header.packet_infos) & ARV_GVSP_PACKET_INFOS_TYPE_MASK) >>
-				    ARV_GVSP_PACKET_INFOS_TYPE_POS);
+	return (ArvGvspContentType) ((g_ntohl (packet->header.packet_infos) &
+					    ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_MASK) >>
+					   ARV_GVSP_PACKET_INFOS_CONTENT_TYPE_POS);
 }
 
 static inline guint16
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index 34a31c4..4174b55 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -595,14 +595,14 @@ arv_gv_stream_thread (void *data)
 						break;
 				frame->last_valid_packet = i - 1;
 
-				switch (arv_gvsp_packet_get_packet_type (packet)) {
-					case ARV_GVSP_PACKET_TYPE_DATA_LEADER:
+				switch (arv_gvsp_packet_get_content_type (packet)) {
+					case ARV_GVSP_CONTENT_TYPE_DATA_LEADER:
 						_process_data_leader (thread_data, frame, packet, packet_id);
 						break;
-					case ARV_GVSP_PACKET_TYPE_DATA_BLOCK:
+					case ARV_GVSP_CONTENT_TYPE_DATA_BLOCK:
 						_process_data_block (thread_data, frame, packet, packet_id, read_count);
 						break;
-					case ARV_GVSP_PACKET_TYPE_DATA_TRAILER:
+					case ARV_GVSP_CONTENT_TYPE_DATA_TRAILER:
 						_process_data_trailer (thread_data, frame, packet, packet_id);
 						break;
 					default:



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