[aravis/timeout-resend: 1/4] gv_stream: requires packet size.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [aravis/timeout-resend: 1/4] gv_stream: requires packet size.
- Date: Tue, 1 Mar 2011 10:21:46 +0000 (UTC)
commit a50a3f4ae5fc21b529a02b6a6bc5e2309aea6560
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Tue Feb 22 13:05:22 2011 +0100
gv_stream: requires packet size.
src/arvgvdevice.c | 24 ++++++++++++++++++++++--
src/arvgvstream.c | 6 +++++-
src/arvgvstream.h | 3 ++-
3 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/arvgvdevice.c b/src/arvgvdevice.c
index 5d37182..e5c758f 100644
--- a/src/arvgvdevice.c
+++ b/src/arvgvdevice.c
@@ -331,6 +331,20 @@ arv_gv_device_get_timestamp_tick_frequency (ArvGvDevice *gv_device)
return 0;
}
+guint
+arv_gv_device_get_packet_size (ArvGvDevice *gv_device)
+{
+ guint32 packet_size;
+
+ g_return_val_if_fail (ARV_IS_GV_DEVICE (gv_device), 0);
+
+ arv_device_read_register (ARV_DEVICE (gv_device),
+ ARV_GVBS_FIRST_STREAM_CHANNEL_PACKET_SIZE,
+ &packet_size);
+
+ return packet_size;
+}
+
static char *
_load_genicam (ArvGvDevice *gv_device, guint32 address, size_t *size)
{
@@ -461,6 +475,7 @@ arv_gv_device_create_stream (ArvDevice *device, ArvStreamCallback callback, void
ArvStream *stream;
const guint8 *address_bytes;
guint32 stream_port;
+ guint packet_size;
GInetAddress *interface_address;
GInetAddress *device_address;
@@ -468,13 +483,18 @@ 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);
+ packet_size = arv_gv_device_get_packet_size (gv_device);
+
+ arv_debug ("device", "[GvDevice::create_stream] Packet size = %d byte(s)", packet_size);
+
stream = arv_gv_stream_new (device_address, 0, callback, user_data,
- arv_gv_device_get_timestamp_tick_frequency (gv_device));
+ arv_gv_device_get_timestamp_tick_frequency (gv_device), packet_size);
stream_port = arv_gv_stream_get_port (ARV_GV_STREAM (stream));
arv_device_write_register (device, ARV_GVBS_FIRST_STREAM_CHANNEL_PACKET_SIZE, 0x000005dc);
- arv_device_write_register (device, ARV_GVBS_FIRST_STREAM_CHANNEL_IP_ADDRESS, g_htonl(*((guint32 *) address_bytes)));
+ arv_device_write_register (device, ARV_GVBS_FIRST_STREAM_CHANNEL_IP_ADDRESS,
+ g_htonl(*((guint32 *) address_bytes)));
arv_device_write_register (device, ARV_GVBS_FIRST_STREAM_CHANNEL_PORT, stream_port);
arv_device_read_register (device, ARV_GVBS_FIRST_STREAM_CHANNEL_PORT, &stream_port);
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index 5bcb73a..9ade9e1 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -60,6 +60,7 @@ typedef struct {
ArvGvStreamPacketResend packet_resend;
guint64 timestamp_tick_frequency;
+ guint packet_size;
gboolean cancel;
@@ -413,7 +414,8 @@ arv_gv_stream_get_port (ArvGvStream *gv_stream)
ArvStream *
arv_gv_stream_new (GInetAddress *device_address, guint16 port,
ArvStreamCallback callback, void *user_data,
- guint64 timestamp_tick_frequency)
+ guint64 timestamp_tick_frequency,
+ guint packet_size)
{
ArvGvStream *gv_stream;
ArvStream *stream;
@@ -421,6 +423,7 @@ arv_gv_stream_new (GInetAddress *device_address, guint16 port,
ArvGvStreamThreadData *thread_data;
g_return_val_if_fail (G_IS_INET_ADDRESS (device_address), NULL);
+ g_return_val_if_fail (packet_size > 0, NULL);
gv_stream = g_object_new (ARV_TYPE_GV_STREAM, NULL);
@@ -444,6 +447,7 @@ arv_gv_stream_new (GInetAddress *device_address, guint16 port,
thread_data->device_address = g_inet_socket_address_new (device_address, ARV_GVCP_PORT);
thread_data->packet_resend = ARV_GV_STREAM_PACKET_RESEND_ALWAYS;
thread_data->timestamp_tick_frequency = timestamp_tick_frequency;
+ thread_data->packet_size = packet_size;
thread_data->cancel = FALSE;
thread_data->packet_count = 1;
diff --git a/src/arvgvstream.h b/src/arvgvstream.h
index e2d7880..f614fb2 100644
--- a/src/arvgvstream.h
+++ b/src/arvgvstream.h
@@ -78,7 +78,8 @@ GType arv_gv_stream_get_type (void);
ArvStream * arv_gv_stream_new (GInetAddress *device_address, guint16 port,
ArvStreamCallback callback, void *user_data,
- guint64 timestamp_tick_frequency);
+ guint64 timestamp_tick_frequency,
+ guint packet_size);
guint16 arv_gv_stream_get_port (ArvGvStream *gv_stream);
void arv_gv_stream_get_statistics (ArvGvStream *gv_stream,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]