[aravis] gst: readd gstreamer 0.10 plugin



commit d07a23375cde18313dd0648d2f38b8a388355c8e
Author: Emmanuel Pacaud <emmanuel gnome org>
Date:   Sun Apr 13 18:46:36 2014 +0200

    gst: readd gstreamer 0.10 plugin
    
    Compilation option is enable-gst-0.10-plugin.

 Makefile.am                 |    6 +-
 configure.ac                |   67 ++++-
 gst-0.10/Makefile.am        |   29 ++
 gst-0.10/gst-aravis-inspect |    8 +
 gst-0.10/gst-aravis-launch  |    9 +
 gst-0.10/gstaravis.c        |  730 +++++++++++++++++++++++++++++++++++++++++++
 gst-0.10/gstaravis.h        |   79 +++++
 src/arvmisc.c               |   62 +++-
 src/arvmisc.h               |    1 +
 9 files changed, 965 insertions(+), 26 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 82f25ab..2122cec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -4,7 +4,7 @@ include $(top_srcdir)/Makefile.decl
 
 ACLOCAL_AMFLAGS = -I m4
 
-DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc --enable-gst-plugin --enable-viewer 
--enable-cpp-test
+DISTCHECK_CONFIGURE_FLAGS = --enable-introspection --enable-gtk-doc --enable-gst-plugin 
--enable-gst-0.10-plugin --enable-viewer --enable-cpp-test
 
 SUBDIRS = src
 
@@ -16,6 +16,10 @@ if ARAVIS_BUILD_GST_PLUGIN
 SUBDIRS += gst
 endif
 
+if ARAVIS_BUILD_GST_0_10_PLUGIN
+SUBDIRS += gst-0.10
+endif
+
 SUBDIRS += tests po docs
 
 aravisdocdir = ${prefix}/doc/aravis- ARAVIS_API_VERSION@
diff --git a/configure.ac b/configure.ac
index c3975c8..0cf0179 100644
--- a/configure.ac
+++ b/configure.ac
@@ -31,16 +31,20 @@ IT_PROG_INTLTOOL([0.31.2])
 
 LT_INIT()
 
-AC_ARG_ENABLE(gst_plugin,
-             [  --enable-gst-plugin     build gstreamer plugin],
-             [enable_gst_plugin=$enableval],
-             [enable_gst_plugin=no])
 AC_ARG_ENABLE(viewer,
-             [  --enable-viewer         build viewer],
+             [  --enable-viewer          build viewer],
              [enable_viewer=$enableval],
              [enable_viewer=no])
+AC_ARG_ENABLE(gst_plugin,
+             [  --enable-gst-plugin      build gstreamer plugin],
+             [enable_gst_plugin=$enableval],
+             [enable_gst_plugin=no])
+AC_ARG_ENABLE(gst_0_10_plugin,
+             [  --enable-gst-0.10-plugin build gstreamer-0.10 plugin],
+             [enable_gst_0_10_plugin=$enableval],
+             [enable_gst_0_10_plugin=no])
 AC_ARG_ENABLE(cpp_test,
-             [  --enable-cpp-test       build c++ test],
+             [  --enable-cpp-test        build c++ test],
              [enable_cpp_test=$enableval],
              [enable_cpp_test=no])
 
@@ -48,6 +52,7 @@ PKG_PROG_PKG_CONFIG([0.14])
 
 ARAVIS_REQUIREMENTS="glib-2.0 >= 2.26 gobject-2.0 gio-2.0 libxml-2.0 gthread-2.0 zlib"
 ARAVIS_GSTREAMER_REQUIREMENTS="gstreamer-base-1.0 gstreamer-app-1.0"
+ARAVIS_GSTREAMER_0_10_REQUIREMENTS="gstreamer-base-0.10 gstreamer-app-0.10"
 ARAVIS_VIEWER_REQUIREMENTS="$ARAVIS_GSTREAMER_REQUIREMENTS gstreamer-video-1.0 gtk+-3.0 libnotify"
 
 PKG_CHECK_MODULES(ARAVIS, [$ARAVIS_REQUIREMENTS])
@@ -60,6 +65,9 @@ AC_SUBST(ARAVIS_LIBS)
 
 AC_SUBST(aravis_datadir, '$(datadir)/aravis-$(ARAVIS_API_VERSION)')
 
