summaryrefslogtreecommitdiff
path: root/sys/decklink/gstdecklinkvideosink.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sys/decklink/gstdecklinkvideosink.cpp')
-rw-r--r--sys/decklink/gstdecklinkvideosink.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/sys/decklink/gstdecklinkvideosink.cpp b/sys/decklink/gstdecklinkvideosink.cpp
index 520c50a4f..e1f520cbf 100644
--- a/sys/decklink/gstdecklinkvideosink.cpp
+++ b/sys/decklink/gstdecklinkvideosink.cpp
@@ -142,6 +142,7 @@ static GstFlowReturn gst_decklink_video_sink_render (GstBaseSink * bsink,
GstBuffer * buffer);
static gboolean gst_decklink_video_sink_open (GstBaseSink * bsink);
static gboolean gst_decklink_video_sink_close (GstBaseSink * bsink);
+static gboolean gst_decklink_video_sink_stop (GstDecklinkVideoSink * self);
static gboolean gst_decklink_video_sink_propose_allocation (GstBaseSink * bsink,
GstQuery * query);
@@ -539,7 +540,7 @@ gst_decklink_video_sink_open (GstBaseSink * bsink)
GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
const GstDecklinkMode *mode;
- GST_DEBUG_OBJECT (self, "Starting");
+ GST_DEBUG_OBJECT (self, "Stopping");
self->output =
gst_decklink_acquire_nth_output (self->device_number,
@@ -569,7 +570,7 @@ gst_decklink_video_sink_close (GstBaseSink * bsink)
{
GstDecklinkVideoSink *self = GST_DECKLINK_VIDEO_SINK_CAST (bsink);
- GST_DEBUG_OBJECT (self, "Stopping");
+ GST_DEBUG_OBJECT (self, "Closing");
if (self->output) {
g_mutex_lock (&self->output->lock);
@@ -580,7 +581,6 @@ gst_decklink_video_sink_close (GstBaseSink * bsink)
g_mutex_unlock (&self->output->lock);
self->output->output->DisableVideoOutput ();
- self->output->output->SetScheduledFrameCompletionCallback (NULL);
gst_decklink_release_nth_output (self->device_number,
GST_ELEMENT_CAST (self), FALSE);
self->output = NULL;
@@ -589,6 +589,23 @@ gst_decklink_video_sink_close (GstBaseSink * bsink)
return TRUE;
}
+static gboolean
+gst_decklink_video_sink_stop (GstDecklinkVideoSink * self)
+{
+ GST_DEBUG_OBJECT (self, "Stopping");
+
+ if (self->output && self->output->video_enabled) {
+ g_mutex_lock (&self->output->lock);
+ self->output->video_enabled = FALSE;
+ g_mutex_unlock (&self->output->lock);
+
+ self->output->output->DisableVideoOutput ();
+ self->output->output->SetScheduledFrameCompletionCallback (NULL);
+ }
+
+ return TRUE;
+}
+
static void
gst_decklink_video_sink_start_scheduled_playback (GstElement * element)
{
@@ -732,6 +749,7 @@ gst_decklink_video_sink_change_state (GstElement * element,
self->output->clock_last_time = 0;
self->output->clock_offset = 0;
g_mutex_unlock (&self->output->lock);
+ gst_decklink_video_sink_stop (self);
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:{
GstClockTime start_time;