本文整理汇总了C++中GST_IS_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ GST_IS_OBJECT函数的具体用法?C++ GST_IS_OBJECT怎么用?C++ GST_IS_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GST_IS_OBJECT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gst_object_replace
/**
* gst_object_replace:
* @oldobj: (inout) (transfer full): pointer to a place of a #GstObject to
* replace
* @newobj: (transfer none): a new #GstObject
*
* Unrefs the #GstObject pointed to by @oldobj, refs @newobj and
* puts @newobj in *@oldobj. Be carefull when calling this
* function, it does not take any locks. You might want to lock
* the object owning @oldobj pointer before calling this
* function.
*
* Make sure not to LOCK @oldobj because it might be unreffed
* which could cause a deadlock when it is disposed.
*
* Since 0.10.36, this function operates atomically.
*/
void
gst_object_replace (GstObject ** oldobj, GstObject * newobj)
{
GstObject *oldptr;
g_return_if_fail (oldobj != NULL);
g_return_if_fail (*oldobj == NULL || GST_IS_OBJECT (*oldobj));
g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj));
#ifdef DEBUG_REFCOUNT
GST_CAT_TRACE (GST_CAT_REFCOUNTING, "replace %p %s (%d) with %p %s (%d)",
*oldobj, *oldobj ? GST_STR_NULL (GST_OBJECT_NAME (*oldobj)) : "(NONE)",
*oldobj ? G_OBJECT (*oldobj)->ref_count : 0,
newobj, newobj ? GST_STR_NULL (GST_OBJECT_NAME (newobj)) : "(NONE)",
newobj ? G_OBJECT (newobj)->ref_count : 0);
#endif
if (newobj)
g_object_ref (newobj);
do {
oldptr = *oldobj;
} while (!G_ATOMIC_POINTER_COMPARE_AND_EXCHANGE (oldobj, oldptr, newobj));
if (oldptr)
g_object_unref (oldptr);
}
示例2: gst_object_replace
EXPORT_C
#endif
void
gst_object_replace (GstObject ** oldobj, GstObject * newobj)
{
g_return_if_fail (oldobj != NULL);
g_return_if_fail (*oldobj == NULL || GST_IS_OBJECT (*oldobj));
g_return_if_fail (newobj == NULL || GST_IS_OBJECT (newobj));
#ifdef DEBUG_REFCOUNT
GST_CAT_LOG (GST_CAT_REFCOUNTING, "replace %p %s (%d) with %p %s (%d)",
*oldobj, *oldobj ? GST_STR_NULL (GST_OBJECT_NAME (*oldobj)) : "(NONE)",
*oldobj ? G_OBJECT (*oldobj)->ref_count : 0,
newobj, newobj ? GST_STR_NULL (GST_OBJECT_NAME (newobj)) : "(NONE)",
newobj ? G_OBJECT (newobj)->ref_count : 0);
#endif
if (G_LIKELY (*oldobj != newobj)) {
if (newobj)
gst_object_ref (newobj);
if (*oldobj)
gst_object_unref (*oldobj);
*oldobj = newobj;
}
}
示例3: gst_object_set_parent
/**
* gst_object_set_parent:
* @object: a #GstObject
* @parent: new parent of object
*
* Sets the parent of @object to @parent. The object's reference count will
* be incremented, and any floating reference will be removed (see gst_object_ref_sink()).
*
* Returns: TRUE if @parent could be set or FALSE when @object
* already had a parent or @object and @parent are the same.
*
* MT safe. Grabs and releases @object's LOCK.
*/
gboolean
gst_object_set_parent (GstObject * object, GstObject * parent)
{
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_IS_OBJECT (parent), FALSE);
g_return_val_if_fail (object != parent, FALSE);
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
"set parent (ref and sink)");
GST_OBJECT_LOCK (object);
if (G_UNLIKELY (object->parent != NULL))
goto had_parent;
object->parent = parent;
gst_object_ref_sink (object);
GST_OBJECT_UNLOCK (object);
/* FIXME, this does not work, the deep notify takes the lock from the parent
* object and deadlocks when the parent holds its lock when calling this
* function (like _element_add_pad()) */
/* g_object_notify_by_pspec ((GObject *)object, properties[PROP_PARENT]); */
return TRUE;
/* ERROR handling */
had_parent:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
"set parent failed, object already had a parent");
GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
示例4: gst_child_proxy_set_valist
/**
* gst_child_proxy_set_valist:
* @object: the parent object
* @first_property_name: name of the first property to set
* @var_args: value for the first property, followed optionally by more name/value pairs, followed by NULL
*
* Sets properties of the parent object and its children.
*/
void
gst_child_proxy_set_valist (GstChildProxy * object,
const gchar * first_property_name, va_list var_args)
{
const gchar *name;
gchar *error = NULL;
GValue value = { 0, };
GParamSpec *pspec;
GObject *target;
g_return_if_fail (GST_IS_CHILD_PROXY (object));
name = first_property_name;
/* iterate over pairs */
while (name) {
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
G_VALUE_COLLECT_INIT (&value, pspec->value_type, var_args,
G_VALUE_NOCOPY_CONTENTS, &error);
if (error)
goto cant_copy;
g_object_set_property (target, pspec->name, &value);
g_object_unref (target);
g_value_unset (&value);
name = va_arg (var_args, gchar *);
}
return;
not_found:
{
g_warning ("no property %s in object %s", name,
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""));
return;
}
cant_copy:
{
g_warning ("error copying value %s in object %s: %s", pspec->name,
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""), error);
g_value_unset (&value);
g_object_unref (target);
return;
}
}
示例5: gst_debugserver_log_send_log
void
gst_debugserver_log_send_log (GstDebugserverLog * log,
GstDebugserverTcp * tcp_server, GstDebugCategory * category,
GstDebugLevel level, const gchar * file, const gchar * function, gint line,
GObject * object, GstDebugMessage * message)
{
GstDebugger__GStreamerData gst_data = GST_DEBUGGER__GSTREAMER_DATA__INIT;
GstDebugger__LogInfo log_info = GST_DEBUGGER__LOG_INFO__INIT;
log_info.level = (gint) level;
log_info.category = (gchar *) gst_debug_category_get_name (category);
log_info.file = (gchar *) file;
log_info.function = (gchar *) function;
log_info.line = line;
if (GST_IS_OBJECT (object)) {
log_info.object = GST_OBJECT_NAME (object);
} else {
log_info.object = (gchar *) G_OBJECT_TYPE_NAME (object);
}
log_info.message = (gchar *) gst_debug_message_get (message);
gst_data.info_type_case = GST_DEBUGGER__GSTREAMER_DATA__INFO_TYPE_LOG_INFO;
gst_data.log_info = &log_info;
gst_debugserver_hooks_send_data (&log->hooks, tcp_server, &gst_data);
}
示例6: gst_object_set_name
EXPORT_C
#endif
gboolean
gst_object_set_name (GstObject * object, const gchar * name)
{
gboolean result;
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
GST_OBJECT_LOCK (object);
/* parented objects cannot be renamed */
if (G_UNLIKELY (object->parent != NULL))
goto had_parent;
if (name != NULL) {
g_free (object->name);
object->name = g_strdup (name);
GST_OBJECT_UNLOCK (object);
result = TRUE;
} else {
GST_OBJECT_UNLOCK (object);
result = gst_object_set_name_default (object);
}
return result;
/* error */
had_parent:
{
GST_WARNING ("parented objects can't be renamed");
GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
示例7: gst_object_unparent
EXPORT_C
#endif
void
gst_object_unparent (GstObject * object)
{
GstObject *parent;
g_return_if_fail (GST_IS_OBJECT (object));
GST_OBJECT_LOCK (object);
parent = object->parent;
if (G_LIKELY (parent != NULL)) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unparent");
object->parent = NULL;
GST_OBJECT_UNLOCK (object);
g_signal_emit (object, gst_object_signals[PARENT_UNSET], 0, parent);
gst_object_unref (object);
} else {
GST_OBJECT_UNLOCK (object);
}
}
示例8: gst_child_proxy_set_property
/**
* gst_child_proxy_set_property:
* @object: the parent object
* @name: name of the property to set
* @value: new #GValue for the property
*
* Sets a single property using the GstChildProxy mechanism.
*/
void
gst_child_proxy_set_property (GstChildProxy * object, const gchar * name,
const GValue * value)
{
GParamSpec *pspec;
GObject *target;
g_return_if_fail (GST_IS_CHILD_PROXY (object));
g_return_if_fail (name != NULL);
g_return_if_fail (G_IS_VALUE (value));
if (!gst_child_proxy_lookup (object, name, &target, &pspec))
goto not_found;
g_object_set_property (target, pspec->name, value);
g_object_unref (target);
return;
not_found:
{
g_warning ("cannot set property %s on object %s", name,
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""));
return;
}
}
示例9: gst_log_android_handler
static void gst_log_android_handler(GstDebugCategory *category,
GstDebugLevel level,
const gchar *file,
const gchar *function,
gint line,
GObject *object,
GstDebugMessage *message,
gpointer data)
{
gchar *obj = NULL;
OWR_UNUSED(data);
if (level > gst_debug_category_get_threshold(category))
return;
if (GST_IS_PAD(object) && GST_OBJECT_NAME(object)) {
obj = g_strdup_printf("<%s:%s>", GST_DEBUG_PAD_NAME(object));
} else if (GST_IS_OBJECT(object)) {
obj = g_strdup_printf("<%s>", GST_OBJECT_NAME(object));
}
__android_log_print(ANDROID_LOG_INFO, "gst_log", "%p %s %s %s:%d:%s:%s %s\n",
(void *)g_thread_self(),
gst_debug_level_get_name(level), gst_debug_category_get_name(category),
file, line, function, obj ? obj : "", gst_debug_message_get(message));
g_free(obj);
}
示例10: gst_index_get_writer_id
/**
* gst_index_get_writer_id:
* @index: the index to get a unique write id for
* @writer: the GstObject to allocate an id for
* @id: a pointer to a gint to hold the id
*
* Before entries can be added to the index, a writer
* should obtain a unique id. The methods to add new entries
* to the index require this id as an argument.
*
* The application can implement a custom function to map the writer object
* to a string. That string will be used to register or look up an id
* in the index.
*
* <note>
* The caller must not hold @writer's #GST_OBJECT_LOCK, as the default
* resolver may call functions that take the object lock as well, and
* the lock is not recursive.
* </note>
*
* Returns: TRUE if the writer would be mapped to an id.
*/
gboolean
gst_index_get_writer_id (GstIndex * index, GstObject * writer, gint * id)
{
gchar *writer_string = NULL;
GstIndexEntry *entry;
GstIndexClass *iclass;
gboolean success = FALSE;
g_return_val_if_fail (GST_IS_INDEX (index), FALSE);
g_return_val_if_fail (GST_IS_OBJECT (writer), FALSE);
g_return_val_if_fail (id, FALSE);
*id = -1;
/* first try to get a previously cached id */
entry = g_hash_table_lookup (index->writers, writer);
if (entry == NULL) {
iclass = GST_INDEX_GET_CLASS (index);
/* let the app make a string */
if (index->resolver) {
gboolean res;
res =
index->resolver (index, writer, &writer_string,
index->resolver_user_data);
if (!res)
return FALSE;
} else {
g_warning ("no resolver found");
return FALSE;
}
/* if the index has a resolver, make it map this string to an id */
if (iclass->get_writer_id) {
success = iclass->get_writer_id (index, id, writer_string);
}
/* if the index could not resolve, we allocate one ourselves */
if (!success) {
*id = ++index->last_id;
}
entry = gst_index_add_id (index, *id, writer_string);
if (!entry) {
/* index is probably not writable, make an entry anyway
* to keep it in our cache */
entry = g_slice_new (GstIndexEntry);
entry->type = GST_INDEX_ENTRY_ID;
entry->id = *id;
entry->data.id.description = writer_string;
}
g_hash_table_insert (index->writers, writer, entry);
} else {
*id = entry->id;
}
return TRUE;
}
示例11: gst_object_real_restore_thyself
static void
gst_object_real_restore_thyself (GstObject * object, xmlNodePtr self)
{
g_return_if_fail (GST_IS_OBJECT (object));
g_return_if_fail (self != NULL);
gst_class_signal_emit_by_name (object, "object_loaded", self);
}
示例12: gst_object_set_parent
EXPORT_C
#endif
gboolean
gst_object_set_parent (GstObject * object, GstObject * parent)
{
g_return_val_if_fail (GST_IS_OBJECT (object), FALSE);
g_return_val_if_fail (GST_IS_OBJECT (parent), FALSE);
g_return_val_if_fail (object != parent, FALSE);
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
"set parent (ref and sink)");
GST_OBJECT_LOCK (object);
if (G_UNLIKELY (object->parent != NULL))
goto had_parent;
/* sink object, we don't call our own function because we don't
* need to release/acquire the lock needlessly or touch the refcount
* in the floating case. */
object->parent = parent;
if (G_LIKELY (GST_OBJECT_IS_FLOATING (object))) {
GST_CAT_LOG_OBJECT (GST_CAT_REFCOUNTING, object, "unsetting floating flag");
GST_OBJECT_FLAG_UNSET (object, GST_OBJECT_FLOATING);
GST_OBJECT_UNLOCK (object);
} else {
GST_OBJECT_UNLOCK (object);
gst_object_ref (object);
}
g_signal_emit (object, gst_object_signals[PARENT_SET], 0, parent);
return TRUE;
/* ERROR handling */
had_parent:
{
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object,
"set parent failed, object already had a parent");
GST_OBJECT_UNLOCK (object);
return FALSE;
}
}
示例13: gst_object_set_name_prefix
void
gst_object_set_name_prefix (GstObject * object, const gchar * name_prefix)
{
g_return_if_fail (GST_IS_OBJECT (object));
GST_OBJECT_LOCK (object);
g_free (object->name_prefix);
object->name_prefix = g_strdup (name_prefix); /* NULL gives NULL */
GST_OBJECT_UNLOCK (object);
}
示例14: gst_child_proxy_lookup
/**
* gst_child_proxy_lookup:
* @childproxy: child proxy object to lookup the property in
* @name: name of the property to look up
* @target: (out) (allow-none) (transfer full): pointer to a #GObject that
* takes the real object to set property on
* @pspec: (out) (allow-none) (transfer none): pointer to take the #GParamSpec
* describing the property
*
* Looks up which object and #GParamSpec would be effected by the given @name.
*
* MT safe.
*
* Returns: TRUE if @target and @pspec could be found. FALSE otherwise. In that
* case the values for @pspec and @target are not modified. Unref @target after
* usage. For plain GObjects @target is the same as @object.
*/
gboolean
gst_child_proxy_lookup (GstChildProxy * childproxy, const gchar * name,
GObject ** target, GParamSpec ** pspec)
{
GObject *object;
gboolean res = FALSE;
gchar **names, **current;
g_return_val_if_fail (GST_IS_CHILD_PROXY (childproxy), FALSE);
g_return_val_if_fail (name != NULL, FALSE);
object = g_object_ref (childproxy);
current = names = g_strsplit (name, "::", -1);
/* find the owner of the property */
while (current[1]) {
GObject *next;
if (!GST_IS_CHILD_PROXY (object)) {
GST_INFO
("object %s is not a parent, so you cannot request a child by name %s",
(GST_IS_OBJECT (object) ? GST_OBJECT_NAME (object) : ""), current[0]);
break;
}
next = gst_child_proxy_get_child_by_name (GST_CHILD_PROXY (object),
current[0]);
if (!next) {
GST_INFO ("no such object %s", current[0]);
break;
}
g_object_unref (object);
object = next;
current++;
}
/* look for psec */
if (current[1] == NULL) {
GParamSpec *spec =
g_object_class_find_property (G_OBJECT_GET_CLASS (object), current[0]);
if (spec == NULL) {
GST_INFO ("no param spec named %s", current[0]);
} else {
if (pspec)
*pspec = spec;
if (target) {
g_object_ref (object);
*target = object;
}
res = TRUE;
}
}
g_object_unref (object);
g_strfreev (names);
return res;
}
示例15: gst_type_find_helper
GstCaps *
gst_type_find_helper (GstPad * src, guint64 size)
{
GstTypeFindHelperGetRangeFunction func;
g_return_val_if_fail (GST_IS_OBJECT (src), NULL);
g_return_val_if_fail (GST_PAD_GETRANGEFUNC (src) != NULL, NULL);
func = (GstTypeFindHelperGetRangeFunction) (GST_PAD_GETRANGEFUNC (src));
return gst_type_find_helper_get_range (GST_OBJECT (src), func, size, NULL);
}