[aravis] viewer: add an option for automatic socket buffer size.



commit 326c0cd260533defec5c50b7b87ef1c685e8cfc5
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Thu Apr 14 09:33:01 2011 +0200

    viewer: add an option for automatic socket buffer size.

 viewer/arvviewer.c |   16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index fb0a2b7..a7c6ba4 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -29,6 +29,9 @@
 #include <stdlib.h>
 #include <math.h>
 
+static char *arv_viewer_option_debug_domains = NULL;
+static gboolean arv_viewer_auto_socket_buffer = FALSE;
+
 typedef struct {
 	ArvCamera *camera;
 	ArvDevice *device;
@@ -361,6 +364,13 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
 	g_free (camera_id);
 
 	viewer->stream = arv_camera_create_stream (viewer->camera, NULL, NULL);
+	if (ARV_IS_GV_STREAM (viewer->stream)) {
+		if (arv_viewer_auto_socket_buffer)
+			g_object_set (viewer->stream,
+				      "socket-buffer", ARV_GV_STREAM_SOCKET_BUFFER_AUTO,
+				      "socket-buffer-size", 0,
+				      NULL);
+	}
 	arv_stream_set_emit_signals (viewer->stream, TRUE);
 	payload = arv_camera_get_payload (viewer->camera);
 	for (i = 0; i < 50; i++)
@@ -528,14 +538,16 @@ arv_viewer_new (void)
 	return viewer;
 }
 
-static char *arv_viewer_option_debug_domains = NULL;
-
 static const GOptionEntry arv_viewer_option_entries[] =
 {
 	{
 		"debug", 				'd', 0, G_OPTION_ARG_STRING,
 		&arv_viewer_option_debug_domains, 	"Debug domains", NULL
 	},
+	{
+		"auto",					'a', 0, G_OPTION_ARG_NONE,
+		&arv_viewer_auto_socket_buffer,		"Auto socket buffer size", NULL
+	},
 	{ NULL }
 };
 



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