[aravis] viewer: start implementation of a video stream viewer.



commit 095aae1bb39af5d27d659264abe1e2d75c3c70a8
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Jan 2 23:24:45 2011 +0100

    viewer: start implementation of a video stream viewer.

 Makefile.am          |    4 +
 configure.ac         |   29 ++++++-
 gst/Makefile.am      |    6 +-
 tests/Makefile.am    |    4 +-
 viewer/.gitignore    |    1 +
 viewer/Makefile.am   |   22 +++++
 viewer/arv-viewer.ui |  214 ++++++++++++++++++++++++++++++++++++++++++++++++++
 viewer/arvviewer.c   |   30 +++++++
 8 files changed, 303 insertions(+), 7 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 85f52af..f49fea0 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,10 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc
 
 SUBDIRS = src gst tests po docs
 
+if ARAVIS_VIEWER
+SUBDIRS += viewer
+endif
+
 aravisdocdir = ${prefix}/doc/aravis
 aravisdoc_DATA = 	\
 	README		\
diff --git a/configure.ac b/configure.ac
index da48f40..184008f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -32,6 +32,10 @@ AC_ARG_ENABLE(cairo,
 	      [  --enable-cairo          Enable cairo support],
 	      [enable_cairo=$enableval],
 	      [enable_cairo=no])
