diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-09-22 07:40:57 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-09-22 07:40:57 +0200 |
commit | 7f309400501fbec2cc00f01211994af38821ca1f (patch) | |
tree | 6dbcd1a8df888950d67eeb3766e5f6995eff18ad /samples | |
parent | 80a5794fc1eef8f54b21b9792cd1fb6f85fb7df0 (diff) |
Update Gst.Buffer bindings
Diffstat (limited to 'samples')
-rw-r--r-- | samples/AppSrc.cs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/samples/AppSrc.cs b/samples/AppSrc.cs index 7a9a3df..da7f676 100644 --- a/samples/AppSrc.cs +++ b/samples/AppSrc.cs @@ -52,15 +52,14 @@ public class AppSrcDemo { ulong mseconds = 0; if (appsrc.Clock != null) mseconds = appsrc.Clock.Time / Clock.MSecond; - byte[] data = DrawData (mseconds); - - Gst.Buffer buffer = new Gst.Buffer (data); + Gst.Buffer buffer = DrawData (mseconds); appsrc.PushBuffer (buffer); } - // Returns a byte[] presentation of one 640x480 BGRA frame using Cairo - static byte[] DrawData (ulong seconds) { - Cairo.ImageSurface img = new Cairo.ImageSurface (Cairo.Format.Argb32, 640, 480); + // Returns a Gst.Buffer presentation of one 640x480 BGRA frame using Cairo + static Gst.Buffer DrawData (ulong seconds) { + Gst.Buffer buffer = new Gst.Buffer (640*480*4); + Cairo.ImageSurface img = new Cairo.ImageSurface (buffer.Data, Cairo.Format.Argb32, 640, 480, 640*4); using (Cairo.Context context = new Cairo.Context (img)) { double dx = (double) (seconds % 2180) / 5; context.Color = new Color (1.0, 1.0, 0); @@ -71,10 +70,8 @@ public class AppSrcDemo { context.Color = new Color (0, 0, 1.0); context.Stroke(); } - - byte[] data = img.Data; img.Destroy(); - return data; + return buffer; } static void MessageHandler (object sender, MessageArgs args) { |