[aravis] gv_stream: function for enable/disable packet resend feature.



commit c57b666d3a37942879458a55676fd1f033b9fb84
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Wed May 12 23:40:01 2010 +0200

    gv_stream: function for enable/disable packet resend feature.

 src/arvgvstream.c |   18 ++++++++++++++++--
 src/arvgvstream.h |   12 +++++++++---
 2 files changed, 25 insertions(+), 5 deletions(-)
---
diff --git a/src/arvgvstream.c b/src/arvgvstream.c
index 6993c08..6919101 100644
--- a/src/arvgvstream.c
+++ b/src/arvgvstream.c
@@ -42,6 +42,8 @@ typedef struct {
 	GSocket *socket;
 	GSocketAddress *device_address;
 
+	ArvGvStreamPacketResend packet_resend;
+
 	guint64 timestamp_tick_frequency;
 
 	gboolean cancel;
@@ -269,8 +271,9 @@ _process_data_block (ArvGvStreamThreadData *thread_data, ArvGvStreamThreadState
 		thread_data->n_missing_blocks += n_misses;
 		state->n_missing_blocks += n_misses;
 
-		_send_packet_request (thread_data, state->buffer->frame_id,
-				      state->last_block_id + 1, block_id - 1);
+		if (thread_data->packet_resend != ARV_GV_STREAM_PACKET_RESEND_NEVER)
+			_send_packet_request (thread_data, state->buffer->frame_id,
+					      state->last_block_id + 1, block_id - 1);
 	}
 
 	block_size = arv_gvsp_packet_get_data_size (read_count);
@@ -398,6 +401,16 @@ arv_gv_stream_set_option (ArvGvStream *gv_stream, ArvGvStreamOption option, int
 	}
 }
 
+void arv_gv_stream_set_packet_resend (ArvGvStream *gv_stream, ArvGvStreamPacketResend resend)
+{
+	ArvGvStreamThreadData *thread_data;
+
+	g_return_if_fail (ARV_IS_GV_STREAM (gv_stream));
+
+	thread_data = gv_stream->thread_data;
+	thread_data->packet_resend = resend;
+}
+
 ArvStream *
 arv_gv_stream_new (GInetAddress *device_address, guint16 port,
 		   ArvStreamCallback callback, void *user_data,
@@ -429,6 +442,7 @@ arv_gv_stream_new (GInetAddress *device_address, guint16 port,
 	thread_data->user_data = user_data;
 	thread_data->socket = gv_stream->socket;
 	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->cancel = FALSE;
 	thread_data->input_queue = stream->input_queue;
diff --git a/src/arvgvstream.h b/src/arvgvstream.h
index 4915bab..bcb4239 100644
--- a/src/arvgvstream.h
+++ b/src/arvgvstream.h
@@ -34,6 +34,11 @@ typedef enum {
 	ARV_GV_STREAM_OPTION_SOCKET_BUFFER_AUTO
 } ArvGvStreamOption;
 
+typedef enum {
+	ARV_GV_STREAM_PACKET_RESEND_NEVER,
+	ARV_GV_STREAM_PACKET_RESEND_ALWAYS
+} ArvGvStreamPacketResend;
+
 #define ARV_TYPE_GV_STREAM             (arv_gv_stream_get_type ())
 #define ARV_GV_STREAM(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), ARV_TYPE_GV_STREAM, ArvGvStream))
 #define ARV_GV_STREAM_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), ARV_TYPE_GV_STREAM, ArvGvStreamClass))
@@ -59,12 +64,13 @@ struct _ArvGvStreamClass {
 
 GType arv_gv_stream_get_type (void);
 
-ArvStream * 		arv_gv_stream_new		(GInetAddress *device_address, guint16 port,
+ArvStream * 	arv_gv_stream_new			(GInetAddress *device_address, guint16 port,
 							 ArvStreamCallback callback, void *user_data,
 							 guint64 timestamp_tick_frequency);
-guint16 		arv_gv_stream_get_port		(ArvGvStream *gv_stream);
-void			arv_gv_stream_set_option	(ArvGvStream *gv_stream, ArvGvStreamOption option,
+guint16 	arv_gv_stream_get_port			(ArvGvStream *gv_stream);
+void		arv_gv_stream_set_option		(ArvGvStream *gv_stream, ArvGvStreamOption option,
 							 int value);
+void		arv_gv_stream_set_packet_resend 	(ArvGvStream *gv_stream, ArvGvStreamPacketResend resend);
 
 G_END_DECLS
 



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