Remove Context from Elements

Tom Bailey tom.bailey at
Tue Apr 6 17:45:55 UTC 2021

Hi Nicolas,

I've been working with Matthew on this project so I can expand a bit on the problem he's facing. We are using a custom GstContext with our pipeline, which is allocated and set by the application in response to the GST_MESSAGE_NEED_CONTEXT. At some point this context can be marked as invalid, which can be achieved with the existing API by setting a new context with some fields in the underlying GstStructure set to null. We would then like the elements in the pipeline to request a new context from the application by sending another GST_MESSAGE_NEED_CONTEXT, but this message is intercepted by GstBin, which simply sets the original context (

It's not possible to pass a null pointer to gst_element_set_context() to "null out" an existing context, which would force GstBin to request a new one from the application.

It looks like we would need a new API, gst_element_remove_context(), in order to achieve what we want, unless we have missed something?

Best regards

gstreamer/gstbin.c at master · GStreamer/gstreamer · GitHub<>
GStreamer open-source multimedia framework core library - GStreamer/gstreamer

From: gstreamer-devel <gstreamer-devel-bounces at> on behalf of Nicolas Dufresne <nicolas at>
Sent: 06 April 2021 14:57
To: Discussion of the development of and with GStreamer <gstreamer-devel at>
Subject: Re: Remove Context from Elements

[External email]

Le mardi 06 avril 2021 à 08:43 +0100, Matthew Walker a écrit :
> Hi all,
> I am working on an application which creates and utilises gstreamer pipelines.
> One of the requirements is that the application must be able to erase the STC
> context from the pipeline when stopping playback.
> Currently I am using a function which resets the STC context on a given
> element in conjunction with gst_iterator_foreach but I was wondering if there
> was a better way to do this. Is there a gstreamer function which can remove
> the STC context type from the context list of every element in a pipeline?

All GstContext stored should be release when setting the pipeline to NULL state.
If not, this is a bug.

> Thanks for your help,
> Matthew
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at

gstreamer-devel mailing list
gstreamer-devel at

[External email. Treat hyperlinks and attachments with caution]

This transmission contains information that may be confidential and contain personal views which are not necessarily those of YouView TV Ltd. YouView TV Ltd (Co No:7308805) is a limited liability company registered in England and Wales with its registered address at YouView TV Ltd, 3rd Floor, 10 Lower Thames Street, London, EC3R 6YT. For details see our web site at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list