/* gstreamermm - a C++ wrapper for gstreamer * * Copyright 2014-2016 The gstreamermm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include #include _DEFS(gstreamermm,gst) namespace Gst { class Structure; /** Lightweight objects to represent element contexts * * Gst::Context is a container object used to store contexts like a device * context, a display server connection and similar concepts that should * be shared between multiple elements. * * Applications can set a context on a complete pipeline by using * Gst::Element::set_context(), which will then be propagated to all * child elements. Elements can handle these in Gst::Element::set_context_vfunc() * and merge them with the context information they already have. * * When an element needs a context it will do the following actions in this * order until one step succeeds: * 1. Check if the element already has a context * 2. Query downstream with Gst::QUERY_CONTEXT for the context * 3. Query upstream with Gst::QUERY_CONTEXT for the context * 4. Post a Gst::MESSAGE_NEED_CONTEXT message on the bus with the required * context types and afterwards check if a usable context was set now * 5. Create a context by itself and post a Gst::MESSAGE_HAVE_CONTEXT message * on the bus. * * Bins will catch Gst::MESSAGE_NEED_CONTEXT messages and will set any previously * known context on the element that asks for it if possible. Otherwise the * application should provide one if it can. * * Last reviewed on 2016-05-16 (1.8.0) * * Since: 1.2 */ class Context : public MiniObject { _CLASS_OPAQUE_REFCOUNTED(Context, GstContext, NONE, gst_context_ref, gst_context_unref) _IGNORE(gst_context_ref, gst_context_unref) public: _WRAP_METHOD(static Glib::RefPtr create(const Glib::ustring& context_type, bool persistent), gst_context_new) _WRAP_METHOD(Glib::RefPtr copy() const, gst_context_copy) _WRAP_METHOD(Glib::ustring get_context_type() const, gst_context_get_context_type) _WRAP_METHOD(bool has_context_type(const Glib::ustring& context_type) const, gst_context_has_context_type) _WRAP_METHOD(bool is_persistent() const, gst_context_is_persistent) _WRAP_METHOD(Gst::Structure writable_structure() const, gst_context_writable_structure) }; }