:right-sidebar: True Promise =================================================================== .. currentmodule:: gi.repository.Gst .. versionadded:: 1.14 .. class:: Promise(**kwargs) :no-contents-entry: :Constructors: :: Promise() new() -> Gst.Promise new_with_change_func(func:Gst.PromiseChangeFunc, user_data=None) -> Gst.Promise Constructors ------------ .. rst-class:: interim-class .. class:: Promise :no-index: .. classmethod:: new() -> ~gi.repository.Gst.Promise .. versionadded:: 1.14 .. classmethod:: new_with_change_func(func: ~typing.Callable[[...], None], *user_data: ~typing.Any) -> ~gi.repository.Gst.Promise ``func`` will be called exactly once when transitioning out of :const:`~gi.repository.Gst.PromiseResult.PENDING` into any of the other :obj:`~gi.repository.Gst.PromiseResult` states. .. versionadded:: 1.14 :param func: a :obj:`~gi.repository.Gst.PromiseChangeFunc` to call :param user_data: argument to call ``func`` with Methods ------- .. rst-class:: interim-class .. class:: Promise :no-index: .. method:: expire() -> None Expire a ``promise``. This will wake up any waiters with :const:`~gi.repository.Gst.PromiseResult.EXPIRED`. Called by a message loop when the parent message is handled and/or destroyed (possibly unanswered). .. versionadded:: 1.14 .. method:: get_reply() -> ~gi.repository.Gst.Structure | None Retrieve the reply set on ``promise``. ``promise`` must be in :const:`~gi.repository.Gst.PromiseResult.REPLIED` and the returned structure is owned by ``promise`` .. versionadded:: 1.14 .. method:: interrupt() -> None Interrupt waiting for a ``promise``. This will wake up any waiters with :const:`~gi.repository.Gst.PromiseResult.INTERRUPTED`. Called when the consumer does not want the value produced anymore. .. versionadded:: 1.14 .. method:: reply(s: ~gi.repository.Gst.Structure | None = None) -> None Set a reply on ``promise``. This will wake up any waiters with :const:`~gi.repository.Gst.PromiseResult.REPLIED`. Called by the producer of the value to indicate success (or failure). If ``promise`` has already been interrupted by the consumer, then this reply is not visible to the consumer. .. versionadded:: 1.14 :param s: a :obj:`~gi.repository.Gst.Structure` with the the reply contents .. method:: wait() -> ~gi.repository.Gst.PromiseResult Wait for ``promise`` to move out of the :const:`~gi.repository.Gst.PromiseResult.PENDING` state. If ``promise`` is not in :const:`~gi.repository.Gst.PromiseResult.PENDING` then it will return immediately with the current result. .. versionadded:: 1.14 Fields ------ .. rst-class:: interim-class .. class:: Promise :no-index: .. attribute:: parent Parent :obj:`~gi.repository.Gst.MiniObject`