+# Viewer
+# ======
+
 build_viewer=no
 if test "x$enable_viewer" = "xyes"; then
        PKG_CHECK_MODULES([ARAVIS_VIEWER], [$ARAVIS_VIEWER_REQUIREMENTS],
@@ -75,6 +83,9 @@ ARAVIS_VIEWER_LIBS="-lm ${ARAVIS_VIEWER_LIBS}"
 AC_SUBST(ARAVIS_VIEWER_CFLAGS)
 AC_SUBST(ARAVIS_VIEWER_LIBS)
 
+# GStreamer plugin
+# ================
+
 build_gst_plugin=no
 if test "x$enable_gst_plugin" = "xyes"; then
        PKG_CHECK_MODULES([ARAVIS_GST_PLUGIN], [$ARAVIS_GSTREAMER_REQUIREMENTS],
@@ -97,8 +108,36 @@ else
 fi
 AC_SUBST(gstplugindir)
 
-GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
-AC_SUBST(GST_PLUGIN_LDFLAGS)
+# GStreamer-0.10 plugin
+# =====================
+
+build_gst_0_10_plugin=no
+if test "x$enable_gst_0_10_plugin" = "xyes"; then
+       PKG_CHECK_MODULES([ARAVIS_GST_0_10_PLUGIN], [$ARAVIS_GSTREAMER_0_10_REQUIREMENTS],
+                         [AC_DEFINE([ARAVIS_BUILD_GST_0_10_PLUGIN], [1], [Build gstreamer-0.10 plugin])
+                         build_gst_0_10_plugin=yes],
+                         [echo -n])
+fi
+AM_CONDITIONAL(ARAVIS_BUILD_GST_0_10_PLUGIN, test "x$build_gst_0_10_plugin" = "xyes")
+
+# Standard math library doesn't come with a pkgconfig file.
+ARAVIS_GST_0_10_PLUGIN_LIBS="-lm ${ARAVIS_GST_0_10_PLUGIN_LIBS}"
+
+AC_SUBST(ARAVIS_GST_0_10_PLUGIN_CFLAGS)
+AC_SUBST(ARAVIS_GST_0_10_PLUGIN_LIBS)
+
+if test "x${prefix}" = "x$HOME"; then
+  gst010plugindir="$HOME/.gstreamer-0.10/plugins"
+else
+  gst010plugindir="\$(libdir)/gstreamer-0.10"
+fi
+AC_SUBST(gst010plugindir)
+
+GST_0_10_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
+AC_SUBST(GST_0_10_PLUGIN_LDFLAGS)
+
+# C++ test
+# ========
 
 AM_CONDITIONAL(ARAVIS_BUILD_CPP_TEST, test "x$enable_cpp_test" = "xyes")
 
@@ -119,6 +158,7 @@ src/Makefile
 viewer/Makefile
 viewer/data/arv-viewer.desktop.in
 gst/Makefile
+gst-0.10/Makefile
 tests/Makefile
 po/Makefile.in
 docs/Makefile
@@ -131,10 +171,11 @@ AC_OUTPUT
 echo ""
 echo "Configuration:"
 echo ""
-echo " Compiler:               ${CC}"
-echo " Compiler flags:         ${ARAVIS_CFLAGS}"
-echo " Linker flags:           ${ARAVIS_LIBS}"
+echo "  Compiler:                    ${CC}"
+echo "  Compiler flags:              ${ARAVIS_CFLAGS}"
+echo "  Linker flags:                ${ARAVIS_LIBS}"
 echo ""
-echo " Build viewer:           $build_viewer"
-echo " Build gstreamer plugin: $build_gst_plugin"
+echo "  Build viewer:                $build_viewer"
+echo "  Build gstreamer plugin:      $build_gst_plugin"
+echo "  Build gstreamer-0.10 plugin: $build_gst_0_10_plugin"
 echo ""
diff --git a/gst-0.10/.gitignore b/gst-0.10/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/gst-0.10/Makefile.am b/gst-0.10/Makefile.am
new file mode 100644
index 0000000..4b822fd
--- /dev/null
+++ b/gst-0.10/Makefile.am
@@ -0,0 +1,29 @@
+include $(top_srcdir)/Makefile.decl
+
+AM_CPPFLAGS = \
+       -I$(top_srcdir)/src/ \
+       -DPACKAGE_LOCALE_DIR=\""$(prefix)/$(DATADIRNAME)/locale"\" \
+       -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
+       -DPACKAGE_DATA_DIR=\""$(datadir)"\" $(ARAVIS_GST_0_10_PLUGIN_CFLAGS) \
+       -DG_LOG_DOMAIN=\"Aravis\"
+
+AM_CFLAGS =\
+        -Wall\
+        -Werror \
+        -g \
+        -O0
+
+gst010plugin_LTLIBRARIES = libgstaravis- ARAVIS_API_VERSION@.la
+
+libgstaravis_ ARAVIS_API_VERSION@_la_SOURCES = gstaravis.c gstaravis.h
+libgstaravis_ ARAVIS_API_VERSION@_la_CFLAGS = $(ARAVIS_GST_0_10_PLUGIN_CFLAGS)
+libgstaravis_ ARAVIS_API_VERSION@_la_LIBADD =          \
+       $(ARAVIS_GST_0_10_PLUGIN_LIBS)                  \
+       $(top_builddir)/src/libaravis- ARAVIS_API_VERSION@.la
+libgstaravis_ ARAVIS_API_VERSION@_la_LDFLAGS = $(GST_0_10_PLUGIN_LDFLAGS)
+libgstaravis_ ARAVIS_API_VERSION@_la_LIBTOOLFLAGS = --tag=disable-static
+
+libgstaravis_ ARAVIS_API_VERSION@_ladir = $(includedir)/aravis- ARAVIS_API_VERSION@
+
+noinst_HEADERS = gstaravis.h
+
diff --git a/gst-0.10/gst-aravis-inspect b/gst-0.10/gst-aravis-inspect
new file mode 100755
index 0000000..f871174
--- /dev/null
+++ b/gst-0.10/gst-aravis-inspect
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+exec_prefix=`pwd`
+
+export PATH=${exec_prefix}/bin:${PATH}
+
+gst-inspect-0.10 --gst-plugin-load=../gst-0.10/.libs/libgstaravis-0.4.so $*
+
diff --git a/gst-0.10/gst-aravis-launch b/gst-0.10/gst-aravis-launch
new file mode 100755
index 0000000..0eaff9a
--- /dev/null
+++ b/gst-0.10/gst-aravis-launch
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+prefix=/home/pacaud/Sources/INSTALL
+exec_prefix=/home/pacaud/Sources/INSTALL
+
+export PATH=${exec_prefix}/bin:${PATH}
+
+gst-launch-0.10 --gst-plugin-load=../gst-0.10/.libs/libgstaravis-0.4.so -v $*
+
diff --git a/gst-0.10/gstaravis.c b/gst-0.10/gstaravis.c
new file mode 100644
index 0000000..470edaf
--- /dev/null
+++ b/gst-0.10/gstaravis.c
@@ -0,0 +1,730 @@
+/*
+ * Copyright © 2006 Eric Jonas <jonas mit edu>
+ * Copyright © 2006 Antoine Tremblay <hexa00 gmail com>
+ * Copyright © 2010 United States Government, Joshua M. Doe <joshua doe us army mil>
+ * Copyright © 2010-2011 Emmanuel Pacaud <emmanuel gnome org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+/**
+ * SECTION:element-aravissrc
+ *
+ * Source using the Aravis vision library
+ * 
+ * <refsect2>
+ * <title>Example launch line</title>
+ * |[
+ * gst-launch -v aravissrc ! video/x-raw-yuv,width=512,height=512,framerate=25/1 ! autovideosink
+ * ]|
+ * </refsect2>
+ */
+
+#include <arvconfig.h>
+#include <gstaravis.h>
+#include <time.h>
+#include <string.h>
+
+#define GST_ARAVIS_N_BUFFERS                   50
+#define GST_ARAVIS_BUFFER_TIMEOUT_DEFAULT      2000000
+
+GST_DEBUG_CATEGORY_STATIC (aravis_debug);
+#define GST_CAT_DEFAULT aravis_debug
+
+enum
+{
+  PROP_0,
+  PROP_CAMERA_NAME,
+  PROP_CAMERA,
+  PROP_GAIN,
+  PROP_GAIN_AUTO,
+  PROP_EXPOSURE,
+  PROP_EXPOSURE_AUTO,
+  PROP_H_BINNING,
+  PROP_V_BINNING,
+  PROP_OFFSET_X,
+  PROP_OFFSET_Y
+};
+
+GST_BOILERPLATE (GstAravis, gst_aravis, GstPushSrc, GST_TYPE_PUSH_SRC);
+
+static GstStaticPadTemplate aravis_src_template = GST_STATIC_PAD_TEMPLATE ("src",
+                                                                          GST_PAD_SRC,
+                                                                          GST_PAD_ALWAYS,
+                                                                          GST_STATIC_CAPS ("ANY"));
+
+static GstCaps *
+gst_aravis_get_all_camera_caps (GstAravis *gst_aravis)
+{
+       GstCaps *caps;
+       gint64 *pixel_formats;
+       double min_frame_rate, max_frame_rate;
+       int min_height, min_width;
+       int max_height, max_width;
+       unsigned int n_pixel_formats, i;
+
+       g_return_val_if_fail (GST_IS_ARAVIS (gst_aravis), NULL);
+
+       if (!ARV_IS_CAMERA (gst_aravis->camera))
+               return NULL;
+
+       GST_LOG_OBJECT (gst_aravis, "Get all camera caps");
+
+       arv_camera_get_width_bounds (gst_aravis->camera, &min_width, &max_width);
+       arv_camera_get_height_bounds (gst_aravis->camera, &min_height, &max_height);
+       pixel_formats = arv_camera_get_available_pixel_formats (gst_aravis->camera, &n_pixel_formats);
+       arv_camera_get_frame_rate_bounds (gst_aravis->camera, &min_frame_rate, &max_frame_rate);
+
+       int min_frame_rate_numerator;
+       int min_frame_rate_denominator;
+       gst_util_double_to_fraction (min_frame_rate, &min_frame_rate_numerator, &min_frame_rate_denominator);
+
+       int max_frame_rate_numerator;
+       int max_frame_rate_denominator;
+       gst_util_double_to_fraction (max_frame_rate, &max_frame_rate_numerator, &max_frame_rate_denominator);
+
+       caps = gst_caps_new_empty ();
+       for (i = 0; i < n_pixel_formats; i++) {
+               const char *caps_string;
+
+               caps_string = arv_pixel_format_to_gst_caps_string (pixel_formats[i]);
+
+               if (caps_string != NULL) {
+                       GstStructure *structure;
+
+                       structure = gst_structure_from_string (caps_string, NULL);
+                       gst_structure_set (structure,
+                                          "width", GST_TYPE_INT_RANGE, min_width, max_width,
+                                          "height", GST_TYPE_INT_RANGE, min_height, max_height,
+                                          "framerate", GST_TYPE_FRACTION_RANGE,
+                                                          min_frame_rate_numerator, 
min_frame_rate_denominator,
+                                                          max_frame_rate_numerator, 
max_frame_rate_denominator,
+                                          NULL);
+                       gst_caps_append_structure (caps, structure);
+               }
+       }
+
+       g_free (pixel_formats);
+
+       return caps;
+}
+
+static GstCaps *
+gst_aravis_get_caps (GstBaseSrc * src)
+{
+       GstAravis* gst_aravis = GST_ARAVIS(src);
+       GstCaps *caps;
+
+       if (gst_aravis->all_caps != NULL)
+               caps = gst_caps_copy (gst_aravis->all_caps);
+       else
+               caps = gst_caps_new_any ();
+
+       GST_LOG_OBJECT (gst_aravis, "Available caps = %" GST_PTR_FORMAT, caps);
+
+       return caps;
+}
+
+static gboolean
+gst_aravis_set_caps (GstBaseSrc *src, GstCaps *caps)
+{
+       GstAravis* gst_aravis = GST_ARAVIS(src);
+       GstStructure *structure;
+       ArvPixelFormat pixel_format;
+       int height, width;
+       int bpp, depth;
+       const GValue *frame_rate;
+       const char *caps_string;
+       unsigned int i;
+       guint32 fourcc;
+
+       GST_LOG_OBJECT (gst_aravis, "Requested caps = %" GST_PTR_FORMAT, caps);
+
+       arv_camera_stop_acquisition (gst_aravis->camera);
+
+       if (gst_aravis->stream != NULL)
+               g_object_unref (gst_aravis->stream);
+
+       structure = gst_caps_get_structure (caps, 0);
+
+       gst_structure_get_int (structure, "width", &width);
+       gst_structure_get_int (structure, "height", &height);
+       frame_rate = gst_structure_get_value (structure, "framerate");
+       gst_structure_get_int (structure, "bpp", &bpp);
+       gst_structure_get_int (structure, "depth", &depth);
+
+       if (gst_structure_get_field_type (structure, "format") == G_TYPE_STRING) {
+               const char *string;
+
+               string = gst_structure_get_string (structure, "format");
+               fourcc = GST_STR_FOURCC (string);
+       } else if (gst_structure_get_field_type (structure, "format") == GST_TYPE_FOURCC) {
+               gst_structure_get_fourcc (structure, "format", &fourcc);
+       } else
+               fourcc = 0;
+
+       pixel_format = arv_pixel_format_from_gst_0_10_caps (gst_structure_get_name (structure), bpp, depth, 
fourcc);
+
+       arv_camera_set_region (gst_aravis->camera, gst_aravis->offset_x, gst_aravis->offset_y, width, height);
+       arv_camera_set_binning (gst_aravis->camera, gst_aravis->h_binning, gst_aravis->v_binning);
+       arv_camera_set_pixel_format (gst_aravis->camera, pixel_format);
+
+       if (frame_rate != NULL) {
+               double dbl_frame_rate;
+
+               dbl_frame_rate = (double) gst_value_get_fraction_numerator (frame_rate) /
+                       (double) gst_value_get_fraction_denominator (frame_rate);
+
+               GST_DEBUG_OBJECT (gst_aravis, "Frame rate = %g Hz", dbl_frame_rate);
+               arv_camera_set_frame_rate (gst_aravis->camera, dbl_frame_rate);
+
+               if (dbl_frame_rate > 0.0)
+                       gst_aravis->buffer_timeout_us = MAX (GST_ARAVIS_BUFFER_TIMEOUT_DEFAULT,
+                                                            3e6 / dbl_frame_rate);
+               else
+                       gst_aravis->buffer_timeout_us = GST_ARAVIS_BUFFER_TIMEOUT_DEFAULT;
+       } else
+               gst_aravis->buffer_timeout_us = GST_ARAVIS_BUFFER_TIMEOUT_DEFAULT;
+
+       GST_DEBUG_OBJECT (gst_aravis, "Buffer timeout = %" G_GUINT64_FORMAT " µs", 
gst_aravis->buffer_timeout_us);
+
+       GST_DEBUG_OBJECT (gst_aravis, "Actual frame rate = %g Hz", arv_camera_get_frame_rate 
(gst_aravis->camera));
+
+       if(gst_aravis->gain_auto) {
+               arv_camera_set_gain_auto (gst_aravis->camera, ARV_AUTO_CONTINUOUS);
+               GST_DEBUG_OBJECT (gst_aravis, "Auto Gain = continuous");
+       } else {
+               if (gst_aravis->gain >= 0) {
+                       GST_DEBUG_OBJECT (gst_aravis, "Gain = %g", gst_aravis->gain);
+                       arv_camera_set_gain_auto (gst_aravis->camera, ARV_AUTO_OFF);
+                       arv_camera_set_gain (gst_aravis->camera, gst_aravis->gain);
+               }
+               GST_DEBUG_OBJECT (gst_aravis, "Actual gain = %g", arv_camera_get_gain (gst_aravis->camera));
+       }
+
+       if(gst_aravis->exposure_auto) {
+               arv_camera_set_exposure_time_auto (gst_aravis->camera, ARV_AUTO_CONTINUOUS);
+               GST_DEBUG_OBJECT (gst_aravis, "Auto Exposure = continuous");
+       } else {
+               if (gst_aravis->exposure_time_us > 0.0) {
+                       GST_DEBUG_OBJECT (gst_aravis, "Exposure = %g µs", gst_aravis->exposure_time_us);
+                       arv_camera_set_exposure_time_auto (gst_aravis->camera, ARV_AUTO_OFF);
+                       arv_camera_set_exposure_time (gst_aravis->camera, gst_aravis->exposure_time_us);
+               }
+               GST_DEBUG_OBJECT (gst_aravis, "Actual exposure = %g µs", arv_camera_get_exposure_time 
(gst_aravis->camera));
+       }
+
+       if (gst_aravis->fixed_caps != NULL)
+               gst_caps_unref (gst_aravis->fixed_caps);
+
+       caps_string = arv_pixel_format_to_gst_caps_string (pixel_format);
+       if (caps_string != NULL) {
+               GstStructure *structure;
+               GstCaps *caps;
+
+               caps = gst_caps_new_empty ();
+               structure = gst_structure_from_string (caps_string, NULL);
+               gst_structure_set (structure,
+                                  "width", G_TYPE_INT, width,
+                                  "height", G_TYPE_INT, height,
+                                  NULL);
+
+               if (frame_rate != NULL)
+                       gst_structure_set_value (structure, "framerate", frame_rate);
+
+               gst_caps_append_structure (caps, structure);
+
+               gst_aravis->fixed_caps = caps;
+       } else
+               gst_aravis->fixed_caps = NULL;
+
+       gst_aravis->payload = arv_camera_get_payload (gst_aravis->camera);
+       gst_aravis->stream = arv_camera_create_stream (gst_aravis->camera, NULL, NULL);
+
+       for (i = 0; i < GST_ARAVIS_N_BUFFERS; i++)
+               arv_stream_push_buffer (gst_aravis->stream,
+                                       arv_buffer_new (gst_aravis->payload, NULL));
+
+       GST_LOG_OBJECT (gst_aravis, "Start acquisition");
+       arv_camera_start_acquisition (gst_aravis->camera);
+
+       gst_aravis->timestamp_offset = 0;
+       gst_aravis->last_timestamp = 0;
+
+       return TRUE;
+}
+
+void
+gst_aravis_init_camera (GstAravis *gst_aravis)
+{
+       if (gst_aravis->camera != NULL)
+               g_object_unref (gst_aravis->camera);
+
+       gst_aravis->camera = arv_camera_new (gst_aravis->camera_name);
+
+       gst_aravis->gain = arv_camera_get_gain(gst_aravis->camera);
+       gst_aravis->gain_auto = arv_camera_is_gain_available(gst_aravis->camera);
+
+       gst_aravis->exposure_time_us = arv_camera_get_exposure_time(gst_aravis->camera);
+       if (arv_camera_get_exposure_time_auto(gst_aravis->camera) == ARV_AUTO_OFF)
+               gst_aravis->exposure_auto = FALSE;
+       else
+               gst_aravis->exposure_auto = TRUE;
+
+       arv_camera_get_region (gst_aravis->camera, &gst_aravis->offset_x, &gst_aravis->offset_y, NULL, NULL);
+       arv_camera_get_binning (gst_aravis->camera, &gst_aravis->h_binning, &gst_aravis->v_binning);
+       gst_aravis->payload = 0;
+}
+
+static gboolean
+gst_aravis_start (GstBaseSrc *src)
+{
+       GstAravis* gst_aravis = GST_ARAVIS(src);
+
+       GST_LOG_OBJECT (gst_aravis, "Open camera '%s'", gst_aravis->camera_name);
+
+       if (gst_aravis->camera == NULL)
+               gst_aravis_init_camera (gst_aravis);
+
+       gst_aravis->all_caps = gst_aravis_get_all_camera_caps (gst_aravis);
+
+       return TRUE;
+}
+
+
+gboolean gst_aravis_stop( GstBaseSrc * src )
+{
+        GstAravis* gst_aravis = GST_ARAVIS(src);
+
+       arv_camera_stop_acquisition (gst_aravis->camera);
+
+       if (gst_aravis->stream != NULL) {
+               g_object_unref (gst_aravis->stream);
+               gst_aravis->stream = NULL;
+
+       }
+       if (gst_aravis->all_caps != NULL) {
+               gst_caps_unref (gst_aravis->all_caps);
+               gst_aravis->all_caps = NULL;
+       }
+
+        GST_DEBUG_OBJECT (gst_aravis, "Stop acquisition");
+
+        return TRUE;
+}
+
+static void
+gst_aravis_get_times (GstBaseSrc * basesrc, GstBuffer * buffer,
+                     GstClockTime * start, GstClockTime * end)
+{
+       if (gst_base_src_is_live (basesrc)) {
+               GstClockTime timestamp = GST_BUFFER_TIMESTAMP (buffer);
+
+               if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
+                       GstClockTime duration = GST_BUFFER_DURATION (buffer);
+
+                       if (GST_CLOCK_TIME_IS_VALID (duration)) {
+                               *end = timestamp + duration;
+                       }
+                       *start = timestamp;
+               }
+       } else {
+               *start = -1;
+               *end = -1;
+       }
+}
+
+static GstFlowReturn
+gst_aravis_create (GstPushSrc * push_src, GstBuffer ** buffer)
+{
+       GstAravis *gst_aravis;
+       ArvBuffer *arv_buffer;
+       int arv_row_stride;
+
+       gst_aravis = GST_ARAVIS (push_src);
+
+       do {
+               arv_buffer = arv_stream_timeout_pop_buffer (gst_aravis->stream, 
gst_aravis->buffer_timeout_us);
+               if (arv_buffer != NULL && arv_buffer->status != ARV_BUFFER_STATUS_SUCCESS)
+                       arv_stream_push_buffer (gst_aravis->stream, arv_buffer);
+       } while (arv_buffer != NULL && arv_buffer->status != ARV_BUFFER_STATUS_SUCCESS);
+
+       if (arv_buffer == NULL)
+               return GST_FLOW_ERROR;
+
+       *buffer = gst_buffer_new ();
+
+       arv_row_stride = arv_buffer->width * ARV_PIXEL_FORMAT_BIT_PER_PIXEL (arv_buffer->pixel_format) / 8;
+
+       /* Gstreamer requires row stride to be a multiple of 4 */
+       if ((arv_row_stride & 0x3) != 0) {
+               int gst_row_stride;
+               size_t size;
+               void *data;
+               int i;
+
+               gst_row_stride = (arv_row_stride & ~(0x3)) + 4;
+
+               size = arv_buffer->height * gst_row_stride;
+               data = g_malloc (size);
+
+               for (i = 0; i < arv_buffer->height; i++)
+                       memcpy (((char *) data) + i * gst_row_stride, ((char *) arv_buffer->data) + i * 
arv_row_stride, arv_row_stride);
+
+               GST_BUFFER_DATA (buffer) = data;
+               GST_BUFFER_MALLOCDATA (buffer) = data;
+               GST_BUFFER_SIZE (buffer) = size;
+       } else {
+               GST_BUFFER_DATA (*buffer) = arv_buffer->data;
+               GST_BUFFER_MALLOCDATA (*buffer) = NULL;
+               GST_BUFFER_SIZE (*buffer) = arv_buffer->size;
+       }
+
+       if (!gst_base_src_get_do_timestamp(GST_BASE_SRC(push_src))) {
+               if (gst_aravis->timestamp_offset == 0) {
+                       gst_aravis->timestamp_offset = arv_buffer->timestamp_ns;
+                       gst_aravis->last_timestamp = arv_buffer->timestamp_ns;
+               }
+
+               GST_BUFFER_TIMESTAMP (*buffer) = arv_buffer->timestamp_ns - gst_aravis->timestamp_offset;
+               GST_BUFFER_DURATION (*buffer) = arv_buffer->timestamp_ns - gst_aravis->last_timestamp;
+
+               gst_aravis->last_timestamp = arv_buffer->timestamp_ns;
+       }
+
+       arv_stream_push_buffer (gst_aravis->stream, arv_buffer);
+
+       gst_buffer_set_caps (*buffer, gst_aravis->fixed_caps);
+
+       return GST_FLOW_OK;
+}
+
+static void
+gst_aravis_fixate_caps (GstPad * pad, GstCaps * caps)
+{
+       GstAravis *gst_aravis = GST_ARAVIS (gst_pad_get_parent_element (pad));
+       GstStructure *structure;
+       gint width;
+       gint height;
+       double frame_rate;
+
+       g_return_if_fail (GST_IS_ARAVIS (gst_aravis));
+
+       arv_camera_get_region (gst_aravis->camera, NULL, NULL, &width, &height);
+       frame_rate = arv_camera_get_frame_rate (gst_aravis->camera);
+
+       structure = gst_caps_get_structure (caps, 0);
+
+       gst_structure_fixate_field_nearest_int (structure, "width", width);
+       gst_structure_fixate_field_nearest_int (structure, "height", height);
+       gst_structure_fixate_field_nearest_fraction (structure, "framerate", (double) (0.5 + frame_rate), 1);
+
+       GST_LOG_OBJECT (gst_aravis, "Fixate caps");
+
+       g_object_unref (gst_aravis);
+}
+
+static void
+gst_aravis_init (GstAravis *gst_aravis, GstAravisClass *g_class)
+{
+       GstPad *pad = GST_BASE_SRC_PAD (gst_aravis);
+
+       gst_pad_set_fixatecaps_function (pad, gst_aravis_fixate_caps);
+
+       gst_base_src_set_live (GST_BASE_SRC (gst_aravis), TRUE);
+
+       gst_aravis->camera_name = NULL;
+
+       gst_aravis->gain = -1;
+       gst_aravis->gain_auto = FALSE;
+       gst_aravis->exposure_time_us = -1;
+       gst_aravis->exposure_auto = FALSE;
+       gst_aravis->offset_x = 0;
+       gst_aravis->offset_y = 0;
+       gst_aravis->h_binning = -1;
+       gst_aravis->v_binning = -1;
+       gst_aravis->payload = 0;
+
+       gst_aravis->buffer_timeout_us = GST_ARAVIS_BUFFER_TIMEOUT_DEFAULT;
+
+       gst_aravis->camera = NULL;
+       gst_aravis->stream = NULL;
+
+       gst_aravis->all_caps = NULL;
+       gst_aravis->fixed_caps = NULL;
+}
+
+static void
+gst_aravis_finalize (GObject * object)
+{
+        GstAravis *gst_aravis = GST_ARAVIS (object);
+
+       if (gst_aravis->camera != NULL) {
+               g_object_unref (gst_aravis->camera);
+               gst_aravis->camera = NULL;
+       }
+       if (gst_aravis->stream != NULL) {
+               g_object_unref (gst_aravis->stream);
+               gst_aravis->stream = NULL;
+       }
+       if (gst_aravis->all_caps != NULL) {
+               gst_caps_unref (gst_aravis->all_caps);
+               gst_aravis->all_caps = NULL;
+       }
+       if (gst_aravis->fixed_caps != NULL) {
+               gst_caps_unref (gst_aravis->fixed_caps);
+               gst_aravis->fixed_caps = NULL;
+       }
+
+       g_free (gst_aravis->camera_name);
+       gst_aravis->camera_name = NULL;
+
+        G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+gst_aravis_set_property (GObject * object, guint prop_id,
+                        const GValue * value, GParamSpec * pspec)
+{
+       GstAravis *gst_aravis = GST_ARAVIS (object);
+
+       switch (prop_id) {
+               case PROP_CAMERA_NAME:
+                       g_free (gst_aravis->camera_name);
+                       /* check if we are currently active
+                          prevent setting camera and other values to something not representing the active 
camera */
+                       if (gst_aravis->stream == NULL) {
+                               gst_aravis->camera_name = g_strdup (g_value_get_string (value));
+                               gst_aravis_init_camera (gst_aravis);
+                       }
+
+                       GST_LOG_OBJECT (gst_aravis, "Set camera name to %s", gst_aravis->camera_name);
+
+                       break;
+               case PROP_GAIN:
+                       gst_aravis->gain = g_value_get_double (value);
+                       if (gst_aravis->camera != NULL)
+                               arv_camera_set_gain (gst_aravis->camera, gst_aravis->gain);
+                       break;
+               case PROP_GAIN_AUTO:
+                       gst_aravis->gain_auto = g_value_get_boolean (value);
+                       if (gst_aravis->camera != NULL)
+                               arv_camera_set_gain_auto (gst_aravis->camera, gst_aravis->gain_auto);
+                       break;
+               case PROP_EXPOSURE:
+                       gst_aravis->exposure_time_us = g_value_get_double (value);
+                       if (gst_aravis->camera != NULL)
+                               arv_camera_set_exposure_time (gst_aravis->camera, 
gst_aravis->exposure_time_us);
+                       break;
+               case PROP_EXPOSURE_AUTO:
+                       gst_aravis->exposure_auto = g_value_get_boolean (value);
+                       if (gst_aravis->camera != NULL)
+                               arv_camera_set_exposure_time_auto (gst_aravis->camera, 
gst_aravis->exposure_auto);
+                       break;
+               case PROP_OFFSET_X:
+                       gst_aravis->offset_x = g_value_get_int (value);
+                       break;
+               case PROP_OFFSET_Y:
+                       gst_aravis->offset_y = g_value_get_int (value);
+                       break;
+               case PROP_H_BINNING:
+                       gst_aravis->h_binning = g_value_get_int (value);
+                       break;
+               case PROP_V_BINNING:
+                       gst_aravis->v_binning = g_value_get_int (value);
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+
+static void
+gst_aravis_get_property (GObject * object, guint prop_id, GValue * value,
+                        GParamSpec * pspec)
+{
+       GstAravis *gst_aravis = GST_ARAVIS (object);
+
+       switch (prop_id) {
+               case PROP_CAMERA_NAME:
+                       g_value_set_string (value, gst_aravis->camera_name);
+                       break;
+               case PROP_CAMERA:
+                       g_value_set_object (value, gst_aravis->camera);
+                       break;
+               case PROP_GAIN:
+                       g_value_set_double (value, gst_aravis->gain);
+                       break;
+               case PROP_GAIN_AUTO:
+                       g_value_set_boolean (value, gst_aravis->gain_auto);
+                       break;
+               case PROP_EXPOSURE:
+                       g_value_set_double (value, gst_aravis->exposure_time_us);
+                       break;
+               case PROP_EXPOSURE_AUTO:
+                       g_value_set_boolean (value, gst_aravis->exposure_auto);
+                       break;
+               case PROP_OFFSET_X:
+                       g_value_set_int (value, gst_aravis->offset_x);
+                       break;
+               case PROP_OFFSET_Y:
+                       g_value_set_int (value, gst_aravis->offset_y);
+                       break;
+               case PROP_H_BINNING:
+                       g_value_set_int (value, gst_aravis->h_binning);
+                       break;
+               case PROP_V_BINNING:
+                       g_value_set_int (value, gst_aravis->v_binning);
+                       break;
+               default:
+                       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+                       break;
+       }
+}
+
+static void
+gst_aravis_base_init (gpointer g_class)
+{
+       GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
+
+       gst_element_class_set_details_simple (element_class,
+                                             "Aravis Video Source",
+                                             "Source/Video",
+                                             "Aravis based source",
+                                             "Emmanuel Pacaud <emmanuel gnome org>");
+       gst_element_class_add_pad_template (element_class,
+                                           gst_static_pad_template_get (&aravis_src_template));
+}
+
+static void
+gst_aravis_class_init (GstAravisClass * klass)
+{
+       GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+       GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
+       GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
+
+       gobject_class->finalize = gst_aravis_finalize;
+       gobject_class->set_property = gst_aravis_set_property;
+       gobject_class->get_property = gst_aravis_get_property;
+
+       g_object_class_install_property
+               (gobject_class,
+                PROP_CAMERA_NAME,
+                g_param_spec_string ("camera-name",
+                                     "Camera name",
+                                     "Name of the camera",
+                                     NULL,
+                                     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_CAMERA,
+                g_param_spec_object ("camera",
+                                     "Camera Object",
+                                     "Camera instance to retrieve additional information",
+                                             ARV_TYPE_CAMERA,
+                                     G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_GAIN,
+                g_param_spec_double ("gain",
+                                  "Gain",
+                                  "Gain (dB)",
+                                  -1.0, 500.0, 0.0,
+                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_GAIN_AUTO,
+                g_param_spec_boolean ("gain-auto",
+                                      "Auto Gain",
+                                      "Auto Gain Mode",
+                                      TRUE,
+                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_EXPOSURE,
+                g_param_spec_double ("exposure",
+                                     "Exposure",
+                                     "Exposure time (µs)",
+                                     -1, 100000000.0, 500.0,
+                                     G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_EXPOSURE_AUTO,
+                g_param_spec_boolean ("exposure-auto",
+                                      "Auto Exposure",
+                                      "Auto Exposure Mode",
+                                      TRUE,
+                                      G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_OFFSET_X,
+                g_param_spec_int ("offset-x",
+                                  "x Offset",
+                                  "Offset in x direction",
+                                  0, G_MAXINT, 0,
+                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_OFFSET_Y,
+                g_param_spec_int ("offset-y",
+                                  "y Offset",
+                                  "Offset in y direction",
+                                  0, G_MAXINT, 0,
+                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_H_BINNING,
+                g_param_spec_int ("h-binning",
+                                  "Horizontal binning",
+                                  "CCD horizontal binning",
+                                  1, G_MAXINT, 1,
+                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+       g_object_class_install_property
+               (gobject_class,
+                PROP_V_BINNING,
+                g_param_spec_int ("v-binning",
+                                  "Vertical binning",
+                                  "CCD vertical binning",
+                                  1, G_MAXINT, 1,
+                                  G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
+        GST_DEBUG_CATEGORY_INIT (aravis_debug, "aravissrc", 0, "Aravis interface");
+
+       gstbasesrc_class->get_caps = gst_aravis_get_caps;
+       gstbasesrc_class->set_caps = gst_aravis_set_caps;
+       gstbasesrc_class->start = gst_aravis_start;
+       gstbasesrc_class->stop = gst_aravis_stop;
+
+       gstbasesrc_class->get_times = gst_aravis_get_times;
+
+       gstpushsrc_class->create = gst_aravis_create;
+}
+
+static gboolean
+plugin_init (GstPlugin * plugin)
+{
+        return gst_element_register (plugin, "aravissrc", GST_RANK_NONE, GST_TYPE_ARAVIS);
+}
+
+GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
+                  GST_VERSION_MINOR,
+                  "aravissrc",
+                  "Aravis Video Source",
+                  plugin_init,
+                  VERSION,
+                  "LGPL",
+                  PACKAGE_NAME,
+                  "http://blogs.gnome.org/emmanuel";)
diff --git a/gst-0.10/gstaravis.h b/gst-0.10/gstaravis.h
new file mode 100644
index 0000000..2a8aeec
--- /dev/null
+++ b/gst-0.10/gstaravis.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright © 2006 Eric Jonas <jonas mit edu>
+ * Copyright © 2006 Antoine Tremblay <hexa00 gmail com>
+ * Copyright © 2010 United States Government, Joshua M. Doe <joshua doe us army mil>
+ * Copyright © 2010 Emmanuel Pacaud <emmanuel gnome org>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef ARV_GST_H
+#define ARV_GST_H
+
+#include <gst/gst.h>
+#include <gst/base/gstpushsrc.h>
+#include <arv.h>
+
+G_BEGIN_DECLS
+
+#define GST_TYPE_ARAVIS                (gst_aravis_get_type())
+#define GST_ARAVIS(obj)                        (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ARAVIS,GstAravis))
+#define GST_ARAVIS_CLASS(klass)        (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ARAVIS,GstAravis))
+#define GST_IS_ARAVIS(obj)             (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ARAVIS))
+#define GST_IS_ARAVIS_CLASS(obj)       (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ARAVIS))
+
+typedef struct _GstAravis GstAravis;
+typedef struct _GstAravisClass GstAravisClass;
+
+struct _GstAravis {
+       GstPushSrc element;
+
+       char *camera_name;
+
+       double gain;
+       gboolean gain_auto;
+       double exposure_time_us;
+       gboolean exposure_auto;
+
+       gint offset_x;
+       gint offset_y;
+
+       gint h_binning;
+       gint v_binning;
+
+       gint payload;
+
+       guint64 buffer_timeout_us;
+
+       ArvCamera *camera;
+       ArvStream *stream;
+
+       GstCaps *all_caps;
+       GstCaps *fixed_caps;
+
+       guint64 timestamp_offset;
+       guint64 last_timestamp;
+};
+
+struct _GstAravisClass {
+       GstPushSrcClass parent_class;
+};
+
+GType gst_aravis_get_type (void);
+
+G_END_DECLS
+
+#endif
diff --git a/src/arvmisc.c b/src/arvmisc.c
index e03db0a..3995921 100644
--- a/src/arvmisc.c
+++ b/src/arvmisc.c
@@ -591,48 +591,59 @@ typedef struct {
        const char *gst_caps_string;
        const char *name;
        const char *format;
+       int bpp;
+       int depth;
+       guint32 fourcc;
 } ArvGstCapsInfos;
 
 ArvGstCapsInfos arv_gst_caps_infos[] = {
        {
                ARV_PIXEL_FORMAT_MONO_8,
                "video/x-raw, format=(string)GRAY8",
-               "video/x-raw",  "GRAY8"
+               "video/x-raw", "GRAY8",
+               8,      8,      0
        },
        {
                ARV_PIXEL_FORMAT_MONO_10,
                "video/x-raw, format=(string)GRAY16_LE",
-               "video/x-raw",  "GRAY16_LE"
+               "video/x-raw",  "GRAY16_LE",
+               16,     10,     0
        },
        {
                ARV_PIXEL_FORMAT_MONO_12,
                "video/x-raw, format=(string)GRAY16_LE",
-               "video/x-raw",  "GRAY16_LE"
+               "video/x-raw",  "GRAY16_LE",
+               16,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_MONO_16,
                "video/x-raw, format=(string)GRAY16_LE",
-               "video/x-raw",  "GRAY16_LE"
+               "video/x-raw",  "GRAY16_LE",
+               16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GR_8,
                "video/x-bayer, format=(string)grbg",
-               "video/x-bayer",        "grbg"
+               "video/x-bayer",        "grbg",
+               8,      8,      ARV_MAKE_FOURCC ('g','r','b','g')
        },
        {
                ARV_PIXEL_FORMAT_BAYER_RG_8,
                "video/x-bayer, format=(string)rggb",
-               "video/x-bayer",        "rggb"
+               "video/x-bayer",        "rggb",
+               8,      8,      ARV_MAKE_FOURCC ('r','g','g','b')
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GB_8,
                "video/x-bayer, format=(string)gbrg",
-               "video/x-bayer",        "gbrg"
+               "video/x-bayer",        "gbrg",
+               8,      8,      ARV_MAKE_FOURCC ('g','b','r','g')
        },
        {
                ARV_PIXEL_FORMAT_BAYER_BG_8,
                "video/x-bayer, format=(string)bggr",
-               "video/x-bayer",        "bggr"
+               "video/x-bayer",        "bggr",
+               8,      8,      ARV_MAKE_FOURCC ('b','g','g','r')
        },
 
 /* Non 8bit bayer formats are not supported by gstreamer bayer plugin.
@@ -641,22 +652,25 @@ ArvGstCapsInfos arv_gst_caps_infos[] = {
        {
                ARV_PIXEL_FORMAT_YUV_422_PACKED,
                "video/x-raw, format=(string)UYVY",
-               "video/x-raw",  "UYVY"
+               "video/x-raw",  "UYVY",
+               0,      0,      ARV_MAKE_FOURCC ('U','Y','V','Y')
        },
        {
                ARV_PIXEL_FORMAT_YUV_422_YUYV_PACKED,
                "video/x-raw, format=(string)YUY2",
-               "video/x-raw",  "YUY2"
+               0,      0,      ARV_MAKE_FOURCC ('Y','U','Y','2')
        },
        {
                ARV_PIXEL_FORMAT_RGB_8_PACKED,
                "video/x-raw, format=(string)RGB",
-               "video/x-raw",  "RGB"
+               "video/x-raw",  "RGB",
+               24,     24,     0
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_YUV_422_YUYV_PACKED,
                "video/x-raw, format=(string)YUY2",
-               "video/x-raw",  "YUY2"
+               "video/x-raw",  "YUY2",
+               0,      0,      ARV_MAKE_FOURCC ('Y','U','Y','2')
        }
 };
 
@@ -704,3 +718,27 @@ arv_pixel_format_from_gst_caps (const char *name, const char *format)
 
        return 0;
 }
+
+ArvPixelFormat
+arv_pixel_format_from_gst_0_10_caps (const char *name, int bpp, int depth, guint32 fourcc)
+{
+       unsigned int i;
+
+       g_return_val_if_fail (name != NULL, 0);
+
+       for (i = 0; i < G_N_ELEMENTS (arv_gst_caps_infos); i++) {
+               if (strcmp (name, arv_gst_caps_infos[i].name) != 0)
+                       continue;
+
+               if (strcmp (name, "video/x-raw") == 0 &&
+                   fourcc == arv_gst_caps_infos[i].fourcc)
+                       return arv_gst_caps_infos[i].pixel_format;
+
+               if (depth == arv_gst_caps_infos[i].depth &&
+                   bpp == arv_gst_caps_infos[i].bpp &&
+                   fourcc == arv_gst_caps_infos[i].fourcc)
+                       return arv_gst_caps_infos[i].pixel_format;
+       }
+
+       return 0;
+}
diff --git a/src/arvmisc.h b/src/arvmisc.h
index 7137a73..5b9998a 100644
--- a/src/arvmisc.h
+++ b/src/arvmisc.h
@@ -69,6 +69,7 @@ void *                arv_decompress                  (void *input_buffer, size_t 
input_size, size_t *outpu
 
 const char *   arv_pixel_format_to_gst_caps_string     (ArvPixelFormat pixel_format);
 ArvPixelFormat         arv_pixel_format_from_gst_caps          (const char *name, const char *format);
+ArvPixelFormat         arv_pixel_format_from_gst_0_10_caps     (const char *name, int bpp, int depth, 
guint32 fourcc);
 
 /*
    Compatibility with old glib


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