[aravis] Update to GStreamer 1.0.



commit 81c8bfb4c26f530615f2dd3c61bc140d9c5362bd
Author: Michael Pruett <michael 68k org>
Date:   Wed Jan 29 00:47:08 2014 -0600

    Update to GStreamer 1.0.

 configure.ac           |    8 ++--
 gst/gst-aravis-inspect |    2 +-
 gst/gst-aravis-launch  |    2 +-
 gst/gstaravis.c        |   81 ++++++++++++------------------
 src/arvmisc.c          |  133 +++++++++++++++++++++++-------------------------
 src/arvmisc.h          |    2 +-
 viewer/arvviewer.c     |   56 +++++++++-----------
 7 files changed, 129 insertions(+), 155 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index b0a518d..e533e4a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -55,7 +55,7 @@ AC_ARG_ENABLE(cpp_test,
 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-0.10 >= 0.10.31 gstreamer-app-0.10 gstreamer-interfaces-0.10"
+ARAVIS_GSTREAMER_REQUIREMENTS="gstreamer-base-1.0 gstreamer-app-1.0"
 
 PKG_CHECK_MODULES(ARAVIS, [$ARAVIS_REQUIREMENTS])
 
@@ -67,7 +67,7 @@ AC_SUBST(ARAVIS_LIBS)
 
 AC_SUBST(aravis_datadir, '$(datadir)/aravis-$(ARAVIS_API_VERSION)')
 
-ARAVIS_VIEWER_REQUIREMENTS=$ARAVIS_GSTREAMER_REQUIREMENTS
+ARAVIS_VIEWER_REQUIREMENTS="$ARAVIS_GSTREAMER_REQUIREMENTS gstreamer-video-1.0"
 if test "x$enable_gtk3" = "xyes"; then
        ARAVIS_VIEWER_REQUIREMENTS+=" gtk+-3.0"
 else
@@ -115,9 +115,9 @@ AC_SUBST(ARAVIS_GST_PLUGIN_CFLAGS)
 AC_SUBST(ARAVIS_GST_PLUGIN_LIBS)
 
 if test "x${prefix}" = "x$HOME"; then
-  gstplugindir="$HOME/.gstreamer-0.10/plugins"
+  gstplugindir="$HOME/.gstreamer-1.0/plugins"
 else
-  gstplugindir="\$(libdir)/gstreamer-0.10"
+  gstplugindir="\$(libdir)/gstreamer-1.0"
 fi
 AC_SUBST(gstplugindir)
 
diff --git a/gst/gst-aravis-inspect b/gst/gst-aravis-inspect
index 62181d6..d6cb8df 100755
--- a/gst/gst-aravis-inspect
+++ b/gst/gst-aravis-inspect
@@ -4,5 +4,5 @@ exec_prefix=`pwd`
 
 export PATH=${exec_prefix}/bin:${PATH}
 
-gst-inspect-0.10 --gst-plugin-load=../gst/.libs/libgstaravis-0.4.so $*
+gst-inspect-1.0 --gst-plugin-load=../gst/.libs/libgstaravis-0.4.so $*
 
diff --git a/gst/gst-aravis-launch b/gst/gst-aravis-launch
index 452b936..ff5110d 100755
--- a/gst/gst-aravis-launch
+++ b/gst/gst-aravis-launch
@@ -5,5 +5,5 @@ exec_prefix=/home/pacaud/Sources/INSTALL
 
 export PATH=${exec_prefix}/bin:${PATH}
 
-gst-launch-0.10 --gst-plugin-load=../gst/.libs/libgstaravis-0.4.so -v $*
+gst-launch-1.0 --gst-plugin-load=../gst/.libs/libgstaravis-0.4.so -v $*
 
diff --git a/gst/gstaravis.c b/gst/gstaravis.c
index 8c67b00..2405c8c 100644
--- a/gst/gstaravis.c
+++ b/gst/gstaravis.c
@@ -59,7 +59,7 @@ enum
   PROP_OFFSET_Y
 };
 
