mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
context: Add persistent qualifier for a context
Non-persistent contexts are removed when elements go back to NULL state, persistent contexts are not. Applications most likely want to set persistent contexts.
This commit is contained in:
parent
a7f5dc8b8a
commit
e3ce799217
2 changed files with 31 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 2013 Collabora Ltd.
|
* Copyright (C) 2013 Collabora Ltd.
|
||||||
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
* Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
*
|
*
|
||||||
* gstcontext.h: Header for GstContext subsystem
|
* gstcontext.h: Header for GstContext subsystem
|
||||||
*
|
*
|
||||||
|
@ -63,6 +64,7 @@ struct _GstContext
|
||||||
GstMiniObject mini_object;
|
GstMiniObject mini_object;
|
||||||
|
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
gboolean persistent;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define GST_CONTEXT_STRUCTURE(c) (((GstContext *)(c))->structure)
|
#define GST_CONTEXT_STRUCTURE(c) (((GstContext *)(c))->structure)
|
||||||
|
@ -122,6 +124,8 @@ _gst_context_copy (GstContext * context)
|
||||||
gst_structure_set_parent_refcount (GST_CONTEXT_STRUCTURE (copy),
|
gst_structure_set_parent_refcount (GST_CONTEXT_STRUCTURE (copy),
|
||||||
©->mini_object.refcount);
|
©->mini_object.refcount);
|
||||||
|
|
||||||
|
copy->persistent = context->persistent;
|
||||||
|
|
||||||
return GST_CONTEXT_CAST (copy);
|
return GST_CONTEXT_CAST (copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,6 +139,7 @@ gst_context_init (GstContext * context)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_context_new:
|
* gst_context_new:
|
||||||
|
* @persistent: Persistent context
|
||||||
*
|
*
|
||||||
* Create a new context.
|
* Create a new context.
|
||||||
*
|
*
|
||||||
|
@ -143,7 +148,7 @@ gst_context_init (GstContext * context)
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
GstContext *
|
GstContext *
|
||||||
gst_context_new (void)
|
gst_context_new (gboolean persistent)
|
||||||
{
|
{
|
||||||
GstContext *context;
|
GstContext *context;
|
||||||
GstStructure *structure;
|
GstStructure *structure;
|
||||||
|
@ -157,6 +162,7 @@ gst_context_new (void)
|
||||||
gst_context_init (context);
|
gst_context_init (context);
|
||||||
|
|
||||||
GST_CONTEXT_STRUCTURE (context) = structure;
|
GST_CONTEXT_STRUCTURE (context) = structure;
|
||||||
|
context->persistent = persistent;
|
||||||
|
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
@ -174,7 +180,7 @@ gst_context_new (void)
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
const GstStructure *
|
const GstStructure *
|
||||||
gst_context_get_structure (GstContext * context)
|
gst_context_get_structure (const GstContext * context)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
|
g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
|
||||||
|
|
||||||
|
@ -202,3 +208,21 @@ gst_context_writable_structure (GstContext * context)
|
||||||
|
|
||||||
return GST_CONTEXT_STRUCTURE (context);
|
return GST_CONTEXT_STRUCTURE (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_context_is_persistent:
|
||||||
|
* @context: The #GstContext.
|
||||||
|
*
|
||||||
|
* Check if @context is persistent.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the context is persistent.
|
||||||
|
*
|
||||||
|
* Since: 1.2
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_context_is_persistent (const GstContext * context)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_CONTEXT (context), NULL);
|
||||||
|
|
||||||
|
return context->persistent;
|
||||||
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/* GStreamer
|
/* GStreamer
|
||||||
* Copyright (C) 2013 Collabora Ltd.
|
* Copyright (C) 2013 Collabora Ltd.
|
||||||
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
* Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
|
||||||
|
* Copyright (C) 2013 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
*
|
*
|
||||||
* gstcontext.h: Header for GstContext subsystem
|
* gstcontext.h: Header for GstContext subsystem
|
||||||
*
|
*
|
||||||
|
@ -143,11 +144,13 @@ gst_context_replace (GstContext **old_context, GstContext *new_context)
|
||||||
return gst_mini_object_replace ((GstMiniObject **) old_context, (GstMiniObject *) new_context);
|
return gst_mini_object_replace ((GstMiniObject **) old_context, (GstMiniObject *) new_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
GstContext * gst_context_new (void) G_GNUC_MALLOC;
|
GstContext * gst_context_new (gboolean persistent) G_GNUC_MALLOC;
|
||||||
|
|
||||||
const GstStructure * gst_context_get_structure (GstContext *context);
|
const GstStructure * gst_context_get_structure (const GstContext *context);
|
||||||
GstStructure * gst_context_writable_structure (GstContext *context);
|
GstStructure * gst_context_writable_structure (GstContext *context);
|
||||||
|
|
||||||
|
gboolean gst_context_is_persistent (const GstContext * context);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_CONTEXT_H__ */
|
#endif /* __GST_CONTEXT_H__ */
|
||||||
|
|
Loading…
Reference in a new issue