[longomatch: 2/3] libcesarplayer: store the last buffer
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch: 2/3] libcesarplayer: store the last buffer
- Date: Wed, 3 Oct 2012 01:30:06 +0000 (UTC)
commit 9af49500a1916c0e5635cfcca4a1f5cfe6041c59
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Wed Oct 3 03:26:28 2012 +0200
libcesarplayer: store the last buffer
libcesarplayer/gst-camera-capturer.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/libcesarplayer/gst-camera-capturer.c b/libcesarplayer/gst-camera-capturer.c
index e0f7c65..0d289c3 100644
--- a/libcesarplayer/gst-camera-capturer.c
+++ b/libcesarplayer/gst-camera-capturer.c
@@ -1418,6 +1418,17 @@ gst_camera_capturer_link_preview (GstCameraCapturer *gcc)
gst_element_set_state(gcc->priv->decoder_bin, GST_STATE_PLAYING);
}
+static gboolean
+cb_last_buffer (GstPad *pad, GstBuffer *buf, GstCameraCapturer *gcc){
+ if (buf != NULL) {
+ if (gcc->priv->last_buffer != NULL)
+ gst_buffer_unref(buf);
+ gst_buffer_ref(buf);
+ gcc->priv->last_buffer = buf;
+ }
+ return TRUE;
+}
+
static void
cb_new_prev_pad (GstElement * element, GstPad * pad, GstElement *bin)
{
@@ -1432,7 +1443,7 @@ static void
gst_camera_capturer_create_preview(GstCameraCapturer *gcc)
{
GstElement *v_decoder, *video_bin;
- GstPad *video_pad;
+ GstPad *video_pad, *last_buf_pad;
v_decoder = gst_element_factory_make("decodebin2", "preview-decoder");
@@ -1444,6 +1455,10 @@ gst_camera_capturer_create_preview(GstCameraCapturer *gcc)
g_signal_connect (v_decoder, "pad-added", G_CALLBACK (cb_new_prev_pad), video_bin);
+ video_pad = gst_element_get_static_pad(video_bin, "sink");
+ gst_pad_add_buffer_probe (video_pad, (GCallback) cb_last_buffer, gcc);
+ gst_object_unref(video_pad);
+
/* Create ghost pads */
video_pad = gst_element_get_static_pad (v_decoder, "sink");
gst_element_add_pad (gcc->priv->preview_bin, gst_ghost_pad_new ("video", video_pad));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]