-GST_BOILERPLATE (GstAravis, gst_aravis, GstPushSrc, GST_TYPE_PUSH_SRC);
+G_DEFINE_TYPE (GstAravis, gst_aravis, GST_TYPE_PUSH_SRC);
 
 static GstStaticPadTemplate aravis_src_template = GST_STATIC_PAD_TEMPLATE ("src",
                                                                           GST_PAD_SRC,
@@ -123,7 +123,7 @@ gst_aravis_get_all_camera_caps (GstAravis *gst_aravis)
 }
 
 static GstCaps *
-gst_aravis_get_caps (GstBaseSrc * src)
+gst_aravis_get_caps (GstBaseSrc * src, GstCaps * filter)
 {
        GstAravis* gst_aravis = GST_ARAVIS(src);
        GstCaps *caps;
@@ -148,8 +148,8 @@ gst_aravis_set_caps (GstBaseSrc *src, GstCaps *caps)
        int bpp, depth;
        const GValue *frame_rate;
        const char *caps_string;
+       const char *format_string;
        unsigned int i;
-       guint32 fourcc;
 
        GST_LOG_OBJECT (gst_aravis, "Requested caps = %" GST_PTR_FORMAT, caps);
 
@@ -165,18 +165,9 @@ gst_aravis_set_caps (GstBaseSrc *src, GstCaps *caps)
        frame_rate = gst_structure_get_value (structure, "framerate");
        gst_structure_get_int (structure, "bpp", &bpp);
        gst_structure_get_int (structure, "depth", &depth);
+       format_string = gst_structure_get_string (structure, "format");
 
-       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_caps (gst_structure_get_name (structure), bpp, depth, 
fourcc);
+       pixel_format = arv_pixel_format_from_gst_caps (gst_structure_get_name (structure), bpp, depth, 
format_string);
 
        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);
@@ -331,7 +322,7 @@ 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);
+               GstClockTime timestamp = GST_BUFFER_PTS (buffer);
 
                if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
                        GstClockTime duration = GST_BUFFER_DURATION (buffer);
@@ -365,8 +356,6 @@ gst_aravis_create (GstPushSrc * push_src, GstBuffer ** buffer)
        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 */
@@ -384,13 +373,15 @@ gst_aravis_create (GstPushSrc * push_src, GstBuffer ** buffer)
                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;
+               *buffer = gst_buffer_new_wrapped (data, size);
        } else {
-               GST_BUFFER_DATA (*buffer) = arv_buffer->data;
-               GST_BUFFER_MALLOCDATA (*buffer) = NULL;
-               GST_BUFFER_SIZE (*buffer) = arv_buffer->size;
+               *buffer = gst_buffer_new_wrapped_full (0,
+                       arv_buffer->data,
+                       arv_buffer->size,
+                       0,
+                       arv_buffer->size,
+                       NULL,
+                       NULL);
        }
 
        if (!gst_base_src_get_do_timestamp(GST_BASE_SRC(push_src))) {
@@ -399,7 +390,7 @@ gst_aravis_create (GstPushSrc * push_src, GstBuffer ** buffer)
                        gst_aravis->last_timestamp = arv_buffer->timestamp_ns;
                }
 
-               GST_BUFFER_TIMESTAMP (*buffer) = arv_buffer->timestamp_ns - gst_aravis->timestamp_offset;
+               GST_BUFFER_PTS (*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;
@@ -407,15 +398,13 @@ gst_aravis_create (GstPushSrc * push_src, GstBuffer ** buffer)
 
        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)
+static GstCaps *
+gst_aravis_fixate_caps (GstBaseSrc * bsrc, GstCaps * caps)
 {
-       GstAravis *gst_aravis = GST_ARAVIS (gst_pad_get_parent_element (pad));
+       GstAravis *gst_aravis = GST_ARAVIS (bsrc);
        GstStructure *structure;
        gint width;
        gint height;
@@ -434,16 +423,14 @@ gst_aravis_fixate_caps (GstPad * pad, GstCaps * caps)
 
        GST_LOG_OBJECT (gst_aravis, "Fixate caps");
 
-       g_object_unref (gst_aravis);
+       return GST_BASE_SRC_CLASS(gst_aravis_parent_class)->fixate(bsrc, caps);
 }
 
 static void
