summaryrefslogtreecommitdiff
path: root/gst/videomixer/videomixer2.c
diff options
context:
space:
mode:
authorSangchul Lee <sc11.lee@samsung.com>2012-08-21 22:53:54 +0900
committerSangchul Lee <sc11.lee@samsung.com>2012-08-21 22:53:54 +0900
commitbaa3403ebe3f0028ca826fb8d7f56e9cbed05356 (patch)
tree7765d941dd576fcd3bf0cb297894e55fbbfe3207 /gst/videomixer/videomixer2.c
parentb1065bf2a5159183bde18dcd95c988ea42b86f83 (diff)
downloadgst-plugins-good0.10-master.tar.gz
gst-plugins-good0.10-master.tar.bz2
gst-plugins-good0.10-master.zip
Diffstat (limited to 'gst/videomixer/videomixer2.c')
-rw-r--r--gst/videomixer/videomixer2.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/gst/videomixer/videomixer2.c b/gst/videomixer/videomixer2.c
index 76bbe59..585f3aa 100644
--- a/gst/videomixer/videomixer2.c
+++ b/gst/videomixer/videomixer2.c
@@ -86,6 +86,10 @@
#include "config.h"
#endif
+/* FIXME 0.11: suppress warnings for deprecated API such as GStaticRecMutex
+ * with newer GLib versions (>= 2.31.0) */
+#define GLIB_DISABLE_DEPRECATION_WARNINGS
+
#include <string.h>
#include "videomixer2.h"
@@ -93,6 +97,8 @@
#include <gst/controller/gstcontroller.h>
+#include "gst/glib-compat-private.h"
+
#ifdef DISABLE_ORC
#define orc_memset memset
#else
@@ -760,7 +766,7 @@ gst_videomixer2_fill_queues (GstVideoMixer2 * mix,
if (buf == mixcol->queued) {
gst_buffer_unref (buf);
- gst_buffer_replace (mixcol->queued, NULL);
+ gst_buffer_replace (&mixcol->queued, NULL);
} else {
gst_buffer_unref (buf);
buf = gst_collect_pads2_pop (mix->collect, &mixcol->collect);
@@ -770,6 +776,7 @@ gst_videomixer2_fill_queues (GstVideoMixer2 * mix,
} else if (start_time >= output_end_time) {
GST_DEBUG_OBJECT (pad, "Keeping buffer until %" GST_TIME_FORMAT,
GST_TIME_ARGS (start_time));
+ gst_buffer_unref (buf);
eos = FALSE;
} else {
GST_DEBUG_OBJECT (pad, "Too old buffer -- dropping");
@@ -1576,8 +1583,9 @@ done:
}
static GstFlowReturn
-gst_videomixer2_sink_prepare_buffer (GstCollectPads2 * pads,
- GstCollectData2 * data, GstBuffer * buf, GstVideoMixer2 * mix)
+gst_videomixer2_sink_clip (GstCollectPads2 * pads,
+ GstCollectData2 * data, GstBuffer * buf, GstBuffer ** outbuf,
+ GstVideoMixer2 * mix)
{
GstVideoMixer2Pad *pad = GST_VIDEO_MIXER2_PAD (data->pad);
GstVideoMixer2Collect *mixcol = pad->mixcol;
@@ -1586,14 +1594,17 @@ gst_videomixer2_sink_prepare_buffer (GstCollectPads2 * pads,
start_time = GST_BUFFER_TIMESTAMP (buf);
if (start_time == -1) {
GST_ERROR_OBJECT (pad, "Timestamped buffers required!");
+ gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
end_time = GST_BUFFER_DURATION (buf);
if (end_time == -1)
end_time = gst_util_uint64_scale_int (GST_SECOND, pad->fps_d, pad->fps_n);
- if (end_time == -1)
+ if (end_time == -1) {
+ *outbuf = buf;
return GST_FLOW_OK;
+ }
start_time = MAX (start_time, mixcol->collect.segment.start);
start_time =
@@ -1614,9 +1625,12 @@ gst_videomixer2_sink_prepare_buffer (GstCollectPads2 * pads,
}
if (mixcol->buffer != NULL && end_time < mixcol->end_time) {
- return GST_COLLECT_PADS2_FLOW_DROP;
+ gst_buffer_unref (buf);
+ *outbuf = NULL;
+ return GST_FLOW_OK;
}
+ *outbuf = buf;
return GST_FLOW_OK;
}
@@ -1923,10 +1937,8 @@ gst_videomixer2_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_factory));
+ gst_element_class_add_static_pad_template (element_class, &src_factory);
+ gst_element_class_add_static_pad_template (element_class, &sink_factory);
gst_element_class_set_details_simple (element_class, "Video mixer 2",
"Filter/Editor/Video",
@@ -1987,8 +1999,8 @@ gst_videomixer2_init (GstVideoMixer2 * mix, GstVideoMixer2Class * g_class)
mix);
gst_collect_pads2_set_event_function (mix->collect,
(GstCollectPads2EventFunction) gst_videomixer2_sink_event, mix);
- gst_collect_pads2_set_prepare_buffer_function (mix->collect,
- (GstCollectPads2BufferFunction) gst_videomixer2_sink_prepare_buffer, mix);
+ gst_collect_pads2_set_clip_function (mix->collect,
+ (GstCollectPads2ClipFunction) gst_videomixer2_sink_clip, mix);
mix->lock = g_mutex_new ();
/* initialize variables */