summaryrefslogtreecommitdiffstats
path: root/gst-libs
diff options
context:
space:
mode:
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/play/play.old.c61
-rw-r--r--gst-libs/gst/play/playpipelines.c174
2 files changed, 132 insertions, 103 deletions
diff --git a/gst-libs/gst/play/play.old.c b/gst-libs/gst/play/play.old.c
index 88a370d5..1becf292 100644
--- a/gst-libs/gst/play/play.old.c
+++ b/gst-libs/gst/play/play.old.c
@@ -152,9 +152,10 @@ gst_play_set_property ( GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GstPlay *play = GST_PLAY (object);
-
- g_return_if_fail (GST_IS_PLAY (play));
+ GstPlay *play;
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GST_IS_PLAY (object));
+ play = GST_PLAY (object);
switch (prop_id) {
case ARG_LOCATION:
@@ -178,9 +179,10 @@ gst_play_get_property ( GObject *object,
GValue *value,
GParamSpec *pspec)
{
- GstPlay *play = GST_PLAY (object);
-
- g_return_if_fail (GST_IS_PLAY (play));
+ GstPlay *play;
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GST_IS_PLAY (object));
+ play = GST_PLAY (object);
switch (prop_id) {
case ARG_LOCATION:
@@ -212,12 +214,14 @@ gst_play_get_length_callback (GstPlay *play)
gboolean query_worked = FALSE;
g_print("trying to get length\n");
- if (play->audio_sink_element != NULL){
+ if ( (play->audio_sink_element != NULL) &&
+ (GST_IS_ELEMENT (play->audio_sink_element)) ) {
g_mutex_lock(play->audio_bin_mutex);
query_worked = gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format, &value);
g_mutex_unlock(play->audio_bin_mutex);
}
- else if (play->video_sink_element != NULL){
+ else if ( (play->video_sink_element != NULL) &&
+ (GST_IS_ELEMENT (play->video_sink_element)) ) {
g_mutex_lock(play->video_bin_mutex);
query_worked = gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format, &value);
g_mutex_unlock(play->video_bin_mutex);
@@ -242,7 +246,8 @@ gst_play_tick_callback (GstPlay *play)
{
gint secs;
- g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
play->clock = gst_bin_get_clock (GST_BIN (play->pipeline));
play->time_nanos = gst_clock_get_time(play->clock);
@@ -293,7 +298,8 @@ gst_play_default_idle_add ( GSourceFunc function,
static gboolean
gst_play_idle_callback (GstPlay *play)
{
- g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
return gst_bin_iterate (GST_BIN (play->pipeline));
}
@@ -304,7 +310,8 @@ gst_play_idle_signal (GstPlay *play)
GstPlaySignal *signal;
gint queue_length;
- g_return_val_if_fail(GST_IS_PLAY(play), FALSE);
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
signal = g_async_queue_try_pop(play->signal_queue);
if (signal == NULL){
@@ -457,6 +464,8 @@ callback_pipeline_state_change ( GstElement *element,
{
GstPlaySignal *signal;
+ g_return_if_fail (play != NULL);
+ g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_ELEMENT (element));
g_return_if_fail (GST_IS_PLAY (play));
g_return_if_fail (element == play->pipeline);
@@ -504,6 +513,8 @@ callback_pipeline_state_change ( GstElement *element,
static void
gst_play_dispose (GObject *object)
{
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GST_IS_PLAY(object));
GstPlay *play = GST_PLAY (object);
/* Removing all sources */
@@ -689,6 +700,7 @@ gst_play_seek_to_time ( GstPlay *play,
gboolean video_seek_worked = FALSE;
gboolean visualisation_seek_worked = FALSE;
+ g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
if (time_nanos < 0LL){
play->seek_time = 0LL;
@@ -757,6 +769,7 @@ gst_play_set_idle_timeout_funcs ( GstPlay *play,
GstPlayTimeoutAdd timeout_add_func,
GstPlayIdleAdd idle_add_func)
{
+ g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
play->timeout_add_func = timeout_add_func;
play->idle_add_func = idle_add_func;
@@ -782,6 +795,8 @@ gst_play_get_sink_element ( GstPlay *play,
const GList *pads = NULL;
gboolean has_src, has_correct_type;
+ g_return_val_if_fail (play != NULL, NULL);
+ g_return_val_if_fail (element != NULL, NULL);
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
@@ -885,9 +900,9 @@ GstElementStateReturn
gst_play_set_state ( GstPlay *play,
GstElementState state)
{
+ g_return_val_if_fail (play != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_PLAY (play), GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_ELEMENT(play->pipeline), GST_STATE_FAILURE);
- /*g_print("setting state to %d\n", state);*/
return gst_element_set_state(play->pipeline, state);
}
@@ -903,6 +918,7 @@ gst_play_set_state ( GstPlay *play,
GstElementState
gst_play_get_state (GstPlay *play)
{
+ g_return_val_if_fail (play != NULL, GST_STATE_FAILURE);
g_return_val_if_fail (GST_IS_PLAY (play), GST_STATE_FAILURE);
g_return_val_if_fail (play->pipeline, GST_STATE_FAILURE);
@@ -923,6 +939,7 @@ gst_play_set_location ( GstPlay *play,
const gchar *location)
{
GstElementState current_state;
+ g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (location != NULL, FALSE);
@@ -964,6 +981,7 @@ gchar*
gst_play_get_location (GstPlay *play)
{
gchar* location;
+ g_return_val_if_fail (play != NULL, NULL);
g_return_val_if_fail (GST_IS_PLAY (play), NULL);
g_return_val_if_fail (GST_IS_ELEMENT(play->source), NULL);
g_object_get (G_OBJECT (play->source), "location", &location, NULL);
@@ -981,6 +999,7 @@ void
gst_play_set_volume ( GstPlay *play,
gfloat volume)
{
+ g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
g_object_set(G_OBJECT(play->vol_dparam), "value_float", volume, NULL);
@@ -999,6 +1018,7 @@ gst_play_get_volume (GstPlay *play)
{
gfloat volume;
+ g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
g_object_get(G_OBJECT(play->vol_dparam), "value_float", &volume, NULL);
@@ -1017,6 +1037,7 @@ void
gst_play_set_mute ( GstPlay *play,
gboolean mute)
{
+ g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_PLAY (play));
g_object_set (G_OBJECT (play->volume), "mute", mute, NULL);
@@ -1035,6 +1056,7 @@ gst_play_get_mute (GstPlay *play)
{
gboolean mute;
+ g_return_val_if_fail (play != NULL, 0);
g_return_val_if_fail (GST_IS_PLAY (play), 0);
g_object_get (G_OBJECT (play->volume), "mute", &mute, NULL);
@@ -1061,6 +1083,8 @@ gboolean
gst_play_set_data_src ( GstPlay *play,
GstElement *data_src)
{
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (data_src != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (data_src), FALSE);
@@ -1089,6 +1113,8 @@ gboolean
gst_play_set_video_sink ( GstPlay *play,
GstElement *video_sink)
{
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (video_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
@@ -1117,6 +1143,8 @@ gboolean
gst_play_set_audio_sink ( GstPlay *play,
GstElement *audio_sink)
{
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (audio_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
@@ -1267,12 +1295,3 @@ gst_play_new ( GstPlayPipeType pipe_type,
return play;
}
-
-
-
-
-
-
-
-
-
diff --git a/gst-libs/gst/play/playpipelines.c b/gst-libs/gst/play/playpipelines.c
index 163d1a2d..a357fd56 100644
--- a/gst-libs/gst/play/playpipelines.c
+++ b/gst-libs/gst/play/playpipelines.c
@@ -27,6 +27,8 @@ gst_play_default_set_data_src ( GstPlay *play,
GstElement *datasrc,
GstElement* parent)
{
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (datasrc != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (datasrc), FALSE);
@@ -125,7 +127,7 @@ static gboolean
gst_play_audiot_setup ( GstPlay *play,
GError **error)
{
-
+ g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
/* creating gst_thread */
@@ -183,6 +185,8 @@ static gboolean
gst_play_audiot_set_audio ( GstPlay *play,
GstElement *audio_sink)
{
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (audio_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
@@ -219,7 +223,8 @@ static gboolean
gst_play_audiot_set_auto ( GstPlay *play,
GstElement *autoplugger)
{
-
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (autoplugger != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
@@ -251,6 +256,7 @@ gst_play_audioht_setup ( GstPlay *play,
{
GstElement *audio_thread, *audio_queue;
+ g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
/*
@@ -337,6 +343,8 @@ gst_play_audioht_set_audio ( GstPlay *play,
{
GstElement *audio_thread;
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (audio_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
@@ -377,6 +385,8 @@ gst_play_audioht_set_auto ( GstPlay *play,
{
GstElement *audio_thread;
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (autoplugger != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
@@ -413,6 +423,7 @@ gst_play_video_setup ( GstPlay *play,
GstElement *video_queue, *video_bin;
GstElement *work_thread, *colorspace;
+ g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
/* creating pipeline */
@@ -558,7 +569,10 @@ gst_play_video_set_data_src ( GstPlay *play,
GstElement *datasrc)
{
GstElement *work_thread;
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (datasrc != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
+ g_return_val_if_fail (GST_IS_ELEMENT(datasrc), FALSE);
work_thread = g_hash_table_lookup(play->other_elements, "work_thread");
return gst_play_default_set_data_src(play, datasrc, work_thread);
@@ -572,6 +586,7 @@ gst_play_video_set_auto ( GstPlay *play,
GstElement *audio_bin, *video_bin, *work_thread;
g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (autoplugger != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (autoplugger), FALSE);
@@ -607,6 +622,8 @@ gst_play_video_set_video ( GstPlay *play,
{
GstElement *video_mate, *video_bin;
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (video_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (video_sink), FALSE);
@@ -651,6 +668,8 @@ gst_play_video_set_audio ( GstPlay *play,
{
GstElement *audio_bin;
+ g_return_val_if_fail (play != NULL, FALSE);
+ g_return_val_if_fail (audio_sink != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
@@ -696,10 +715,11 @@ gst_play_video_vis_setup ( GstPlay *play,
{
GstElement *work_thread, *tee_element;
- GstPad *tee_vis_pad, *tee_audio_pad, *vis_video_thread_pad;
- GstElement *vis_audio_thread, *vis_video_thread;
- GstElement *vis_audio_queue, *vis_video_queue;
- GstElement *vis_colorspace, *vis_audio_sink, *vis_video_sink;
+ GstPad *tee_vis_pad, *tee_audio_pad;
+ GstPad *audio_sink_pad, *vis_video_thread_pad;
+ GstElement *vis_video_thread;
+ GstElement *audio_queue, *audio_sink;
+ GstElement *vis_colorspace, *vis_video_queue, *vis_video_sink;
GstElement *video_queue, *video_bin, *colorspace;
g_return_val_if_fail (play != NULL, FALSE);
@@ -729,7 +749,7 @@ gst_play_video_vis_setup ( GstPlay *play,
/* Creating here the audio vis bin */
- play->audio_sink = gst_element_factory_make ( "bin", "audio_bin");
+ play->audio_sink = gst_thread_new ("audio_thread");
if (!play->audio_sink)
{
gst_play_error_plugin (GST_PLAY_ERROR_THREAD, error);
@@ -738,7 +758,17 @@ gst_play_video_vis_setup ( GstPlay *play,
g_hash_table_insert( play->other_elements,
"audio_bin",
play->audio_sink);
-
+
+ audio_queue = gst_element_factory_make ("queue", "audio_queue");
+ if (!audio_queue)
+ {
+ gst_play_error_plugin (GST_PLAY_ERROR_QUEUE, error);
+ return FALSE;
+ }
+ g_hash_table_insert ( play->other_elements,
+ "audio_queue",
+ audio_queue);
+
play->volume = gst_element_factory_make ("volume", "audio_volume");
if (!play->volume)
{
@@ -763,72 +793,47 @@ gst_play_video_vis_setup ( GstPlay *play,
g_hash_table_insert( play->other_elements,
"tee_audio_pad",
tee_audio_pad);
-
- gst_bin_add_many ( GST_BIN (play->audio_sink),
- play->volume, tee_element, NULL);
- gst_element_link_many (play->volume, tee_element, NULL);
- gst_element_add_ghost_pad ( play->audio_sink,
- gst_element_get_pad (play->volume, "sink"),
- "sink");
- /* Creating audio part of the visualisation bin
- { queue ! volume ! (audiosink) }
- */
-
- vis_audio_thread = gst_thread_new ("vis_audio_thread");
- if (!vis_audio_thread)
- {
- gst_play_error_plugin (GST_PLAY_ERROR_THREAD, error);
- return FALSE;
- }
- g_hash_table_insert( play->other_elements,
- "vis_audio_thread",
- vis_audio_thread);
-
- vis_audio_queue = gst_element_factory_make ("queue", "vis_audio_queue");
- if (!vis_audio_queue)
- {
- gst_play_error_plugin (GST_PLAY_ERROR_QUEUE, error);
- return FALSE;
- }
- g_hash_table_insert ( play->other_elements,
- "vis_audio_queue",
- vis_audio_queue);
-
- vis_audio_sink = gst_element_factory_make ("fakesink", "vis_audio_sink");
- if (!vis_audio_sink)
+ audio_sink = gst_element_factory_make ("fakesink", "audio_sink");
+ if (!audio_sink)
{
gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
return FALSE;
}
g_hash_table_insert ( play->other_elements,
- "vis_audio_sink",
- vis_audio_sink);
+ "audio_sink",
+ audio_sink);
+
+ audio_sink_pad = gst_element_get_pad (audio_sink, "sink");
+ g_hash_table_insert ( play->other_elements,
+ "audio_sink_pad",
+ audio_sink_pad);
+
play->audio_sink_element = NULL;
- gst_bin_add_many ( GST_BIN (vis_audio_thread), vis_audio_queue,
- vis_audio_sink, NULL);
- gst_element_link_many ( vis_audio_queue, vis_audio_sink, NULL);
+ gst_bin_add_many ( GST_BIN (play->audio_sink),
+ audio_queue, play->volume,
+ tee_element, audio_sink, NULL);
+ gst_element_link_many ( audio_queue, play->volume,
+ tee_element, NULL);
+
+ gst_pad_link ( tee_audio_pad, audio_sink_pad);
+
+ gst_element_add_ghost_pad ( play->audio_sink,
+ gst_element_get_pad (audio_queue, "sink"),
+ "sink");
/* setting up iterate functions */
gst_bin_set_pre_iterate_function (
- GST_BIN (vis_audio_thread),
+ GST_BIN (play->audio_sink),
(GstBinPrePostIterateFunction) callback_bin_pre_iterate,
play->audio_bin_mutex);
gst_bin_set_post_iterate_function (
- GST_BIN (vis_audio_thread),
+ GST_BIN (play->audio_sink),
(GstBinPrePostIterateFunction) callback_bin_post_iterate,
play->audio_bin_mutex);
- gst_bin_add ( GST_BIN(play->audio_sink), vis_audio_thread);
-
- gst_pad_link ( tee_audio_pad,
- gst_element_add_ghost_pad (
- vis_audio_thread,
- gst_element_get_pad (vis_audio_queue, "sink"),
- "sink"));
-
/* Creating video part of the visualisation bin
{ queue ! (visualisation) ! colorspace ! (videosink) }
*/
@@ -877,18 +882,7 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_bin_add_many ( GST_BIN (vis_video_thread), vis_video_queue,
vis_colorspace, vis_video_sink, NULL);
- /* Not linking now as we miss too much stuff */
-
- /* setting up iterate functions
- gst_bin_set_pre_iterate_function (
- GST_BIN (vis_video_thread),
- (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
- play->video_bin_mutex);
- gst_bin_set_post_iterate_function (
- GST_BIN (vis_video_thread),
- (GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->video_bin_mutex);*/
-
+
vis_video_thread_pad = gst_element_add_ghost_pad (
vis_video_thread,
gst_element_get_pad (vis_video_queue, "sink"),
@@ -944,7 +938,7 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_element_link_many (video_queue, colorspace,
play->video_sink, NULL);
- /* setting up iterate functions
+ /* setting up iterate functions */
gst_bin_set_pre_iterate_function (
GST_BIN (video_bin),
(GstBinPrePostIterateFunction) callback_bin_pre_iterate,
@@ -952,7 +946,7 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_bin_set_post_iterate_function (
GST_BIN (video_bin),
(GstBinPrePostIterateFunction) callback_bin_post_iterate,
- play->video_bin_mutex);*/
+ play->video_bin_mutex);
gst_element_add_ghost_pad (
video_bin, gst_element_get_pad (video_queue, "sink"),
@@ -967,7 +961,8 @@ static gboolean
gst_play_video_vis_set_audio ( GstPlay *play,
GstElement *audio_sink)
{
- GstElement *audio_bin, *vis_audio_sink, *vis_audio_queue;
+ GstElement *audio_bin, *vis_audio_sink;
+ GstPad *audio_sink_pad, *tee_audio_pad;
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (audio_sink != NULL, FALSE);
@@ -975,25 +970,34 @@ gst_play_video_vis_set_audio ( GstPlay *play,
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
audio_bin = g_hash_table_lookup ( play->other_elements,
- "vis_audio_thread");
+ "audio_bin");
vis_audio_sink = g_hash_table_lookup ( play->other_elements,
- "vis_audio_sink");
- vis_audio_queue = g_hash_table_lookup ( play->other_elements,
- "vis_audio_queue");
+ "audio_sink");
+ audio_sink_pad = g_hash_table_lookup ( play->other_elements,
+ "audio_sink_pad");
+ tee_audio_pad = g_hash_table_lookup ( play->other_elements,
+ "tee_audio_pad");
- if (vis_audio_sink)
+ if ( (vis_audio_sink) && GST_IS_ELEMENT(vis_audio_sink) )
{
- gst_element_unlink (vis_audio_queue, vis_audio_sink);
+ gst_pad_unlink (tee_audio_pad, audio_sink_pad);
gst_bin_remove (GST_BIN (audio_bin), vis_audio_sink);
}
gst_bin_add (GST_BIN (audio_bin), audio_sink);
- gst_element_link (vis_audio_queue, audio_sink);
-
+
+ audio_sink_pad = gst_element_get_pad (audio_sink,"sink");
+
+ gst_pad_link (tee_audio_pad, audio_sink_pad);
+
g_hash_table_replace( play->other_elements,
- "vis_audio_sink",
+ "audio_sink",
audio_sink);
+ g_hash_table_replace( play->other_elements,
+ "audio_sink_pad",
+ audio_sink_pad);
+
play->audio_sink_element = gst_play_get_sink_element (
play,
audio_sink,
@@ -1172,6 +1176,7 @@ gst_play_connect_visualisation ( GstPlay *play,
gboolean connect)
{
GstPad *tee_vis_pad, *vis_video_thread_pad;
+ gboolean connected = FALSE;
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (GST_IS_PLAY(play), FALSE);
@@ -1181,10 +1186,15 @@ gst_play_connect_visualisation ( GstPlay *play,
vis_video_thread_pad = g_hash_table_lookup( play->other_elements,
"vis_video_thread_pad");
- if (connect) {
+ if (gst_pad_get_peer (vis_video_thread_pad) != NULL)
+ connected = TRUE;
+ else
+ connected = FALSE;
+
+ if ( (connect) && (!connected) ) {
gst_pad_link (tee_vis_pad, vis_video_thread_pad);
}
- else {
+ else if ( (!connect) && (connected) ){
gst_pad_unlink (tee_vis_pad, vis_video_thread_pad);
}