| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_CONTEXT_H |
| 3 | #define _GSTREAMERMM_CONTEXT_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2014-2016 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gst/gstcontext.h> |
| 29 | #include <gstreamermm/miniobject.h> |
| 30 | |
| 31 | |
| 32 | namespace Gst |
| 33 | { |
| 34 | |
| 35 | class Structure; |
| 36 | |
| 37 | /** Lightweight objects to represent element contexts |
| 38 | * |
| 39 | * Gst::Context is a container object used to store contexts like a device |
| 40 | * context, a display server connection and similar concepts that should |
| 41 | * be shared between multiple elements. |
| 42 | * |
| 43 | * Applications can set a context on a complete pipeline by using |
| 44 | * Gst::Element::set_context(), which will then be propagated to all |
| 45 | * child elements. Elements can handle these in Gst::Element::set_context_vfunc() |
| 46 | * and merge them with the context information they already have. |
| 47 | * |
| 48 | * When an element needs a context it will do the following actions in this |
| 49 | * order until one step succeeds: |
| 50 | * 1. Check if the element already has a context |
| 51 | * 2. Query downstream with Gst::QUERY_CONTEXT for the context |
| 52 | * 3. Query upstream with Gst::QUERY_CONTEXT for the context |
| 53 | * 4. Post a Gst::MESSAGE_NEED_CONTEXT message on the bus with the required |
| 54 | * context types and afterwards check if a usable context was set now |
| 55 | * 5. Create a context by itself and post a Gst::MESSAGE_HAVE_CONTEXT message |
| 56 | * on the bus. |
| 57 | * |
| 58 | * Bins will catch Gst::MESSAGE_NEED_CONTEXT messages and will set any previously |
| 59 | * known context on the element that asks for it if possible. Otherwise the |
| 60 | * application should provide one if it can. |
| 61 | * |
| 62 | * Last reviewed on 2016-05-16 (1.8.0) |
| 63 | * |
| 64 | * Since: 1.2 |
| 65 | */ |
| 66 | class Context : public MiniObject |
| 67 | { |
| 68 | public: |
| 69 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 70 | using CppObjectType = Context; |
| 71 | using BaseObjectType = GstContext; |
| 72 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 73 | |
| 74 | |
| 75 | /** Increment the reference count for this object. |
| 76 | * You should never need to do this manually - use the object via a RefPtr instead. |
| 77 | */ |
| 78 | void reference() const; |
| 79 | |
| 80 | /** Decrement the reference count for this object. |
| 81 | * You should never need to do this manually - use the object via a RefPtr instead. |
| 82 | */ |
| 83 | void unreference() const; |
| 84 | |
| 85 | ///Provides access to the underlying C instance. |
| 86 | GstContext* gobj(); |
| 87 | |
| 88 | ///Provides access to the underlying C instance. |
| 89 | const GstContext* gobj() const; |
| 90 | |
| 91 | ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. |
| 92 | GstContext* gobj_copy() const; |
| 93 | |
| 94 | Context() = delete; |
| 95 | |
| 96 | // noncopyable |
| 97 | Context(const Context&) = delete; |
| 98 | Context& operator=(const Context&) = delete; |
| 99 | |
| 100 | protected: |
| 101 | // Do not derive this. Gst::Context can neither be constructed nor deleted. |
| 102 | |
| 103 | void operator delete(void*, std::size_t); |
| 104 | |
| 105 | private: |
| 106 | |
| 107 | |
| 108 | public: |
| 109 | |
| 110 | /** Create a new context. |
| 111 | * |
| 112 | * @param context_type Context type. |
| 113 | * @param persistent Persistent context. |
| 114 | * @return The new context. |
| 115 | */ |
| 116 | static Glib::RefPtr<Gst::Context> create(const Glib::ustring& context_type, bool persistent); |
| 117 | |
| 118 | |
| 119 | /** Creates a copy of the context. Returns a copy of the context. |
| 120 | * |
| 121 | * @return A new copy of @a context. |
| 122 | * |
| 123 | * MT safe. |
| 124 | */ |
| 125 | Glib::RefPtr<Gst::Context> copy() const; |
| 126 | |
| 127 | |
| 128 | /** Get the type of @a context. |
| 129 | * |
| 130 | * @return The type of the context. |
| 131 | */ |
| 132 | Glib::ustring get_context_type() const; |
| 133 | |
| 134 | |
| 135 | /** Checks if @a context has @a context_type. |
| 136 | * |
| 137 | * @param context_type Context type to check. |
| 138 | * @return <tt>true</tt> if @a context has @a context_type. |
| 139 | */ |
| 140 | bool has_context_type(const Glib::ustring& context_type) const; |
| 141 | |
| 142 | |
| 143 | /** Check if @a context is persistent. |
| 144 | * |
| 145 | * @return <tt>true</tt> if the context is persistent. |
| 146 | */ |
| 147 | bool is_persistent() const; |
| 148 | |
| 149 | |
| 150 | /** Get a writable version of the structure. |
| 151 | * |
| 152 | * @return The structure of the context. The structure is still |
| 153 | * owned by the context, which means that you should not free it and |
| 154 | * that the pointer becomes invalid when you free the context. |
| 155 | * This function checks if @a context is writable. |
| 156 | */ |
| 157 | Gst::Structure writable_structure() const; |
| 158 | |
| 159 | |
| 160 | }; |
| 161 | } |
| 162 | |
| 163 | |
| 164 | namespace Glib |
| 165 | { |
| 166 | |
| 167 | /** A Glib::wrap() method for this object. |
| 168 | * |
| 169 | * @param object The C instance. |
| 170 | * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. |
| 171 | * @result A C++ instance that wraps this C instance. |
| 172 | * |
| 173 | * @relates Gst::Context |
| 174 | */ |
| 175 | Glib::RefPtr<Gst::Context> wrap(GstContext* object, bool take_copy = false); |
| 176 | |
| 177 | } // namespace Glib |
| 178 | |
| 179 | |
| 180 | #endif /* _GSTREAMERMM_CONTEXT_H */ |
| 181 |