+AC_ARG_ENABLE(gtk,
+	      [  --enable-gtk            Enable gtk support],
+	      [enable_gtk=$enableval],
+	      [enable_gtk=no])
 AC_ARG_ENABLE(gstreamer,
 	      [  --enable-gstreamer      Enable gstreamer support],
 	      [enable_gstreamer=$enableval],
@@ -40,27 +44,40 @@ AC_ARG_ENABLE(gstreamer,
 PKG_PROG_PKG_CONFIG([0.14])
 
 ARAVIS_REQUIRES="[gobject-2.0 glib-2.0 >= 2.22 gio-2.0 libxml-2.0 gthread-2.0]"
+ARAVIS_EXTRA_REQUIRES="$(ARAVIS_REQUIRES)"
 
 with_cairo=no
 if test "x$enable_cairo" = "xyes"; then
 	PKG_CHECK_MODULES([CAIRO],   [cairo >= 1.2],
 			  [AC_DEFINE([ARAVIS_WITH_CAIRO], [1], [Cairo support])
-			  ARAVIS_REQUIRES="${ARAVIS_REQUIRES} [cairo >= 1.2]"
+			  ARAVIS_EXTRA_REQUIRES="${ARAVIS_EXTRA_REQUIRES} [cairo >= 1.2]"
 			  with_cairo=yes],
 			  [echo -n])
 fi
 AM_CONDITIONAL(ARAVIS_WITH_CAIRO, test "x$with_cairo" = "xyes")
 
+with_gtk=no
+if test "x$enable_gtk" = "xyes"; then
+	PKG_CHECK_MODULES([GTK],   [gtk+-2.0 >= 2.12],
+			  [AC_DEFINE([ARAVIS_WITH_GTK], [1], [Gtk support])
+			  ARAVIS_EXTRA_REQUIRES="${ARAVIS_EXTRA_REQUIRES} [gtk+-2.0 >= 2.12]"
+			  with_gtk=yes],
+			  [echo -n])
+fi
+AM_CONDITIONAL(ARAVIS_WITH_GTK, test "x$with_gtk" = "xyes")
+
 with_gstreamer=no
 if test "x$enable_gstreamer" = "xyes"; then
 	PKG_CHECK_MODULES([GSTREAMER],   [gstreamer-base-0.10 >= 0.10],
 			  [AC_DEFINE([ARAVIS_WITH_GSTREAMER], [1], [Cairo support])
-			  ARAVIS_REQUIRES="${ARAVIS_REQUIRES} [gstreamer-base-0.10 >= 0.10]"
+			  ARAVIS_EXTRA_REQUIRES="${ARAVIS_EXTRA_REQUIRES} [gstreamer-base-0.10 >= 0.10]"
 			  with_gstreamer=yes],
 			  [echo -n])
 fi
 AM_CONDITIONAL(ARAVIS_WITH_GSTREAMER, test "x$with_gstreamer" = "xyes")
 
+AM_CONDITIONAL(ARAVIS_VIEWER, test "x$with_gtk$with_gstreamer" = "xyesyes")
+
 if test "x${prefix}" = "x$HOME"; then
   gstplugindir="$HOME/.gstreamer-0.10/plugins"
 else
@@ -78,6 +95,11 @@ PKG_CHECK_MODULES(ARAVIS, $ARAVIS_REQUIRES)
 AC_SUBST(ARAVIS_CFLAGS)
 AC_SUBST(ARAVIS_LIBS)
 
+PKG_CHECK_MODULES(ARAVIS_EXTRA, $ARAVIS_EXTRA_REQUIRES)
+
+AC_SUBST(ARAVIS_EXTRA_CFLAGS)
+AC_SUBST(ARAVIS_EXTRA_LIBS)
+
 AC_PATH_PROG(GLIB_MKENUMS, glib-mkenums)
 
 GOBJECT_INTROSPECTION_CHECK([0.6.7])
@@ -89,6 +111,7 @@ Makefile
 src/Makefile
 gst/Makefile
 tests/Makefile
+viewer/Makefile
 po/Makefile.in
 docs/Makefile
 docs/reference/Makefile
@@ -102,7 +125,9 @@ echo ""
 echo "Configuration:"
 echo ""
 echo "	Cairo support:		$with_cairo"
+echo "	Gtk+ support:           $with_gtk"
 echo "	Gstreamer support:	$with_gstreamer"
 echo "	Compiler:		${CC}"
 echo "	Compiler flags:		${ARAVIS_CFLAGS}"
+echo "	Compiler extra flags:	${ARAVIS_EXTRA_CFLAGS}"
 echo ""
diff --git a/gst/Makefile.am b/gst/Makefile.am
index 15cecec..0cbd358 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/Makefile.decl
 INCLUDES = \
 	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
 	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
-	-DPACKAGE_DATA_DIR=\""$(datadir)"\" $(ARAVIS_CFLAGS) \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" $(ARAVIS_EXTRA_CFLAGS) \
 	-DG_LOG_DOMAIN=\"Aravis\"
 
 AM_CFLAGS =\
@@ -17,8 +17,8 @@ if ARAVIS_WITH_GSTREAMER
 gstplugin_LTLIBRARIES = libgstaravis.la
 
 libgstaravis_la_SOURCES = gstaravis.c gstaravis.h
-libgstaravis_la_CFLAGS = $(ARAVIS_CFLAGS)
-libgstaravis_la_LIBADD = $(ARAVIS_LIBS)
+libgstaravis_la_CFLAGS = $(ARAVIS_EXTRA_CFLAGS)
+libgstaravis_la_LIBADD = $(ARAVIS_EXTRA_LIBS)
 libgstaravis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
 libgstaravis_la_LIBTOOLFLAGS = --tag=disable-static
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 3c97d6b..b1f82d3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,10 +1,10 @@
 include $(top_srcdir)/Makefile.decl
 
-INCLUDES = -g -I$(top_srcdir)/src/ $(ARAVIS_CFLAGS)
+INCLUDES = -g -I$(top_srcdir)/src/ $(ARAVIS_EXTRA_CFLAGS)
 
 test_progs_ldadd = 					\
 	$(top_builddir)/src/libaravis.la		\
-	$(ARAVIS_LIBS)
+	$(ARAVIS_EXTRA_LIBS)
 
 noinst_PROGRAMS = arv-test arv-genicam-test arv-evaluator-test arv-zip-test arv-camera-test
 
diff --git a/viewer/.gitignore b/viewer/.gitignore
new file mode 100644
index 0000000..c0e04c2
--- /dev/null
+++ b/viewer/.gitignore
@@ -0,0 +1 @@
+arv-viewer
diff --git a/viewer/Makefile.am b/viewer/Makefile.am
new file mode 100644
index 0000000..dd2a19f
--- /dev/null
+++ b/viewer/Makefile.am
@@ -0,0 +1,22 @@
+EXTRA_DIST =
+
+include $(top_srcdir)/Makefile.decl
+
+INCLUDES = \
+	-DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+	-DPACKAGE_DATA_DIR=\""$(datadir)"\" $(ARAVIS_EXTRA_CFLAGS) \
+	-DARAVIS_DATA_DIR=\""$(aravis_datadir)"\" \
+	-DG_LOG_DOMAIN=\"Aravis\"
+
+AM_CFLAGS = -Wall
+
+bin_PROGRAMS = arv-viewer
+
+arv_viewer_SOURCES = arvviewer.c
+arv_viewer_LDADD = $(ARAVIS_EXTRA_LIBS) $(top_builddir)/src/libaravis.la
+arv_viewerdir = $(aravis_datadir)
+arv_viewer_DATA = arv-viewer.ui
+
+EXTRA_DIST += $(arv_viewer_DATA)
+
diff --git a/viewer/arv-viewer.ui b/viewer/arv-viewer.ui
new file mode 100644
index 0000000..6528f53
--- /dev/null
+++ b/viewer/arv-viewer.ui
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <!-- interface-requires gtk+ 2.10 -->
+  <!-- interface-naming-policy project-wide -->
+  <object class="GtkWindow" id="main_window">
+    <child>
+      <object class="GtkVBox" id="vbox1">
+        <property name="visible">True</property>
+        <property name="border_width">12</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkComboBox" id="camera_combobox">
+            <property name="visible">True</property>
+            <property name="model">camera_liststore</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkDrawingArea" id="video_drawingarea">
+            <property name="width_request">320</property>
+            <property name="height_request">240</property>
+            <property name="visible">True</property>
+          </object>
+          <packing>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkExpander" id="expander1">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <child>
+              <object class="GtkTable" id="table1">
+                <property name="visible">True</property>
+                <property name="n_rows">3</property>
+                <property name="n_columns">4</property>
+                <property name="column_spacing">6</property>
+                <property name="row_spacing">6</property>
+                <child>
+                  <object class="GtkLabel" id="label2">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Frame rate:</property>
+                  </object>
+                  <packing>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Exposure:</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="xalign">1</property>
+                    <property name="label" translatable="yes">Gain:</property>
+                  </object>
+                  <packing>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="frame_rate_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">â?¢</property>
+                    <property name="width_chars">10</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="exposure_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">â?¢</property>
+                    <property name="width_chars">10</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkEntry" id="gain_entry">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="invisible_char">â?¢</property>
+                    <property name="width_chars">10</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="right_attach">2</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label5">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">Hz</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label6">
+                    <property name="visible">True</property>
+                    <property name="xalign">0</property>
+                    <property name="label" translatable="yes">ms</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label7">
+                    <property name="visible">True</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">2</property>
+                    <property name="right_attach">3</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                    <property name="x_options">GTK_FILL</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHScale" id="frame_rate_hscale">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="draw_value">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHScale" id="exposure_hscale">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="draw_value">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
+                    <property name="top_attach">1</property>
+                    <property name="bottom_attach">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkHScale" id="gain_hscale">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="draw_value">False</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">3</property>
+                    <property name="right_attach">4</property>
+                    <property name="top_attach">2</property>
+                    <property name="bottom_attach">3</property>
+                  </packing>
+                </child>
+              </object>
+            </child>
+            <child type="label">
+              <object class="GtkLabel" id="label1">
+                <property name="visible">True</property>
+                <property name="label" translatable="yes">Settings</property>
+              </object>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+  <object class="GtkListStore" id="camera_liststore"/>
+</interface>
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
new file mode 100644
index 0000000..2782528
--- /dev/null
+++ b/viewer/arvviewer.c
@@ -0,0 +1,30 @@
+#include <gtk/gtk.h>
+#include <stdlib.h>
+
+int
+main (int argc,char *argv[])
+{
+	GtkBuilder *builder;
+	GtkWidget *window;
+	char *ui_filename;
+
+	gtk_init (&argc, &argv);
+
+	builder = gtk_builder_new ();
+
+	ui_filename = g_build_filename (ARAVIS_DATA_DIR, "arv-viewer.ui", NULL);
+	gtk_builder_add_from_file (builder, ui_filename, NULL);
+	g_free (ui_filename);
+
+	window = GTK_WIDGET (gtk_builder_get_object (builder, "main_window"));
+
+	g_signal_connect (window, "destroy", G_CALLBACK (gtk_main_quit), NULL);
+
+	gtk_widget_show_all (window);
+
+	g_object_unref (builder);
+
+	gtk_main ();
+
+	return EXIT_SUCCESS;
+}



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