[byzanz] Port to gstreamer-1.0



commit f8f233b9b446139ee13677ce13a060ae8af9c1b2
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Mar 19 03:40:58 2013 -0400

    Port to gstreamer-1.0

 configure.ac                 |    3 +--
 src/byzanzencoderflv.c       |    4 ++--
 src/byzanzencodergstreamer.c |   29 +++++++++++++++++------------
 src/byzanzencoderogv.c       |   10 +++++-----
 src/byzanzencoderwebm.c      |    8 ++++----
 5 files changed, 29 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index e32c9c7..6c2ef06 100644
--- a/configure.ac
+++ b/configure.ac
@@ -69,7 +69,6 @@ CAIRO_REQ="1.10"
 GTK_REQ="3.0.0"
 APPLET_REQ="2.91.91"
 XDAMAGE_REQ="1.0"
-GST_REQ="0.10.24"
 GIO_REQ="2.35"
 
 PKG_CHECK_MODULES(GTK, cairo >= $CAIRO_REQ gtk+-3.0 >= $GTK_REQ x11 gio-2.0 >= $GIO_REQ)
@@ -84,7 +83,7 @@ AS_IF([test x$have_applet = xyes],
       [appletdir=`$PKG_CONFIG --variable=libpanel_applet_dir $LIBPANEL_APPLET`
        AC_SUBST(appletdir)],[])
 
-PKG_CHECK_MODULES(GST, gstreamer-app-0.10 >= $GST_REQ gstreamer-0.10 >= $GST_REQ)
+PKG_CHECK_MODULES(GST, gstreamer-app-1.0 gstreamer-1.0)
 
 GIFENC_CFLAGS="$GTK_CFLAGS $ERROR_CFLAGS"
 GIFENC_LIBS="$GTK_LIBS"
diff --git a/src/byzanzencoderflv.c b/src/byzanzencoderflv.c
index fba8fcc..9ad61b2 100644
--- a/src/byzanzencoderflv.c
+++ b/src/byzanzencoderflv.c
@@ -40,10 +40,10 @@ byzanz_encoder_flv_class_init (ByzanzEncoderFlvClass *klass)
   gtk_file_filter_add_pattern (encoder_class->filter, "*.flv");
 
   gstreamer_class->pipeline_string = 
-    "appsrc name=src ! ffmpegcolorspace ! ffenc_flashsv buffer-size=8388608 ! flvmux ! giostreamsink 
name=sink";
+    "appsrc name=src ! videoconvert ! avenc_flashsv buffer-size=8388608 ! flvmux ! giostreamsink name=sink";
   gstreamer_class->audio_pipeline_string = 
     "autoaudiosrc name=audiosrc ! audioconvert ! audio/x-raw-int,width=16 ! queue ! flvmux name=muxer ! 
giostreamsink name=sink "
-    "appsrc name=src ! ffmpegcolorspace ! ffenc_flashsv buffer-size=8388608 ! muxer.";
+    "appsrc name=src ! videoconvert ! avenc_flashsv buffer-size=8388608 ! muxer.";
 }
 
 static void
diff --git a/src/byzanzencodergstreamer.c b/src/byzanzencodergstreamer.c
index e8e9cf7..5df55b3 100644
--- a/src/byzanzencodergstreamer.c
+++ b/src/byzanzencodergstreamer.c
@@ -24,7 +24,6 @@
 #include "byzanzencodergstreamer.h"
 
 #include <glib/gi18n-lib.h>
-#include <gst/app/gstappbuffer.h>
 #include <gst/video/video.h>
 
 #include "byzanzserialize.h"
@@ -87,12 +86,14 @@ byzanz_encoder_gstreamer_need_data (GstAppSrc *src, guint length, gpointer data)
   /* create a buffer and send it */
   /* FIXME: stride just works? */
   cairo_surface_reference (gst->surface);
-  buffer = gst_app_buffer_new (cairo_image_surface_get_data (gst->surface),
-      cairo_image_surface_get_stride (gst->surface) * cairo_image_surface_get_height (gst->surface),
-      (GstAppBufferFinalizeFunc) cairo_surface_destroy, gst->surface);
-  GST_BUFFER_FLAG_SET (buffer, GST_BUFFER_FLAG_READONLY);
+  buffer = gst_buffer_new_wrapped_full (GST_MEMORY_FLAG_READONLY,
+                                        cairo_image_surface_get_data (gst->surface),
+                                        cairo_image_surface_get_stride (gst->surface) * 
cairo_image_surface_get_height (gst->surface),
+                                        0,
+                                        cairo_image_surface_get_stride (gst->surface) * 
cairo_image_surface_get_height (gst->surface),
+                                        gst->surface,
+                                        (GDestroyNotify) cairo_surface_destroy);
   GST_BUFFER_TIMESTAMP (buffer) = msecs * GST_MSECOND;
-  gst_buffer_set_caps (buffer, gst->caps);
   gst_app_src_push_buffer (gst->src, buffer);
 }
 
