static gboolean gst_decklink_audio_src_open (GstDecklinkAudioSrc * self);
static gboolean gst_decklink_audio_src_close (GstDecklinkAudioSrc * self);
+static gboolean gst_decklink_audio_src_stop (GstDecklinkAudioSrc * self);
+
#define parent_class gst_decklink_audio_src_parent_class
G_DEFINE_TYPE (GstDecklinkAudioSrc, gst_decklink_audio_src, GST_TYPE_PUSH_SRC);
static gboolean
gst_decklink_audio_src_open (GstDecklinkAudioSrc * self)
{
- GST_DEBUG_OBJECT (self, "Starting");
+ GST_DEBUG_OBJECT (self, "Opening");
self->input =
gst_decklink_acquire_nth_input (self->device_number,
static gboolean
gst_decklink_audio_src_close (GstDecklinkAudioSrc * self)
{
-
- GST_DEBUG_OBJECT (self, "Stopping");
+ GST_DEBUG_OBJECT (self, "Closing");
if (self->input) {
g_mutex_lock (&self->input->lock);
self->input->got_audio_packet = NULL;
- self->input->audio_enabled = FALSE;
- if (self->input->start_streams && self->input->videosrc)
- self->input->start_streams (self->input->videosrc);
g_mutex_unlock (&self->input->lock);
- self->input->input->DisableAudioInput ();
gst_decklink_release_nth_input (self->device_number,
GST_ELEMENT_CAST (self), TRUE);
self->input = NULL;
return TRUE;
}
+static gboolean
+gst_decklink_audio_src_stop (GstDecklinkAudioSrc * self)
+{
+ GST_DEBUG_OBJECT (self, "Stopping");
+
+ g_queue_foreach (&self->current_packets, (GFunc) capture_packet_free,
+ NULL);
+ g_queue_clear (&self->current_packets);
+
+ if (self->input && self->input->audio_enabled) {
+ g_mutex_lock (&self->input->lock);
+ self->input->audio_enabled = FALSE;
+ g_mutex_unlock (&self->input->lock);
+
+ self->input->input->DisableAudioInput ();
+ }
+
+ return TRUE;
+}
+
#if 0
static gboolean
in_same_pipeline (GstElement * a, GstElement * b)
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
- g_queue_foreach (&self->current_packets, (GFunc) capture_packet_free,
- NULL);
- g_queue_clear (&self->current_packets);
+ gst_decklink_audio_src_stop (self);
break;
case GST_STATE_CHANGE_READY_TO_NULL:
gst_decklink_audio_src_close (self);
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);
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,
{
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);
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;
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)
{
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;
static gboolean gst_decklink_video_src_open (GstDecklinkVideoSrc * self);
static gboolean gst_decklink_video_src_close (GstDecklinkVideoSrc * self);
+static gboolean gst_decklink_video_src_stop (GstDecklinkVideoSrc * self);
+
static void gst_decklink_video_src_start_streams (GstElement * element);
#define parent_class gst_decklink_video_src_parent_class
{
const GstDecklinkMode *mode;
- GST_DEBUG_OBJECT (self, "Starting");
+ GST_DEBUG_OBJECT (self, "Opening");
self->input =
gst_decklink_acquire_nth_input (self->device_number,
gst_decklink_video_src_close (GstDecklinkVideoSrc * self)
{
- GST_DEBUG_OBJECT (self, "Stopping");
+ GST_DEBUG_OBJECT (self, "Closing");
if (self->input) {
g_mutex_lock (&self->input->lock);
self->input->got_video_frame = NULL;
self->input->mode = NULL;
self->input->video_enabled = FALSE;
- if (self->input->start_streams)
- self->input->start_streams (self->input->videosrc);
+ self->input->start_streams = NULL;
g_mutex_unlock (&self->input->lock);
- self->input->input->DisableVideoInput ();
gst_decklink_release_nth_input (self->device_number,
GST_ELEMENT_CAST (self), FALSE);
self->input = NULL;
return TRUE;
}
+static gboolean
+gst_decklink_video_src_stop (GstDecklinkVideoSrc * self)
+{
+ GST_DEBUG_OBJECT (self, "Stopping");
+
+ g_queue_foreach (&self->current_frames, (GFunc) capture_frame_free, NULL);
+ g_queue_clear (&self->current_frames);
+ self->caps_mode = GST_DECKLINK_MODE_AUTO;
+
+ if (self->input && self->input->video_enabled) {
+ g_mutex_lock (&self->input->lock);
+ self->input->video_enabled = FALSE;
+ g_mutex_unlock (&self->input->lock);
+
+ self->input->input->DisableVideoInput ();
+ }
+
+ return TRUE;
+}
+
static void
gst_decklink_video_src_start_streams (GstElement * element)
{
self->input->clock_offset = 0;
g_mutex_unlock (&self->input->lock);
- g_queue_foreach (&self->current_frames, (GFunc) capture_frame_free, NULL);
- g_queue_clear (&self->current_frames);
- self->caps_mode = GST_DECKLINK_MODE_AUTO;
+ gst_decklink_video_src_stop (self);
break;
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:{
HRESULT res;