examples/overlay: unref sink only when found

In gtk-videooverlay and qt-videooverlay examples.
This commit is contained in:
Julien Isorce 2013-10-10 14:01:44 +01:00
parent 4305e1c33e
commit e0dfbe9dfa
2 changed files with 8 additions and 6 deletions

View file

@ -57,8 +57,8 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
sret = gst_element_set_state (sink, GST_STATE_READY);
@ -66,8 +66,8 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
@ -84,8 +84,9 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
return NULL;
}

View file

@ -46,8 +46,8 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
if ((sink = gst_element_factory_make ("ximagesink", NULL))) {
sret = gst_element_set_state (sink, GST_STATE_READY);
@ -55,8 +55,8 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
if (strcmp (DEFAULT_VIDEOSINK, "xvimagesink") == 0 ||
strcmp (DEFAULT_VIDEOSINK, "ximagesink") == 0)
@ -73,8 +73,9 @@ find_video_sink (void)
return sink;
gst_element_set_state (sink, GST_STATE_NULL);
gst_object_unref (sink);
}
gst_object_unref (sink);
return NULL;
}