2011-02-03 15:02:14 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
|
|
|
* Copyright (C) 2008 Nokia Corporation <multimedia@maemo.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2011-02-03 15:02:14 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:camerabingeneral
|
|
|
|
* @short_description: helper functions for #GstCameraBin and it's modules
|
|
|
|
*
|
2020-06-23 14:03:04 +00:00
|
|
|
* Common helper functions for #GstCameraBin.
|
2011-02-03 15:02:14 +00:00
|
|
|
*
|
|
|
|
*/
|
2018-09-24 10:52:22 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
#include <gst/app/gstappsrc.h>
|
|
|
|
#include <gst/app/gstappsink.h>
|
2012-01-27 14:49:58 +00:00
|
|
|
#include <gst/glib-compat-private.h>
|
2011-02-03 15:02:14 +00:00
|
|
|
#include "gstcamerabinpreview.h"
|
|
|
|
#include "gstbasecamerasrc.h"
|
|
|
|
|
2011-10-31 09:59:53 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (base_camera_src_debug);
|
|
|
|
#define GST_CAT_DEFAULT base_camera_src_debug
|
|
|
|
|
2011-04-08 12:22:11 +00:00
|
|
|
static void _gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData *
|
|
|
|
preview, GstCaps * caps);
|
|
|
|
|
2011-04-11 18:33:20 +00:00
|
|
|
static gboolean
|
|
|
|
bus_callback (GstBus * bus, GstMessage * message, gpointer user_data)
|
|
|
|
{
|
|
|
|
switch (GST_MESSAGE_TYPE (message)) {
|
|
|
|
case GST_MESSAGE_ERROR:{
|
|
|
|
GError *err;
|
|
|
|
GstCameraBinPreviewPipelineData *data;
|
|
|
|
|
|
|
|
data = user_data;
|
|
|
|
|
|
|
|
gst_message_parse_error (message, &err, NULL);
|
|
|
|
GST_WARNING ("Error from preview pipeline: %s", err->message);
|
|
|
|
g_error_free (err);
|
|
|
|
|
|
|
|
/* TODO Not sure if we should post an Error or Warning here */
|
2020-07-28 10:27:37 +00:00
|
|
|
GST_ELEMENT_ERROR (data->element, CORE, FAILED,
|
2011-04-11 18:33:20 +00:00
|
|
|
("fatal error in preview pipeline, disposing the pipeline"), (NULL));
|
|
|
|
|
|
|
|
/* Possible error situations:
|
|
|
|
* 1) cond_wait pending. prevent deadlock by signalling the cond
|
|
|
|
* 2) preview_pipeline_post called with new buffer to handle. returns
|
|
|
|
* because data->pipeline is set to null
|
|
|
|
* 3) new preview caps incoming. returns because data->pipeline is null
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (data->pipeline) {
|
|
|
|
gst_element_set_state (data->pipeline, GST_STATE_NULL);
|
|
|
|
gst_object_unref (data->pipeline);
|
|
|
|
data->pipeline = NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_cond_signal (&data->processing_cond);
|
2011-04-11 18:33:20 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
static GstFlowReturn
|
2011-12-01 15:59:14 +00:00
|
|
|
gst_camerabin_preview_pipeline_new_sample (GstAppSink * appsink,
|
2011-02-03 15:02:14 +00:00
|
|
|
gpointer user_data)
|
|
|
|
{
|
2011-12-01 15:59:14 +00:00
|
|
|
GstSample *sample;
|
2011-02-03 15:02:14 +00:00
|
|
|
GstStructure *s;
|
|
|
|
GstMessage *msg;
|
|
|
|
GstCameraBinPreviewPipelineData *data;
|
|
|
|
|
|
|
|
data = user_data;
|
|
|
|
|
2011-12-01 15:59:14 +00:00
|
|
|
sample = gst_app_sink_pull_sample (appsink);
|
2011-02-03 15:02:14 +00:00
|
|
|
s = gst_structure_new (GST_BASE_CAMERA_SRC_PREVIEW_MESSAGE_NAME,
|
2011-12-01 15:59:14 +00:00
|
|
|
"sample", GST_TYPE_SAMPLE, sample, NULL);
|
|
|
|
gst_sample_unref (sample);
|
2011-02-03 15:02:14 +00:00
|
|
|
msg = gst_message_new_element (GST_OBJECT (data->element), s);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (data->element, "sending message with preview image");
|
|
|
|
if (gst_element_post_message (data->element, msg) == FALSE) {
|
|
|
|
GST_WARNING_OBJECT (data->element,
|
|
|
|
"This element has no bus, therefore no message sent!");
|
|
|
|
}
|
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_lock (&data->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
|
|
|
data->processing--;
|
|
|
|
if (data->processing == 0)
|
2012-01-19 10:34:26 +00:00
|
|
|
g_cond_signal (&data->processing_cond);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_unlock (&data->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_camerabin_create_preview_pipeline:
|
|
|
|
* @element: Owner of this pipeline
|
|
|
|
* @filter: Custom filter to process preview data (an extra ref is taken)
|
|
|
|
*
|
|
|
|
* Creates a new previewing pipeline that can receive buffers
|
|
|
|
* to be posted as camerabin preview messages for @element
|
|
|
|
*
|
|
|
|
* Returns: The newly created #GstCameraBinPreviewPipelineData
|
|
|
|
*/
|
|
|
|
GstCameraBinPreviewPipelineData *
|
|
|
|
gst_camerabin_create_preview_pipeline (GstElement * element,
|
|
|
|
GstElement * filter)
|
|
|
|
{
|
|
|
|
GstCameraBinPreviewPipelineData *data;
|
|
|
|
GstElement *csp;
|
|
|
|
GstElement *vscale;
|
|
|
|
gboolean added = FALSE;
|
2011-08-31 16:28:25 +00:00
|
|
|
gboolean linkfail = FALSE;
|
2011-04-11 18:33:20 +00:00
|
|
|
GstBus *bus;
|
2011-02-03 15:02:14 +00:00
|
|
|
GstAppSinkCallbacks callbacks = { 0, };
|
|
|
|
|
2011-10-03 18:26:14 +00:00
|
|
|
data = g_new0 (GstCameraBinPreviewPipelineData, 1);
|
2011-02-03 15:02:14 +00:00
|
|
|
|
|
|
|
data->pipeline = gst_pipeline_new ("preview-pipeline");
|
|
|
|
data->appsrc = gst_element_factory_make ("appsrc", "preview-appsrc");
|
|
|
|
data->appsink = gst_element_factory_make ("appsink", "preview-appsink");
|
2012-05-01 13:18:52 +00:00
|
|
|
csp = gst_element_factory_make ("videoconvert", "preview-vconv");
|
2011-02-03 15:02:14 +00:00
|
|
|
vscale = gst_element_factory_make ("videoscale", "preview-vscale");
|
|
|
|
|
2011-09-27 16:04:21 +00:00
|
|
|
if (!data->appsrc || !data->appsink || !csp || !vscale) {
|
2011-02-03 15:02:14 +00:00
|
|
|
goto error;
|
|
|
|
}
|
|
|
|
|
2011-09-01 23:01:09 +00:00
|
|
|
g_object_set (data->appsrc, "emit-signals", FALSE, NULL);
|
2012-05-01 13:26:27 +00:00
|
|
|
g_object_set (data->appsink, "sync", FALSE, "enable-last-sample",
|
2011-09-06 13:49:04 +00:00
|
|
|
FALSE, NULL);
|
2011-09-01 23:01:09 +00:00
|
|
|
|
2011-09-27 16:04:21 +00:00
|
|
|
gst_bin_add_many (GST_BIN (data->pipeline), data->appsrc,
|
2011-09-05 12:55:53 +00:00
|
|
|
data->appsink, csp, vscale, NULL);
|
2011-02-03 15:02:14 +00:00
|
|
|
if (filter)
|
|
|
|
gst_bin_add (GST_BIN (data->pipeline), gst_object_ref (filter));
|
|
|
|
added = TRUE;
|
|
|
|
|
|
|
|
if (filter) {
|
2011-08-31 16:28:25 +00:00
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (data->appsrc, "src",
|
|
|
|
filter, NULL, GST_PAD_LINK_CHECK_NOTHING));
|
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (filter, NULL,
|
2011-09-05 12:55:53 +00:00
|
|
|
vscale, "sink", GST_PAD_LINK_CHECK_CAPS));
|
2011-02-03 15:02:14 +00:00
|
|
|
} else {
|
2011-08-31 16:28:25 +00:00
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (data->appsrc, "src",
|
2011-09-05 12:55:53 +00:00
|
|
|
vscale, "sink", GST_PAD_LINK_CHECK_NOTHING));
|
2011-08-31 16:28:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
linkfail |=
|
2011-09-05 12:55:53 +00:00
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (vscale, "src", csp,
|
2011-08-31 16:28:25 +00:00
|
|
|
"sink", GST_PAD_LINK_CHECK_NOTHING));
|
|
|
|
linkfail |=
|
2011-09-05 12:55:53 +00:00
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (csp, "src",
|
2011-08-31 16:28:25 +00:00
|
|
|
data->appsink, "sink", GST_PAD_LINK_CHECK_NOTHING));
|
|
|
|
|
|
|
|
if (linkfail) {
|
|
|
|
GST_WARNING ("Failed to link preview pipeline elements");
|
|
|
|
goto error;
|
2011-02-03 15:02:14 +00:00
|
|
|
}
|
|
|
|
|
2011-12-01 15:59:14 +00:00
|
|
|
callbacks.new_sample = gst_camerabin_preview_pipeline_new_sample;
|
2011-02-03 15:02:14 +00:00
|
|
|
gst_app_sink_set_callbacks ((GstAppSink *) data->appsink, &callbacks, data,
|
|
|
|
NULL);
|
|
|
|
|
2011-04-11 18:33:20 +00:00
|
|
|
bus = gst_pipeline_get_bus (GST_PIPELINE (data->pipeline));
|
|
|
|
gst_bus_add_watch (bus, bus_callback, data);
|
|
|
|
gst_object_unref (bus);
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
data->element = element;
|
|
|
|
data->filter = filter;
|
2011-10-31 09:59:53 +00:00
|
|
|
data->vscale = vscale;
|
2011-02-03 15:02:14 +00:00
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_init (&data->processing_lock);
|
|
|
|
g_cond_init (&data->processing_cond);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
|
|
|
data->pending_preview_caps = NULL;
|
|
|
|
data->processing = 0;
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
return data;
|
|
|
|
error:
|
|
|
|
GST_WARNING ("Failed to create camerabin's preview pipeline");
|
|
|
|
if (!added) {
|
|
|
|
if (csp)
|
|
|
|
gst_object_unref (csp);
|
|
|
|
if (vscale)
|
|
|
|
gst_object_unref (vscale);
|
|
|
|
if (data->appsrc)
|
|
|
|
gst_object_unref (data->appsrc);
|
|
|
|
if (data->appsink)
|
|
|
|
gst_object_unref (data->appsink);
|
|
|
|
}
|
|
|
|
gst_camerabin_destroy_preview_pipeline (data);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_camerabin_destroy_preview_pipeline:
|
|
|
|
* @preview: the #GstCameraBinPreviewPipelineData
|
|
|
|
*
|
|
|
|
* Frees a #GstCameraBinPreviewPipelineData
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_camerabin_destroy_preview_pipeline (GstCameraBinPreviewPipelineData *
|
|
|
|
preview)
|
|
|
|
{
|
2011-09-20 16:00:49 +00:00
|
|
|
g_return_if_fail (preview != NULL);
|
|
|
|
|
2015-02-17 00:34:55 +00:00
|
|
|
g_mutex_clear (&preview->processing_lock);
|
|
|
|
g_cond_clear (&preview->processing_cond);
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
if (preview->pipeline) {
|
2016-07-15 09:48:25 +00:00
|
|
|
GstBus *bus;
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
gst_element_set_state (preview->pipeline, GST_STATE_NULL);
|
2016-07-15 09:48:25 +00:00
|
|
|
|
|
|
|
bus = gst_pipeline_get_bus (GST_PIPELINE (preview->pipeline));
|
|
|
|
gst_bus_remove_watch (bus);
|
|
|
|
gst_object_unref (bus);
|
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
gst_object_unref (preview->pipeline);
|
|
|
|
}
|
|
|
|
g_free (preview);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_camerabin_preview_pipeline_post:
|
|
|
|
* @preview: the #GstCameraBinPreviewPipelineData
|
2012-07-29 03:53:29 +00:00
|
|
|
* @sample: the sample to be posted as a preview
|
2011-02-03 15:02:14 +00:00
|
|
|
*
|
2012-07-29 03:53:29 +00:00
|
|
|
* Converts the @sample to the desired format and posts the preview
|
2011-02-03 15:02:14 +00:00
|
|
|
* message to the bus.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE on success
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_camerabin_preview_pipeline_post (GstCameraBinPreviewPipelineData * preview,
|
2012-07-29 03:53:29 +00:00
|
|
|
GstSample * sample)
|
2011-02-03 15:02:14 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (preview != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (preview->pipeline != NULL, FALSE);
|
2012-07-29 03:53:29 +00:00
|
|
|
g_return_val_if_fail (sample, FALSE);
|
2011-02-03 15:02:14 +00:00
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_lock (&preview->processing_lock);
|
2011-04-11 18:33:20 +00:00
|
|
|
g_return_val_if_fail (preview->pipeline != NULL, FALSE);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
|
|
|
if (preview->pending_preview_caps) {
|
|
|
|
if (preview->processing > 0) {
|
2012-01-19 10:34:26 +00:00
|
|
|
g_cond_wait (&preview->processing_cond, &preview->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
}
|
|
|
|
_gst_camerabin_preview_set_caps (preview, preview->pending_preview_caps);
|
|
|
|
gst_caps_replace (&preview->pending_preview_caps, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
preview->processing++;
|
|
|
|
|
2012-07-29 03:53:29 +00:00
|
|
|
g_object_set (preview->appsrc, "caps", gst_sample_get_caps (sample), NULL);
|
2011-02-03 15:02:14 +00:00
|
|
|
gst_app_src_push_buffer ((GstAppSrc *) preview->appsrc,
|
2012-07-29 03:53:29 +00:00
|
|
|
gst_buffer_ref (gst_sample_get_buffer (sample)));
|
2011-02-03 15:02:14 +00:00
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_unlock (&preview->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
2011-02-03 15:02:14 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-04-08 12:22:11 +00:00
|
|
|
static void
|
|
|
|
_gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview,
|
2011-02-03 15:02:14 +00:00
|
|
|
GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstState state, pending;
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
g_return_if_fail (preview != NULL);
|
2011-04-11 18:33:20 +00:00
|
|
|
g_return_if_fail (preview->pipeline != NULL);
|
2011-02-03 15:02:14 +00:00
|
|
|
|
|
|
|
ret = gst_element_get_state (preview->pipeline, &state, &pending, 0);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE) {
|
|
|
|
/* make it try again */
|
|
|
|
state = GST_STATE_PLAYING;
|
|
|
|
pending = GST_STATE_VOID_PENDING;
|
|
|
|
}
|
|
|
|
gst_element_set_state (preview->pipeline, GST_STATE_NULL);
|
2011-09-27 16:04:21 +00:00
|
|
|
g_object_set (preview->appsink, "caps", caps, NULL);
|
2011-02-03 15:02:14 +00:00
|
|
|
if (pending != GST_STATE_VOID_PENDING)
|
|
|
|
state = pending;
|
|
|
|
gst_element_set_state (preview->pipeline, state);
|
|
|
|
}
|
2011-04-08 12:22:11 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_camerabin_preview_set_caps:
|
|
|
|
* @preview: the #GstCameraBinPreviewPipelineData
|
|
|
|
* @caps: the #GstCaps to be set (a new ref will be taken)
|
|
|
|
*
|
|
|
|
* The caps that preview buffers should have when posted
|
|
|
|
* on the bus
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_camerabin_preview_set_caps (GstCameraBinPreviewPipelineData * preview,
|
|
|
|
GstCaps * caps)
|
|
|
|
{
|
|
|
|
g_return_if_fail (preview != NULL);
|
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_lock (&preview->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
|
|
|
|
if (preview->processing == 0) {
|
|
|
|
_gst_camerabin_preview_set_caps (preview, caps);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Preview pipeline busy, storing new caps as pending");
|
|
|
|
gst_caps_replace (&preview->pending_preview_caps, caps);
|
|
|
|
}
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_unlock (&preview->processing_lock);
|
2011-04-08 12:22:11 +00:00
|
|
|
}
|
2011-10-31 09:59:53 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_camerabin_preview_set_filter:
|
|
|
|
* @preview: the #GstCameraBinPreviewPipelineData
|
|
|
|
* @filter: Custom filter to process preview data (an extra ref is taken)
|
|
|
|
*
|
|
|
|
* Set the filter element into preview pipeline.
|
|
|
|
*
|
|
|
|
* Returns: %TRUE on success
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_camerabin_preview_set_filter (GstCameraBinPreviewPipelineData * preview,
|
|
|
|
GstElement * filter)
|
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
GstState current;
|
|
|
|
|
|
|
|
g_return_val_if_fail (preview != NULL, FALSE);
|
|
|
|
|
|
|
|
GST_DEBUG ("Preview pipeline setting new filter %p", filter);
|
|
|
|
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_lock (&preview->processing_lock);
|
2011-10-31 09:59:53 +00:00
|
|
|
|
|
|
|
gst_element_get_state (preview->pipeline, ¤t, NULL, 0);
|
|
|
|
|
|
|
|
if (preview->processing == 0 && current == GST_STATE_NULL) {
|
|
|
|
gboolean linkfail = FALSE;
|
|
|
|
|
|
|
|
if (preview->filter) {
|
|
|
|
/* Unlink and remove old filter */
|
|
|
|
gst_element_unlink (preview->appsrc, preview->filter);
|
|
|
|
gst_element_unlink (preview->filter, preview->vscale);
|
|
|
|
gst_bin_remove (GST_BIN (preview->pipeline), preview->filter);
|
|
|
|
} else {
|
|
|
|
/* Make room for filter by breaking the link between appsrc and vcale */
|
|
|
|
gst_element_unlink (preview->appsrc, preview->vscale);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (filter) {
|
|
|
|
/* Add and link the new filter between appsrc and vscale */
|
|
|
|
gst_bin_add (GST_BIN (preview->pipeline), gst_object_ref (filter));
|
|
|
|
|
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (preview->appsrc,
|
|
|
|
"src", filter, NULL, GST_PAD_LINK_CHECK_NOTHING));
|
|
|
|
|
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (filter, NULL,
|
|
|
|
preview->vscale, "sink", GST_PAD_LINK_CHECK_CAPS));
|
|
|
|
} else {
|
|
|
|
/* No filter was given. Just link the appsrc to vscale directly */
|
|
|
|
linkfail |=
|
|
|
|
GST_PAD_LINK_FAILED (gst_element_link_pads_full (preview->appsrc,
|
|
|
|
"src", preview->vscale, "sink", GST_PAD_LINK_CHECK_NOTHING));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (linkfail) {
|
|
|
|
GST_WARNING ("Linking the filter to pipeline failed");
|
|
|
|
ret = FALSE;
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Linking the filter to pipeline successful");
|
|
|
|
preview->filter = filter;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Cannot change filter when pipeline is running");
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
2012-01-19 10:34:26 +00:00
|
|
|
g_mutex_unlock (&preview->processing_lock);
|
2011-10-31 09:59:53 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|