-gst_aravis_init (GstAravis *gst_aravis, GstAravisClass *g_class)
+gst_aravis_init (GstAravis *gst_aravis)
 {
        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;
@@ -492,7 +479,7 @@ gst_aravis_finalize (GObject * object)
        g_free (gst_aravis->camera_name);
        gst_aravis->camera_name = NULL;
 
-        G_OBJECT_CLASS (parent_class)->finalize (object);
+        G_OBJECT_CLASS (gst_aravis_parent_class)->finalize (object);
 }
 
 static void
@@ -596,23 +583,10 @@ gst_aravis_get_property (GObject * object, guint prop_id, GValue * value,
 }
 
 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);
+       GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
        GstBaseSrcClass *gstbasesrc_class = GST_BASE_SRC_CLASS (klass);
        GstPushSrcClass *gstpushsrc_class = GST_PUSH_SRC_CLASS (klass);
 
@@ -703,8 +677,17 @@ gst_aravis_class_init (GstAravisClass * klass)
 
         GST_DEBUG_CATEGORY_INIT (aravis_debug, "aravissrc", 0, "Aravis interface");
 
+       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));
+
        gstbasesrc_class->get_caps = gst_aravis_get_caps;
        gstbasesrc_class->set_caps = gst_aravis_set_caps;
+       gstbasesrc_class->fixate = gst_aravis_fixate_caps;
        gstbasesrc_class->start = gst_aravis_start;
        gstbasesrc_class->stop = gst_aravis_stop;
 
@@ -721,7 +704,7 @@ plugin_init (GstPlugin * plugin)
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
                   GST_VERSION_MINOR,
-                  "aravissrc",
+                  aravissrc,
                   "Aravis Video Source",
                   plugin_init,
                   VERSION,