@@ -144,22 +145,26 @@ byzanz_encoder_gstreamer_run (ByzanzEncoder * encoder,
   g_object_set (sink, "stream", output, NULL);
   g_object_unref (sink);
 
+  gstreamer->caps = gst_caps_new_simple ("video/x-raw",
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-  gstreamer->caps = gst_caps_from_string (GST_VIDEO_CAPS_BGRx);
+                                         "format", G_TYPE_STRING, "BGRx",
 #elif G_BYTE_ORDER == G_BIG_ENDIAN
-  gstreamer->caps = gst_caps_from_string (GST_VIDEO_CAPS_xRGB);
+                                         "format", G_TYPE_STRING, "xRGB",
 #else
 #error "Please add the Cairo caps format here"
 #endif
-  gst_caps_set_simple (gstreamer->caps,
-      "width", G_TYPE_INT, width, 
-      "height", G_TYPE_INT, height,
-      "framerate", GST_TYPE_FRACTION, 0, 1, NULL);
+                                         "width", G_TYPE_INT, width,
+                                         "height", G_TYPE_INT, height,
+                                         "framerate", GST_TYPE_FRACTION, 0, 1, NULL);
   g_assert (gst_caps_is_fixed (gstreamer->caps));
 
   gst_app_src_set_caps (gstreamer->src, gstreamer->caps);
   gst_app_src_set_callbacks (gstreamer->src, &callbacks, gstreamer, NULL);
   gst_app_src_set_stream_type (gstreamer->src, GST_APP_STREAM_TYPE_STREAM);
+  gst_app_src_set_max_bytes (gstreamer->src, 0);
+  g_object_set (gstreamer->src,
+                "format", GST_FORMAT_TIME,
+                NULL);
 
   if (!gst_element_set_state (gstreamer->pipeline, GST_STATE_PLAYING)) {
     g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, _("Failed to start GStreamer pipeline"));
diff --git a/src/byzanzencoderogv.c b/src/byzanzencoderogv.c
index f834b77..2d24a3e 100644
--- a/src/byzanzencoderogv.c
+++ b/src/byzanzencoderogv.c
@@ -41,12 +41,12 @@ byzanz_encoder_ogv_class_init (ByzanzEncoderOgvClass *klass)
   gtk_file_filter_add_pattern (encoder_class->filter, "*.ogg");
 
   gstreamer_class->pipeline_string = 
-    "appsrc name=src ! ffmpegcolorspace ! videorate ! "
-    "video/x-raw-yuv,framerate=25/1 ! theoraenc ! oggmux ! giostreamsink name=sink";
+    "appsrc name=src ! videoconvert ! videorate !"
+    "video/x-raw,format=Y444,framerate=25/1 ! theoraenc ! oggmux ! giostreamsink name=sink";
   gstreamer_class->audio_pipeline_string = 
-    "autoaudiosrc name=audiosrc ! audioconvert ! vorbisenc ! queue ! oggmux name=muxer ! giostreamsink 
name=sink "
-    "appsrc name=src ! ffmpegcolorspace ! videorate ! "
-    "video/x-raw-yuv,framerate=25/1 ! theoraenc ! queue ! muxer.";
+    "autoaudiosrc name=audiosrc ! audioconvert ! queue ! oggmux name=muxer ! giostreamsink name=sink "
+    "appsrc name=src ! videoconvert ! videorate ! "
+    "video/x-raw,format=Y444,framerate=25/1 ! theoraenc ! queue ! muxer.";
 }
 
 static void
diff --git a/src/byzanzencoderwebm.c b/src/byzanzencoderwebm.c
index bb6215e..bd49e35 100644
--- a/src/byzanzencoderwebm.c
+++ b/src/byzanzencoderwebm.c
@@ -40,12 +40,12 @@ byzanz_encoder_webm_class_init (ByzanzEncoderWebmClass *klass)
   gtk_file_filter_add_pattern (encoder_class->filter, "*.webm");
 
   gstreamer_class->pipeline_string = 
-    "appsrc name=src ! ffmpegcolorspace ! videorate ! "
-    "video/x-raw-yuv,framerate=25/1 ! vp8enc ! webmmux ! giostreamsink name=sink";
+    "appsrc name=src ! videoconvert ! videorate ! "
+    "video/x-raw,format=I420,framerate=25/1 ! vp8enc ! webmmux ! giostreamsink name=sink";
   gstreamer_class->audio_pipeline_string = 
     "autoaudiosrc name=audiosrc ! audioconvert ! vorbisenc ! queue ! webmmux name=muxer ! giostreamsink 
name=sink "
-    "appsrc name=src ! ffmpegcolorspace ! videorate ! "
-    "video/x-raw-yuv,framerate=25/1 ! vp8enc ! queue ! muxer.";
+    "appsrc name=src ! videoconvert ! videorate ! "
+    "video/x-raw,format=I420,framerate=25/1 ! vp8enc ! queue ! muxer.";
 }
 
 static void


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