| 1 |
/* gstreamermm - a C++ wrapper for gstreamer |
| 2 |
* |
| 3 |
* Copyright 2014-2016 The gstreamermm Development Team |
| 4 |
* |
| 5 |
* This library is free software; you can redistribute it and/or |
| 6 |
* modify it under the terms of the GNU Lesser General Public |
| 7 |
* License as published by the Free Software Foundation; either |
| 8 |
* version 2.1 of the License, or (at your option) any later version. |
| 9 |
* |
| 10 |
* This library is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
* Lesser General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU Lesser General Public |
| 16 |
* License along with this library; if not, write to the Free |
| 17 |
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 18 |
*/ |
| 19 |
|
| 20 |
#include <gst/gstcontext.h> |
| 21 |
#include <gstreamermm/miniobject.h> |
| 22 |
|
| 23 |
_DEFS(gstreamermm,gst) |
| 24 |
|
| 25 |
namespace Gst |
| 26 |
{ |
| 27 |
|
| 28 |
class Structure; |
| 29 |
|
| 30 |
/** Lightweight objects to represent element contexts |
| 31 |
* |
| 32 |
* Gst::Context is a container object used to store contexts like a device |
| 33 |
* context, a display server connection and similar concepts that should |
| 34 |
* be shared between multiple elements. |
| 35 |
* |
| 36 |
* Applications can set a context on a complete pipeline by using |
| 37 |
* Gst::Element::set_context(), which will then be propagated to all |
| 38 |
* child elements. Elements can handle these in Gst::Element::set_context_vfunc() |
| 39 |
* and merge them with the context information they already have. |
| 40 |
* |
| 41 |
* When an element needs a context it will do the following actions in this |
| 42 |
* order until one step succeeds: |
| 43 |
* 1. Check if the element already has a context |
| 44 |
* 2. Query downstream with Gst::QUERY_CONTEXT for the context |
| 45 |
* 3. Query upstream with Gst::QUERY_CONTEXT for the context |
| 46 |
* 4. Post a Gst::MESSAGE_NEED_CONTEXT message on the bus with the required |
| 47 |
* context types and afterwards check if a usable context was set now |
| 48 |
* 5. Create a context by itself and post a Gst::MESSAGE_HAVE_CONTEXT message |
| 49 |
* on the bus. |
| 50 |
* |
| 51 |
* Bins will catch Gst::MESSAGE_NEED_CONTEXT messages and will set any previously |
| 52 |
* known context on the element that asks for it if possible. Otherwise the |
| 53 |
* application should provide one if it can. |
| 54 |
* |
| 55 |
* Last reviewed on 2016-05-16 (1.8.0) |
| 56 |
* |
| 57 |
* Since: 1.2 |
| 58 |
*/ |
| 59 |
class Context : public MiniObject |
| 60 |
{ |
| 61 |
_CLASS_OPAQUE_REFCOUNTED(Context, GstContext, NONE, gst_context_ref, gst_context_unref) |
| 62 |
|
| 63 |
_IGNORE(gst_context_ref, gst_context_unref) |
| 64 |
|
| 65 |
public: |
| 66 |
_WRAP_METHOD(static Glib::RefPtr<Gst::Context> create(const Glib::ustring& context_type, bool persistent), gst_context_new) |
| 67 |
|
| 68 |
_WRAP_METHOD(Glib::RefPtr<Gst::Context> copy() const, gst_context_copy) |
| 69 |
|
| 70 |
_WRAP_METHOD(Glib::ustring get_context_type() const, gst_context_get_context_type) |
| 71 |
|
| 72 |
_WRAP_METHOD(bool has_context_type(const Glib::ustring& context_type) const, gst_context_has_context_type) |
| 73 |
|
| 74 |
_WRAP_METHOD(bool is_persistent() const, gst_context_is_persistent) |
| 75 |
|
| 76 |
_WRAP_METHOD(Gst::Structure writable_structure() const, gst_context_writable_structure) |
| 77 |
}; |
| 78 |
} |