/* gstreamermm - a C++ wrapper for gstreamer * * Copyright 2008-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 #include _DEFS(gstreamermm,gst) namespace Gst { _WRAP_ENUM(PadTemplateFlags, GstPadTemplateFlags) _WRAP_ENUM(PadPresence, GstPadPresence) class Caps; class Pad; /** A class that describes the media type of a pad. * Padtemplates describe the possible media types a pad or an elementfactory * can handle. This allows for both inspection of handled types before loading * the element plugin as well as identifying pads on elements that are not yet * created (request or sometimes pads). * * Gst::Pad and PadTemplates have Gst::Caps attached to it to describe the * media type they are capable of dealing with. get_caps() is used to get the * caps of a padtemplate. It's not possible to modify the caps of a padtemplate * after creation. * * PadTemplates have a Gst::PadPresence property which identifies the lifetime * of the pad and that can be retrieved with get_presence(). Also the direction * of the pad can be retrieved from the GstPadTemplate with get_direction(). * * The get_name_template() method is important for Gst::PAD_REQUEST pads * because it has to be used as the name in the * Gst::Element::get_request_pad() call to instantiate a pad from this * template. * * Padtemplates can be created with create(). * A padtemplate can be used to create a pad (see Gst::Pad::create() methods). * * Last reviewed on 2016-06-06 (1.8.0) */ class PadTemplate : public Object { _CLASS_GOBJECT(PadTemplate, GstPadTemplate, GST_PAD_TEMPLATE, Object, GstObject) protected: _WRAP_CTOR(PadTemplate(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr& caps), gst_pad_template_new) public: /** Creates a new pad template with a name according to the given template * and with the given arguments. This functions takes ownership of the * provided caps, so be sure to not use them afterwards. * * @param name_template The name template. * @param direction The Gst::PadDirection of the template. * @param presence The Gst::PadPresence of the pad. * @param caps A Gst::Caps set for the template. The caps are taken ownership * of. * @return A new Gst::PadTemplate. */ _WRAP_CREATE(const Glib::ustring& name_template, PadDirection direction, PadPresence presence, const Glib::RefPtr& caps) _WRAP_METHOD(Glib::RefPtr get_caps(), gst_pad_template_get_caps) _WRAP_METHOD(Glib::RefPtr get_caps() const, gst_pad_template_get_caps, constversion) /** Get the nametemplate of the padtemplate. */ _MEMBER_GET(name_template, name_template, Glib::ustring, gchar*) /** Get the Gst::PadDirection of the padtemplate. */ _MEMBER_GET(direction, direction, PadDirection, GstPadDirection) /** Get the Gst::PadPresence of the padtemplate. */ _MEMBER_GET(presence, presence, PadPresence, GstPadPresence) _WRAP_PROPERTY("caps", Glib::RefPtr) _WRAP_PROPERTY("direction", Gst::PadDirection) _WRAP_PROPERTY("name-template", Glib::ustring) _WRAP_PROPERTY("presence", Gst::PadPresence) #m4 _CONVERSION(`GstPad*',`const Glib::RefPtr&',`Glib::wrap($3, true)') _WRAP_SIGNAL(void pad_created(const Glib::RefPtr& pad), "pad-created") //gst_pad_template_pad_created emits the "pad-created" signal. It seems //internal to C API (it is not found in API docs) so ignore it. _IGNORE(gst_pad_template_pad_created) }; class StaticPadTemplate { _CLASS_BOXEDTYPE_STATIC(StaticPadTemplate, GstStaticPadTemplate) public: _WRAP_METHOD(Glib::RefPtr get_caps(), gst_static_pad_template_get_caps) _WRAP_METHOD(Glib::RefPtr get_caps() const, gst_static_pad_template_get_caps, constversion) _WRAP_METHOD(Glib::RefPtr get(), gst_static_pad_template_get) /** Get the nametemplate of the padtemplate. */ _MEMBER_GET(name_template, name_template, Glib::ustring, gchar*) /** Get the Gst::PadDirection of the padtemplate. */ _MEMBER_GET(direction, direction, PadDirection, GstPadDirection) /** Get the Gst::PadPresence of the padtemplate. */ _MEMBER_GET(presence, presence, PadPresence, GstPadPresence) }; #ifndef DOXYGEN_SHOULD_SKIP_THIS struct StaticPadTemplateTraits { typedef const Gst::StaticPadTemplate CppType; typedef const GstStaticPadTemplate * CType; typedef GstStaticPadTemplate * CTypeNonConst; static CType to_c_type (CppType& obj) { return obj.gobj(); } static CType to_c_type (CType ptr) { return ptr; } static CppType to_cpp_type (CType ptr) { return CppType(const_cast(ptr)); } static void release_c_type (CType) { } }; #endif //DOXYGEN_SHOULD_SKIP_THIS } //namespace Gst