本文整理汇总了C++中KMS_ELEMENT_UNLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ KMS_ELEMENT_UNLOCK函数的具体用法?C++ KMS_ELEMENT_UNLOCK怎么用?C++ KMS_ELEMENT_UNLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KMS_ELEMENT_UNLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: kms_element_get_data_tee
GstElement *
kms_element_get_data_tee (KmsElement * self)
{
GstElement *sink, *tee;
GST_DEBUG_OBJECT (self, "Data tee requested");
KMS_ELEMENT_LOCK (self);
if (self->priv->data_tee != NULL) {
KMS_ELEMENT_UNLOCK (self);
return self->priv->data_tee;
}
tee = gst_element_factory_make ("tee", NULL);
sink = gst_element_factory_make ("fakesink", NULL);
g_object_set (sink, "sync", FALSE, "async", FALSE, NULL);
gst_bin_add_many (GST_BIN (self), tee, sink, NULL);
gst_element_link (tee, sink);
self->priv->data_tee = tee;
KMS_ELEMENT_UNLOCK (self);
gst_element_sync_state_with_parent (sink);
gst_element_sync_state_with_parent (tee);
kms_element_create_pending_pads (self, KMS_ELEMENT_PAD_TYPE_DATA);
return tee;
}
示例2: kms_element_get_property
static void
kms_element_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
KmsElement *self = KMS_ELEMENT (object);
switch (property_id) {
case PROP_ACCEPT_EOS:
KMS_ELEMENT_LOCK (self);
g_value_set_boolean (value, self->priv->accept_eos);
KMS_ELEMENT_UNLOCK (self);
break;
case PROP_AUDIO_CAPS:
g_value_take_boxed (value, kms_element_endpoint_get_caps (self,
self->priv->audio_caps));
break;
case PROP_VIDEO_CAPS:
g_value_take_boxed (value, kms_element_endpoint_get_caps (self,
self->priv->video_caps));
break;
case PROP_TARGET_BITRATE:
KMS_ELEMENT_LOCK (self);
g_value_set_int (value, self->priv->target_bitrate);
KMS_ELEMENT_UNLOCK (self);
break;
case PROP_MEDIA_STATS:
KMS_ELEMENT_LOCK (self);
g_value_set_boolean (value, self->priv->stats_enabled);
KMS_ELEMENT_UNLOCK (self);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
示例3: kms_recorder_endpoint_get_property
static void
kms_recorder_endpoint_get_property (GObject * object, guint property_id,
GValue * value, GParamSpec * pspec)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (object);
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
switch (property_id) {
case PROP_DVR:
g_value_set_boolean (value, self->priv->use_dvr);
break;
case PROP_PROFILE:{
KmsRecordingProfile profile;
g_object_get (G_OBJECT (self->priv->controller), "profile", &profile,
NULL);
g_value_set_enum (value, profile);
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
}
示例4: kms_recorder_endpoint_paused
static void
kms_recorder_endpoint_paused (KmsUriEndpoint * obj)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (obj);
GstClock *clk;
kms_recorder_endpoint_change_state (self, KMS_URI_ENDPOINT_STATE_PAUSE);
kms_recorder_endpoint_remove_pads (self);
KMS_ELEMENT_UNLOCK (self);
/* Set internal pipeline to GST_STATE_PAUSED */
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_PAUSED);
KMS_ELEMENT_LOCK (self);
clk = kms_base_media_muxer_get_clock (self->priv->mux);
if (clk) {
self->priv->paused_start = gst_clock_get_time (clk);
}
kms_recorder_endpoint_state_changed (self, KMS_URI_ENDPOINT_STATE_PAUSE);
}
示例5: kms_recorder_endpoint_started
static void
kms_recorder_endpoint_started (KmsUriEndpoint * obj)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (obj);
kms_recorder_endpoint_create_parent_directories (self);
kms_recorder_endpoint_change_state (self, KMS_URI_ENDPOINT_STATE_START);
KMS_ELEMENT_UNLOCK (self);
/* Set internal pipeline to playing */
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_PLAYING);
KMS_ELEMENT_LOCK (self);
BASE_TIME_LOCK (self);
if (GST_CLOCK_TIME_IS_VALID (self->priv->paused_start)) {
self->priv->paused_time +=
gst_clock_get_time (kms_base_media_muxer_get_clock (self->priv->mux)) -
self->priv->paused_start;
self->priv->paused_start = GST_CLOCK_TIME_NONE;
}
BASE_TIME_UNLOCK (self);
kms_recorder_generate_pads (self);
}
示例6: kms_recorder_endpoint_stopped
static void
kms_recorder_endpoint_stopped (KmsUriEndpoint * obj)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (obj);
if (self->priv->stopping) {
return;
}
kms_recorder_endpoint_change_state (self, KMS_URI_ENDPOINT_STATE_STOP);
if (kms_base_media_muxer_get_state (self->priv->mux) >= GST_STATE_PAUSED) {
self->priv->stopping = TRUE;
kms_recorder_endpoint_send_eos_to_appsrcs (self);
}
kms_recorder_endpoint_remove_pads (self);
// Reset base time data
BASE_TIME_LOCK (self);
g_object_set_qdata_full (G_OBJECT (self), base_time_key_quark (), NULL, NULL);
self->priv->paused_time = G_GUINT64_CONSTANT (0);
self->priv->paused_start = GST_CLOCK_TIME_NONE;
BASE_TIME_UNLOCK (self);
if (kms_base_media_muxer_get_state (self->priv->mux) < GST_STATE_PAUSED &&
!self->priv->stopping) {
KMS_ELEMENT_UNLOCK (self);
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_NULL);
KMS_ELEMENT_LOCK (self);
}
}
示例7: kms_recorder_end_point_started
static void
kms_recorder_end_point_started (KmsUriEndPoint * obj)
{
KmsRecorderEndPoint *self = KMS_RECORDER_END_POINT (obj);
kms_recorder_end_point_change_state (self);
/* Set internal pipeline to playing */
gst_element_set_state (self->priv->pipeline, GST_STATE_PLAYING);
KMS_ELEMENT_LOCK (self);
if (GST_CLOCK_TIME_IS_VALID (self->priv->paused_start)) {
self->priv->paused_time +=
gst_clock_get_time (GST_ELEMENT (self->priv->pipeline)->clock) -
self->priv->paused_start;
self->priv->paused_start = GST_CLOCK_TIME_NONE;
}
KMS_ELEMENT_UNLOCK (self);
/* Open valves */
kms_recorder_end_point_open_valves (self);
kms_recorder_end_point_state_changed (self, KMS_URI_END_POINT_STATE_START);
}
示例8: kms_recorder_endpoint_dispose
static void
kms_recorder_endpoint_dispose (GObject * object)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (object);
GST_DEBUG_OBJECT (self, "dispose");
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
if (self->priv->mux != NULL) {
if (kms_base_media_muxer_get_state (self->priv->mux) != GST_STATE_NULL) {
GST_ELEMENT_WARNING (self, RESOURCE, BUSY,
("Recorder may have buffers to save"),
("Disposing recorder when it isn't stopped."));
}
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_NULL);
if (self->priv->stopping) {
GST_WARNING_OBJECT (self, "Forcing pending stop operation to finish");
kms_recorder_endpoint_state_changed (self, KMS_URI_ENDPOINT_STATE_STOP);
self->priv->stopping = FALSE;
}
}
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
g_mutex_clear (&self->priv->base_time_lock);
/* clean up as possible. may be called multiple times */
G_OBJECT_CLASS (kms_recorder_endpoint_parent_class)->dispose (object);
}
示例9: kms_element_remove_sink
void
kms_element_remove_sink (KmsElement * self, GstPad * pad)
{
GSList *l;
g_return_if_fail (self);
g_return_if_fail (pad);
KMS_ELEMENT_LOCK (self);
l = g_slist_find_custom (self->priv->stats.probes, pad,
(GCompareFunc) find_stat_probe);
if (l != NULL) {
KmsStatsProbe *probe = l->data;
self->priv->stats.probes = g_slist_remove (self->priv->stats.probes,
l->data);
kms_stats_probe_destroy (probe);
}
KMS_ELEMENT_UNLOCK (self);
// TODO: Unlink correctly pad before removing it
gst_ghost_pad_set_target (GST_GHOST_PAD (pad), NULL);
gst_element_remove_pad (GST_ELEMENT (self), pad);
}
示例10: kms_recorder_endpoint_send_eos_to_appsrcs
static void
kms_recorder_endpoint_send_eos_to_appsrcs (KmsRecorderEndpoint * self)
{
if (g_hash_table_size (self->priv->srcs) == 0) {
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_NULL);
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
return;
}
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
kms_base_media_muxer_set_state (self->priv->mux, GST_STATE_PLAYING);
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
g_hash_table_foreach (self->priv->srcs, (GHFunc) send_eos_cb, NULL);
}
示例11: kms_dummy_sink_release_requested_sink_pad
static gboolean
kms_dummy_sink_release_requested_sink_pad (KmsElement * obj, GstPad * pad)
{
KmsDummySink *self = KMS_DUMMY_SINK (obj);
KmsDummySinkElement *dummy;
gchar *padname;
padname = gst_pad_get_name (pad);
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
dummy = g_hash_table_lookup (self->priv->sinks, padname);
if (dummy == NULL) {
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
return FALSE;
}
kms_element_remove_sink_by_type_full (obj, dummy->type, dummy->description);
g_hash_table_remove (self->priv->sinks, padname);
g_free (padname);
return TRUE;
}
示例12: kms_recorder_endpoint_set_property
static void
kms_recorder_endpoint_set_property (GObject * object, guint property_id,
const GValue * value, GParamSpec * pspec)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (object);
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
switch (property_id) {
case PROP_DVR:
self->priv->use_dvr = g_value_get_boolean (value);
break;
case PROP_PROFILE:{
if (self->priv->profile == KMS_RECORDING_PROFILE_NONE) {
self->priv->profile = g_value_get_enum (value);
if (self->priv->profile != KMS_RECORDING_PROFILE_NONE) {
kms_recorder_endpoint_new_media_muxer (self);
}
} else {
GST_ERROR_OBJECT (self, "Profile can only be configured once");
}
break;
}
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
}
示例13: kms_element_set_sink_input_stats
static void
kms_element_set_sink_input_stats (KmsElement * self, GstPad * pad,
KmsElementPadType type)
{
KmsStatsProbe *s_probe;
KmsMediaType media_type;
switch (type) {
case KMS_ELEMENT_PAD_TYPE_AUDIO:
media_type = KMS_MEDIA_TYPE_AUDIO;
case KMS_ELEMENT_PAD_TYPE_VIDEO:
media_type = KMS_MEDIA_TYPE_VIDEO;
break;
default:
GST_DEBUG ("No stats collected for pad type %d", type);
return;
}
s_probe = kms_stats_probe_new (pad, media_type);
KMS_ELEMENT_LOCK (self);
self->priv->stats.probes = g_slist_prepend (self->priv->stats.probes,
s_probe);
if (self->priv->stats_enabled) {
kms_stats_probe_add_latency (s_probe, kms_element_calculate_stats, self,
NULL);
}
KMS_ELEMENT_UNLOCK (self);
}
示例14: accept_eos_probe
static GstPadProbeReturn
accept_eos_probe (GstPad * pad, GstPadProbeInfo * info, gpointer data)
{
GstEvent *event = gst_pad_probe_info_get_event (info);
GstEventType type = GST_EVENT_TYPE (event);
if (type == GST_EVENT_EOS || type == GST_EVENT_FLUSH_START
|| type == GST_EVENT_FLUSH_STOP) {
KmsElement *self;
gboolean accept;
self = KMS_ELEMENT (data);
KMS_ELEMENT_LOCK (self);
accept = self->priv->accept_eos;
KMS_ELEMENT_UNLOCK (self);
if (!accept) {
GST_DEBUG_OBJECT (pad, "Event %s dropped",
gst_event_type_get_name (type));
}
return (accept) ? GST_PAD_PROBE_OK : GST_PAD_PROBE_DROP;
}
return GST_PAD_PROBE_OK;
}
示例15: unlink_sinkpad_cb
static void
unlink_sinkpad_cb (GstPad * pad, GstPad * peer, gpointer user_data)
{
KmsRecorderEndpoint *self = KMS_RECORDER_ENDPOINT (user_data);
gchar *id = NULL;
KMS_ELEMENT_LOCK (KMS_ELEMENT (self));
id = gst_pad_get_name (pad);
if (self->priv->stopping) {
GST_DEBUG_OBJECT (self, "Stop operation is pending");
self->priv->pending_pads = g_slist_prepend (self->priv->pending_pads,
g_strdup (id));
goto end;
}
if (kms_base_media_muxer_remove_src (self->priv->mux, id)) {
g_hash_table_remove (self->priv->srcs, id);
}
end:
KMS_ELEMENT_UNLOCK (KMS_ELEMENT (self));
g_free (id);
}