[aravis] gv_stream: always set packet_size.



commit b4fae75bcfdb2f291c2a21ae24e01b77470f4c1c
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Thu May 5 11:17:03 2011 +0200

    gv_stream: always set packet_size.
    
    Some cameras have invalid values for packet_size after a reset.
    This pacth always explicitely sets the packet_size value.
    It's a fixed value for now.

 docs/reference/aravis/aravis-sections.txt |    1 +
 src/arvgvdevice.c                         |   14 ++++++++++++--
 src/arvgvdevice.h                         |    2 ++
 3 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/docs/reference/aravis/aravis-sections.txt b/docs/reference/aravis/aravis-sections.txt
index 64a5143..2be6162 100644
--- a/docs/reference/aravis/aravis-sections.txt
+++ b/docs/reference/aravis/aravis-sections.txt
@@ -423,6 +423,7 @@ ARV_GV_DEVICE_GET_CLASS
 <SUBSECTION Private>
 ARV_GV_DEVICE_GVCP_N_RETRIES_DEFAULT
 ARV_GV_DEVICE_GVCP_TIMEOUT_MS_DEFAULT
+ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT
 ARV_GV_DEVICE_BUFFER_SIZE
 ArvGvDeviceClass
 ArvGvDevicePrivate
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index 360a4c5..2737d1e 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -346,6 +346,17 @@ arv_gv_device_get_packet_size (ArvGvDevice *gv_device)
 	return packet_size;
 }
 
+void
+arv_gv_device_set_packet_size (ArvGvDevice *gv_device, guint packet_size)
+{
+	g_return_if_fail (ARV_IS_GV_DEVICE (gv_device));
+	g_return_if_fail (packet_size > 0);
+
+	arv_device_write_register (ARV_DEVICE (gv_device),
+				  ARV_GVBS_STREAM_CHANNEL_0_PACKET_SIZE_OFFSET,
+				  packet_size);
+}
+
 static char *
 _load_genicam (ArvGvDevice *gv_device, guint32 address, size_t  *size)
 {
@@ -484,6 +495,7 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
 	device_address = g_inet_socket_address_get_address (G_INET_SOCKET_ADDRESS (io_data->device_address));
 	address_bytes = g_inet_address_to_bytes (interface_address);
 
+	arv_gv_device_set_packet_size (gv_device, ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT);
 	packet_size = arv_gv_device_get_packet_size (gv_device);
 
 	arv_debug ("device", "[GvDevice::create_stream] Packet size = %d byte(s)", packet_size);
@@ -493,11 +505,9 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
 
 	stream_port = arv_gv_stream_get_port (ARV_GV_STREAM (stream));
 
-	arv_device_write_register (device, ARV_GVBS_STREAM_CHANNEL_0_PACKET_SIZE_OFFSET, 0x000005dc);
 	arv_device_write_register (device, ARV_GVBS_STREAM_CHANNEL_0_IP_ADDRESS_OFFSET,
 				   g_htonl(*((guint32 *) address_bytes)));
 	arv_device_write_register (device, ARV_GVBS_STREAM_CHANNEL_0_PORT_OFFSET, stream_port);
-	arv_device_read_register (device, ARV_GVBS_STREAM_CHANNEL_0_PORT_OFFSET, &stream_port);
 
 	arv_debug ("device", "[GvDevice::create_stream] stream port = %d", stream_port);
 
diff --git a/src/arvgvdevice.h b/src/arvgvdevice.h
index e67bb39..9281f67 100644
--- a/src/arvgvdevice.h
+++ b/src/arvgvdevice.h
@@ -32,6 +32,8 @@ G_BEGIN_DECLS
 #define	ARV_GV_DEVICE_GVCP_N_RETRIES_DEFAULT	5
 #define	ARV_GV_DEVICE_GVCP_TIMEOUT_MS_DEFAULT	500
 
+#define ARV_GV_DEVICE_GVSP_PACKET_SIZE_DEFAULT	1500
+
 #define ARV_TYPE_GV_DEVICE             (arv_gv_device_get_type ())
 #define ARV_GV_DEVICE(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GV_DEVICE, ArvGvDevice))
 #define ARV_GV_DEVICE_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GV_DEVICE, ArvGvDeviceClass))



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