mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
Add signal property to ajasrc to allow checking/notify about signal availability at any time
This commit is contained in:
parent
0c2a255963
commit
8e75c37ce4
2 changed files with 38 additions and 0 deletions
|
@ -57,6 +57,7 @@ enum {
|
|||
PROP_REFERENCE_SOURCE,
|
||||
PROP_QUEUE_SIZE,
|
||||
PROP_CAPTURE_CPU_CORE,
|
||||
PROP_SIGNAL,
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
|
@ -205,6 +206,13 @@ static void gst_aja_src_class_init(GstAjaSrcClass *klass) {
|
|||
(GParamFlags)(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_CONSTRUCT)));
|
||||
|
||||
g_object_class_install_property(
|
||||
gobject_class, PROP_SIGNAL,
|
||||
g_param_spec_boolean(
|
||||
"signal", "Input signal available",
|
||||
"True if there is a valid input signal available", FALSE,
|
||||
(GParamFlags)(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS)));
|
||||
|
||||
element_class->change_state = GST_DEBUG_FUNCPTR(gst_aja_src_change_state);
|
||||
|
||||
basesrc_class->get_caps = GST_DEBUG_FUNCPTR(gst_aja_src_get_caps);
|
||||
|
@ -335,6 +343,9 @@ void gst_aja_src_get_property(GObject *object, guint property_id, GValue *value,
|
|||
case PROP_CAPTURE_CPU_CORE:
|
||||
g_value_set_uint(value, self->capture_cpu_core);
|
||||
break;
|
||||
case PROP_SIGNAL:
|
||||
g_value_set_boolean(value, self->signal);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
|
||||
break;
|
||||
|
@ -1144,6 +1155,7 @@ static gboolean gst_aja_src_start(GstAjaSrc *self) {
|
|||
GST_DEBUG_OBJECT(self, "Starting");
|
||||
|
||||
self->video_format = NTV2_FORMAT_UNKNOWN;
|
||||
self->signal = FALSE;
|
||||
|
||||
self->capture_thread = new AJAThread();
|
||||
self->capture_thread->Attach(capture_thread_func, self);
|
||||
|
@ -1209,6 +1221,11 @@ static gboolean gst_aja_src_stop(GstAjaSrc *self) {
|
|||
|
||||
self->video_format = NTV2_FORMAT_UNKNOWN;
|
||||
|
||||
if (self->signal) {
|
||||
self->signal = FALSE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT(self, "Stopped");
|
||||
|
||||
return TRUE;
|
||||
|
@ -1676,6 +1693,10 @@ restart:
|
|||
("No input source was detected"));
|
||||
have_signal = FALSE;
|
||||
}
|
||||
if (self->signal) {
|
||||
self->signal = FALSE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
self->device->device->WaitForInputVerticalInterrupt(self->channel);
|
||||
continue;
|
||||
}
|
||||
|
@ -1726,6 +1747,10 @@ restart:
|
|||
("No input source was detected"));
|
||||
have_signal = FALSE;
|
||||
}
|
||||
if (self->signal) {
|
||||
self->signal = FALSE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
self->device->device->WaitForInputVerticalInterrupt(self->channel);
|
||||
g_mutex_lock(&self->queue_lock);
|
||||
continue;
|
||||
|
@ -1757,6 +1782,10 @@ restart:
|
|||
current_string.c_str()));
|
||||
have_signal = FALSE;
|
||||
}
|
||||
if (self->signal) {
|
||||
self->signal = FALSE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
self->device->device->WaitForInputVerticalInterrupt(self->channel);
|
||||
g_mutex_lock(&self->queue_lock);
|
||||
continue;
|
||||
|
@ -1819,6 +1848,10 @@ restart:
|
|||
("Signal recovered"), ("Input source detected"));
|
||||
have_signal = TRUE;
|
||||
}
|
||||
if (!self->signal) {
|
||||
self->signal = TRUE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
|
||||
iterations_without_frame = 0;
|
||||
|
||||
|
@ -1994,6 +2027,10 @@ restart:
|
|||
("Signal lost"), ("No frames captured"));
|
||||
have_signal = FALSE;
|
||||
}
|
||||
if (self->signal) {
|
||||
self->signal = FALSE;
|
||||
g_object_notify(G_OBJECT(self), "signal");
|
||||
}
|
||||
}
|
||||
|
||||
self->device->device->WaitForInputVerticalInterrupt(self->channel);
|
||||
|
|
|
@ -71,6 +71,7 @@ struct _GstAjaSrc {
|
|||
GstAjaReferenceSource reference_source;
|
||||
guint queue_size;
|
||||
guint capture_cpu_core;
|
||||
gboolean signal;
|
||||
|
||||
NTV2AudioSystem audio_system;
|
||||
NTV2VideoFormat video_format;
|
||||
|
|
Loading…
Reference in a new issue