diff --git a/src/arvmisc.c b/src/arvmisc.c
index d29246d..2e555a7 100644
--- a/src/arvmisc.c
+++ b/src/arvmisc.c
@@ -592,54 +592,49 @@ typedef struct {
        const char *name;
        int bpp;
        int depth;
-       guint32 fourcc;
+       const char *format;
 } ArvGstCapsInfos;
 
 ArvGstCapsInfos arv_gst_caps_infos[] = {
        {
                ARV_PIXEL_FORMAT_MONO_8,
-               "video/x-raw-gray, bpp=(int)8, depth=(int)8",
-               "video/x-raw-gray",     8,      8,      0
+               "video/x-raw, format=(string)GRAY8, bpp=(int)8, depth=(int)8",
+               "video/x-raw",  8,      8,      "GRAY8"
        },
        {
                ARV_PIXEL_FORMAT_MONO_10,
-               "video/x-raw-gray, bpp=(int)16, depth=(int)10",
-               "video/x-raw-gray",     16,     10,     0,
+               "video/x-raw, format=(string)GRAY16, bpp=(int)16, depth=(int)10",
+               "video/x-raw",  16,     10,     "GRAY16_LE"
        },
        {
-              ARV_PIXEL_FORMAT_MONO_12,
-              "video/x-raw-gray, bpp=(int)16, depth=(int)12",
-              "video/x-raw-gray",      16,     12,     0,
-       },
-       {
-               ARV_PIXEL_FORMAT_MONO_12_PACKED,
-               "video/x-raw-gray, bpp=(int)12, depth=(int)12",
-               "video/x-raw-gray",     12,     12,     0,
+               ARV_PIXEL_FORMAT_MONO_12,
+               "video/x-raw, format=(string)GRAY16, bpp=(int)16, depth=(int)12",
+               "video/x-raw",  16,     12,     "GRAY16_LE"
        },
        {
                ARV_PIXEL_FORMAT_MONO_16,
-               "video/x-raw-gray, bpp=(int)16, depth=(int)16",
-               "video/x-raw-gray",     16,     16,     0
+               "video/x-raw, format=(string)GRAY16, bpp=(int)16, depth=(int)16",
+               "video/x-raw",  16,     16,     "GRAY16_LE"
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GR_8,
-               "video/x-raw-bayer, format=grbg, bpp=(int)8, depth=(int)8",
-               "video/x-raw-bayer",     8,      8,      ARV_MAKE_FOURCC ('g','r','b','g')
+               "video/x-bayer, format=grbg, bpp=(int)8, depth=(int)8",
+               "video/x-bayer",        8,      8,      "grbg"
        },
        {
                ARV_PIXEL_FORMAT_BAYER_RG_8,
-               "video/x-raw-bayer, format=rggb, bpp=(int)8, depth=(int)8",
-               "video/x-raw-bayer",     8,      8,      ARV_MAKE_FOURCC ('r','g','g','b')
+               "video/x-bayer, format=rggb, bpp=(int)8, depth=(int)8",
+               "video/x-bayer",        8,      8,      "rggb"
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GB_8,
-               "video/x-raw-bayer, format=gbrg, bpp=(int)8, depth=(int)8",
-               "video/x-raw-bayer",    8,      8,      ARV_MAKE_FOURCC ('g','b','r','g')
+               "video/x-bayer, format=gbrg, bpp=(int)8, depth=(int)8",
+               "video/x-bayer",        8,      8,      "gbrg"
        },
        {
                ARV_PIXEL_FORMAT_BAYER_BG_8,
-               "video/x-raw-bayer, format=bggr, bpp=(int)8, depth=(int)8",
-               "video/x-raw-bayer",    8,      8,      ARV_MAKE_FOURCC ('b','g','g','r')
+               "video/x-bayer, format=bggr, bpp=(int)8, depth=(int)8",
+               "video/x-bayer",        8,      8,      "bggr"
        },
 
 /* Disable non 8bit bayer formats for now, as it's not supported by gstreamer bayer plugin.
@@ -648,104 +643,104 @@ ArvGstCapsInfos arv_gst_caps_infos[] = {
 #if 0  
        {
                ARV_PIXEL_FORMAT_BAYER_GR_12,
-               "video/x-raw-bayer, format=grbg, bpp=(int)16, depth=(int)12",
-               "video/x-raw-bayer",     16,     12,     0
+               "video/x-bayer, format=grbg, bpp=(int)16, depth=(int)12",
+               "video/x-bayer",     16,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_RG_12,
-               "video/x-raw-bayer, format=rggb, bpp=(int)16, depth=(int)12",
-               "video/x-raw-bayer",     16,     12,     0
+               "video/x-bayer, format=rggb, bpp=(int)16, depth=(int)12",
+               "video/x-bayer",     16,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GB_12,
-               "video/x-raw-bayer, format=gbrg, bpp=(int)16, depth=(int)12",
-               "video/x-raw-bayer",    16,     12,     0
+               "video/x-bayer, format=gbrg, bpp=(int)16, depth=(int)12",
+               "video/x-bayer",        16,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_BG_12,
-               "video/x-raw-bayer, format=bggr, bpp=(int)16, depth=(int)12",
-               "video/x-raw-bayer",    16,     12,     0
+               "video/x-bayer, format=bggr, bpp=(int)16, depth=(int)12",
+               "video/x-bayer",        16,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GR_12_PACKED,
-               "video/x-raw-bayer, format=grbg, bpp=(int)12, depth=(int)12",
-               "video/x-raw-bayer",    12,     12,     0
+               "video/x-bayer, format=grbg, bpp=(int)12, depth=(int)12",
+               "video/x-bayer",        12,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_RG_12_PACKED,
-               "video/x-raw-bayer, format=rggb, bpp=(int)12, depth=(int)12",
-               "video/x-raw-bayer",    12,     12,     0
+               "video/x-bayer, format=rggb, bpp=(int)12, depth=(int)12",
+               "video/x-bayer",        12,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GB_12_PACKED,
-               "video/x-raw-bayer, format=gbrg, bpp=(int)12, depth=(int)12",
-               "video/x-raw-bayer",    12,     12,     0
+               "video/x-bayer, format=gbrg, bpp=(int)12, depth=(int)12",
+               "video/x-bayer",        12,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_BG_12_PACKED,
-               "video/x-raw-bayer, format=bggr, bpp=(int)12, depth=(int)12",
-               "video/x-raw-bayer",    12,     12,     0
+               "video/x-bayer, format=bggr, bpp=(int)12, depth=(int)12",
+               "video/x-bayer",        12,     12,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GR_16,
-               "video/x-raw-bayer, format=grbg, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=grbg, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_RG_16,
-               "video/x-raw-bayer, format=rggb, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=rggb, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_GB_16,
-               "video/x-raw-bayer, format=gbrg, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=gbrg, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_BAYER_BG_16,
-               "video/x-raw-bayer, format=bggr, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=bggr, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_BAYER_GR_16,
-               "video/x-raw-bayer, format=grbg, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=grbg, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_BAYER_RG_16,
-               "video/x-raw-bayer, format=rggb, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=rggb, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_BAYER_GB_16,
-               "video/x-raw-bayer, format=gbrg, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=gbrg, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_BAYER_BG_16,
-               "video/x-raw-bayer, format=bggr, bpp=(int)16, depth=(int)16",
-               "video/x-raw-bayer",    16,     16,     0
+               "video/x-bayer, format=bggr, bpp=(int)16, depth=(int)16",
+               "video/x-bayer",        16,     16,     0
        },
 #endif
        {
                ARV_PIXEL_FORMAT_YUV_422_PACKED,
-               "video/x-raw-yuv, format=(fourcc)UYVY",
-               "video/x-raw-yuv",      0,      0,      ARV_MAKE_FOURCC ('U','Y','V','Y')
+               "video/x-raw, format=(string)UYVY",
+               "video/x-raw",  0,      0,      "UYVY"
        },
        {
                ARV_PIXEL_FORMAT_YUV_422_YUYV_PACKED,
-               "video/x-raw-yuv, format=(fourcc)YUY2",
-               "video/x-raw-yuv",      0,      0,      ARV_MAKE_FOURCC ('Y','U','Y','2')
+               "video/x-raw, format=(string)YUY2",
+               "video/x-raw",  0,      0,      "YUY2"
        },
        {
                ARV_PIXEL_FORMAT_RGB_8_PACKED,
-               "video/x-raw-rgb, bpp=(int)24, depth=(int)24",
-               "video/x-raw-rgb",      24,     24,     0
+               "video/x-raw, format=(string)RGB, bpp=(int)24, depth=(int)24",
+               "video/x-raw",  24,     24,     "RGB"
        },
        {
                ARV_PIXEL_FORMAT_CUSTOM_YUV_422_YUYV_PACKED,
-               "video/x-raw-yuv, format=(fourcc)YUY2",
-               "video/x-raw-yuv",      0,      0,      ARV_MAKE_FOURCC ('Y','U','Y','2')
+               "video/x-raw, format=(string)YUY2",
+               "video/x-raw",  0,      0,      "YUY2"
        }
 };
 
@@ -776,7 +771,7 @@ arv_pixel_format_to_gst_caps_string (ArvPixelFormat pixel_format)
 }
 
 ArvPixelFormat
-arv_pixel_format_from_gst_caps (const char *name, int bpp, int depth, guint32 fourcc)
+arv_pixel_format_from_gst_caps (const char *name, int bpp, int depth, const char *format)
 {
        unsigned int i;
 
@@ -786,13 +781,13 @@ arv_pixel_format_from_gst_caps (const char *name, int bpp, int depth, guint32 fo
                if (strcmp (name, arv_gst_caps_infos[i].name) != 0)
                        continue;
 
-               if (strcmp (name, "video/x-raw-yuv") == 0 &&
-                   fourcc == arv_gst_caps_infos[i].fourcc)
+               if (strcmp (name, "video/x-raw") == 0 &&
+                   strcmp (format, arv_gst_caps_infos[i].format) == 0)
                        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))
+               if (depth == arv_gst_caps_infos[i].depth &&
+                   bpp == arv_gst_caps_infos[i].bpp &&
+                   strcmp (format, arv_gst_caps_infos[i].format) == 0)
                        return arv_gst_caps_infos[i].pixel_format;
        }
 
diff --git a/src/arvmisc.h b/src/arvmisc.h
index bdaa791..3b944dc 100644
--- a/src/arvmisc.h
+++ b/src/arvmisc.h
@@ -68,7 +68,7 @@ void          arv_copy_memory_with_endianess  (void *to, size_t to_size, guint to_endia
 void *                 arv_decompress                  (void *input_buffer, size_t input_size, size_t 
*output_size);
 
 const char *   arv_pixel_format_to_gst_caps_string     (ArvPixelFormat pixel_format);
-ArvPixelFormat         arv_pixel_format_from_gst_caps          (const char *name, int bpp, int depth, 
guint32 fourcc);
+ArvPixelFormat         arv_pixel_format_from_gst_caps          (const char *name, int bpp, int depth, const 
char *format);
 
 /*
    Compatibility with old glib
diff --git a/viewer/arvviewer.c b/viewer/arvviewer.c
index 0880ff3..a8abe50 100644
--- a/viewer/arvviewer.c
+++ b/viewer/arvviewer.c
@@ -24,7 +24,7 @@
 #include <gtk/gtk.h>
 #include <gst/gst.h>
 #include <gst/app/gstappsrc.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
 #include <gdk/gdkx.h>
 #include <arv.h>
 #include <stdlib.h>
@@ -154,7 +154,6 @@ arv_viewer_new_buffer_cb (ArvStream *stream, ArvViewer *viewer)
 
        if (arv_buffer->status == ARV_BUFFER_STATUS_SUCCESS) {
                int arv_row_stride;
-               buffer = gst_buffer_new ();
 
                arv_row_stride = arv_buffer->width * ARV_PIXEL_FORMAT_BIT_PER_PIXEL 
(arv_buffer->pixel_format) / 8;
 
@@ -173,13 +172,15 @@ arv_viewer_new_buffer_cb (ArvStream *stream, ArvViewer *viewer)
                        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;
+                       buffer = gst_buffer_new_wrapped (data, size);
                } else {
-                       GST_BUFFER_DATA (buffer) = (unsigned char *) arv_buffer->data;
-                       GST_BUFFER_MALLOCDATA (buffer) = NULL;
-                       GST_BUFFER_SIZE (buffer) = arv_buffer->size;
+                       buffer = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+                               arv_buffer->data,
+                               arv_buffer->size,
+                               0,
+                               arv_buffer->size,
+                               NULL,
+                               NULL);
                }
 
                if (viewer->timestamp_offset == 0) {
@@ -187,7 +188,7 @@ arv_viewer_new_buffer_cb (ArvStream *stream, ArvViewer *viewer)
                        viewer->last_timestamp = arv_buffer->timestamp_ns;
                }
 
-               GST_BUFFER_TIMESTAMP (buffer) = arv_buffer->timestamp_ns - viewer->timestamp_offset;
+               GST_BUFFER_DTS (buffer) = arv_buffer->timestamp_ns - viewer->timestamp_offset;
                GST_BUFFER_DURATION (buffer) = arv_buffer->timestamp_ns - viewer->last_timestamp;
 
                gst_app_src_push_buffer (GST_APP_SRC (viewer->appsrc), buffer);
@@ -491,21 +492,14 @@ bus_sync_handler (GstBus *bus, GstMessage *message, gpointer user_data)
 {
        ArvViewer *viewer = user_data;
 
-       if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT)
-               return GST_BUS_PASS;
-       if (!gst_structure_has_name (message->structure, "prepare-xwindow-id"))
+       if (!gst_is_video_overlay_prepare_window_handle_message(message))
                return GST_BUS_PASS;
 
        if (viewer->video_window_xid != 0) {
-               GstXOverlay *xoverlay;
-
-               xoverlay = GST_X_OVERLAY (GST_MESSAGE_SRC (message));
-               gst_x_overlay_set_window_handle (xoverlay, viewer->video_window_xid);
+               GstVideoOverlay *videooverlay;
 
-               if (g_strcmp0 (G_OBJECT_TYPE_NAME (xoverlay), "GstXvImageSink"))
-                       g_object_set (xoverlay, "draw-borders", TRUE, NULL);
-
-               g_object_set (xoverlay, "force-aspect-ratio", TRUE, "sync", FALSE, NULL);
+               videooverlay = GST_VIDEO_OVERLAY (GST_MESSAGE_SRC (message));
+               gst_video_overlay_set_window_handle (videooverlay, viewer->video_window_xid);
        } else {
                g_warning ("Should have obtained video_window_xid by now!");
        }
@@ -521,7 +515,7 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
        GtkTreeIter iter;
        GtkTreeModel *list_store;
        GstCaps *caps;
-       GstElement *ffmpegcolorspace;
+       GstElement *videoconvert;
        GstElement *videosink;
        GstBus *bus;
        ArvPixelFormat pixel_format;
@@ -654,23 +648,23 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
        viewer->pipeline = gst_pipeline_new ("pipeline");
 
        viewer->appsrc = gst_element_factory_make ("appsrc", NULL);
-       ffmpegcolorspace = gst_element_factory_make ("ffmpegcolorspace", NULL);
+       videoconvert = gst_element_factory_make ("videoconvert", NULL);
        viewer->transform = gst_element_factory_make ("videoflip", NULL);
        videosink = gst_element_factory_make ("autovideosink", NULL);
 
-       if (g_str_has_prefix (caps_string, "video/x-raw-bayer")) {
+       if (g_str_has_prefix (caps_string, "video/x-bayer")) {
                GstElement *bayer2rgb;
 
                bayer2rgb = gst_element_factory_make ("bayer2rgb", NULL);
 
                gst_bin_add_many (GST_BIN (viewer->pipeline), viewer->appsrc, bayer2rgb,
-                                 ffmpegcolorspace, viewer->transform, videosink, NULL);
+                                 videoconvert, viewer->transform, videosink, NULL);
                gst_element_link_many (viewer->appsrc, bayer2rgb,
-                                      ffmpegcolorspace, viewer->transform, videosink, NULL);
+                                      videoconvert, viewer->transform, videosink, NULL);
        } else {
                gst_bin_add_many (GST_BIN (viewer->pipeline), viewer->appsrc,
-                                 ffmpegcolorspace, viewer->transform, videosink, NULL);
-               gst_element_link_many (viewer->appsrc, ffmpegcolorspace,
+                                 videoconvert, viewer->transform, videosink, NULL);
+               gst_element_link_many (viewer->appsrc, videoconvert,
                                       viewer->transform, videosink, NULL);
        }
 
@@ -683,8 +677,10 @@ arv_viewer_select_camera_cb (GtkComboBox *combo_box, ArvViewer *viewer)
        gst_app_src_set_caps (GST_APP_SRC (viewer->appsrc), caps);
        gst_caps_unref (caps);
 
+       g_object_set(G_OBJECT (viewer->appsrc), "format", GST_FORMAT_TIME, NULL);
+
        bus = gst_pipeline_get_bus (GST_PIPELINE (viewer->pipeline));
-       gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, viewer);
+       gst_bus_set_sync_handler (bus, (GstBusSyncHandler) bus_sync_handler, viewer, NULL);
        gst_object_unref (bus);
 
        gst_element_set_state (viewer->pipeline, GST_STATE_PLAYING);
@@ -842,13 +838,13 @@ _gstreamer_plugin_check (void)
 
        static char *plugins[] = {
                "appsrc",
-               "ffmpegcolorspace",
+               "videoconvert",
                "videoflip",
                "autovideosink",
                "bayer2rgb"
        };
 
-       registry = gst_registry_get_default ();
+       registry = gst_registry_get ();
 
        for (i = 0; i < G_N_ELEMENTS (plugins); i++) {
                GstPluginFeature *feature;


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