| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/elementfactory.h> |
| 7 | #include <gstreamermm/private/elementfactory_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008-2016 The gstreamermm Development Team |
| 13 | * |
| 14 | * This library is free software; you can redistribute it and/or |
| 15 | * modify it under the terms of the GNU Lesser General Public |
| 16 | * License as published by the Free Software Foundation; either |
| 17 | * version 2.1 of the License, or (at your option) any later version. |
| 18 | * |
| 19 | * This library is distributed in the hope that it will be useful, |
| 20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 22 | * Lesser General Public License for more details. |
| 23 | * |
| 24 | * You should have received a copy of the GNU Lesser General Public |
| 25 | * License along with this library; if not, write to the Free |
| 26 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 27 | */ |
| 28 | |
| 29 | #include <gst/gst.h> |
| 30 | #include <gstreamermm/caps.h> |
| 31 | #include <gstreamermm/element.h> |
| 32 | #include <gstreamermm/padtemplate.h> |
| 33 | #include <gstreamermm/plugin.h> |
| 34 | |
| 35 | |
| 36 | namespace Gst |
| 37 | { |
| 38 | |
| 39 | // Make sure the order here is the same as in Gst::ElementFactoryListType. |
| 40 | static GstElementFactoryListType const _list_types[] = |
| 41 | { |
| 42 | GST_ELEMENT_FACTORY_TYPE_ANY, |
| 43 | GST_ELEMENT_FACTORY_TYPE_AUDIOVIDEO_SINKS, |
| 44 | GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER, |
| 45 | GST_ELEMENT_FACTORY_TYPE_DECODABLE, |
| 46 | GST_ELEMENT_FACTORY_TYPE_DECODER, |
| 47 | GST_ELEMENT_FACTORY_TYPE_DEMUXER, |
| 48 | GST_ELEMENT_FACTORY_TYPE_DEPAYLOADER, |
| 49 | GST_ELEMENT_FACTORY_TYPE_ENCODER, |
| 50 | GST_ELEMENT_FACTORY_TYPE_FORMATTER, |
| 51 | GST_ELEMENT_FACTORY_TYPE_MAX_ELEMENTS, |
| 52 | GST_ELEMENT_FACTORY_TYPE_MEDIA_AUDIO, |
| 53 | GST_ELEMENT_FACTORY_TYPE_MEDIA_IMAGE, |
| 54 | GST_ELEMENT_FACTORY_TYPE_MEDIA_METADATA, |
| 55 | GST_ELEMENT_FACTORY_TYPE_MEDIA_SUBTITLE, |
| 56 | GST_ELEMENT_FACTORY_TYPE_MEDIA_VIDEO, |
| 57 | GST_ELEMENT_FACTORY_TYPE_MEDIA_ANY, |
| 58 | GST_ELEMENT_FACTORY_TYPE_MUXER, |
| 59 | GST_ELEMENT_FACTORY_TYPE_PARSER, |
| 60 | GST_ELEMENT_FACTORY_TYPE_PAYLOADER, |
| 61 | GST_ELEMENT_FACTORY_TYPE_SINK, |
| 62 | GST_ELEMENT_FACTORY_TYPE_SRC, |
| 63 | GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER |
| 64 | }; |
| 65 | |
| 66 | } //namespace Gst |
| 67 | |
| 68 | namespace |
| 69 | { |
| 70 | } // anonymous namespace |
| 71 | |
| 72 | |
| 73 | namespace Glib |
| 74 | { |
| 75 | |
| 76 | Glib::RefPtr<Gst::ElementFactory> wrap(GstElementFactory* object, bool take_copy) |
| 77 | { |
| 78 | return Glib::RefPtr<Gst::ElementFactory>( dynamic_cast<Gst::ElementFactory*> (Glib::wrap_auto ((GObject*)(object), take_copy)) ); |
| 79 | //We use dynamic_cast<> in case of multiple inheritance. |
| 80 | } |
| 81 | |
| 82 | } /* namespace Glib */ |
| 83 | |
| 84 | |
| 85 | namespace Gst |
| 86 | { |
| 87 | |
| 88 | |
| 89 | /* The *_Class implementation: */ |
| 90 | |
| 91 | const Glib::Class& ElementFactory_Class::init() |
| 92 | { |
| 93 | if(!gtype_) // create the GType if necessary |
| 94 | { |
| 95 | // Glib::Class has to know the class init function to clone custom types. |
| 96 | class_init_func_ = &ElementFactory_Class::class_init_function; |
| 97 | |
| 98 | // This is actually just optimized away, apparently with no harm. |
| 99 | // Make sure that the parent type has been created. |
| 100 | //CppClassParent::CppObjectType::get_type(); |
| 101 | |
| 102 | // Create the wrapper type, with the same class/instance size as the base type. |
| 103 | register_derived_type(gst_element_factory_get_type()); |
| 104 | |
| 105 | // Add derived versions of interfaces, if the C type implements any interfaces: |
| 106 | |
| 107 | } |
| 108 | |
| 109 | return *this; |
| 110 | } |
| 111 | |
| 112 | |
| 113 | void ElementFactory_Class::class_init_function(void* g_class, void* class_data) |
| 114 | { |
| 115 | const auto klass = static_cast<BaseClassType*>(g_class); |
| 116 | CppClassParent::class_init_function(klass, class_data); |
| 117 | |
| 118 | |
| 119 | } |
| 120 | |
| 121 | |
| 122 | Glib::ObjectBase* ElementFactory_Class::wrap_new(GObject* object) |
| 123 | { |
| 124 | return new ElementFactory((GstElementFactory*)object); |
| 125 | } |
| 126 | |
| 127 | |
| 128 | /* The implementation: */ |
| 129 | |
| 130 | GstElementFactory* ElementFactory::gobj_copy() |
| 131 | { |
| 132 | reference(); |
| 133 | return gobj(); |
| 134 | } |
| 135 | |
| 136 | ElementFactory::ElementFactory(const Glib::ConstructParams& construct_params) |
| 137 | : |
| 138 | PluginFeature(construct_params) |
| 139 | { |
| 140 | |
| 141 | } |
| 142 | |
| 143 | ElementFactory::ElementFactory(GstElementFactory* castitem) |
| 144 | : |
| 145 | PluginFeature((GstPluginFeature*)(castitem)) |
| 146 | {} |
| 147 | |
| 148 | |
| 149 | ElementFactory::ElementFactory(ElementFactory&& src) noexcept |
| 150 | : PluginFeature(std::move(src)) |
| 151 | {} |
| 152 | |
| 153 | ElementFactory& ElementFactory::operator=(ElementFactory&& src) noexcept |
| 154 | { |
| 155 | PluginFeature::operator=(std::move(src)); |
| 156 | return *this; |
| 157 | } |
| 158 | |
| 159 | |
| 160 | ElementFactory::~ElementFactory() noexcept |
| 161 | {} |
| 162 | |
| 163 | |
| 164 | ElementFactory::CppClassType ElementFactory::elementfactory_class_; // initialize static member |
| 165 | |
| 166 | GType ElementFactory::get_type() |
| 167 | { |
| 168 | return elementfactory_class_.init().get_type(); |
| 169 | } |
| 170 | |
| 171 | |
| 172 | GType ElementFactory::get_base_type() |
| 173 | { |
| 174 | return gst_element_factory_get_type(); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | bool ElementFactory::register_element(const Glib::RefPtr<Gst::Plugin>& plugin, const Glib::ustring& name, guint rank, GType type) |
| 179 | { |
| 180 | return gst_element_register(Glib::unwrap(plugin), name.c_str(), rank, type); |
| 181 | } |
| 182 | |
| 183 | Glib::RefPtr<Gst::ElementFactory> ElementFactory::find(const Glib::ustring& name) |
| 184 | { |
| 185 | return Glib::wrap(gst_element_factory_find(name.c_str())); |
| 186 | } |
| 187 | |
| 188 | Glib::RefPtr<Gst::Element> ElementFactory::create(const Glib::ustring& name) |
| 189 | { |
| 190 | return Glib::wrap(gst_element_factory_create(gobj(), name.empty() ? nullptr : name.c_str())); |
| 191 | } |
| 192 | |
| 193 | Glib::RefPtr<Gst::Element> ElementFactory::create() |
| 194 | { |
| 195 | return Glib::wrap(gst_element_factory_create(gobj(), nullptr)); |
| 196 | } |
| 197 | |
| 198 | Glib::RefPtr<Gst::Element> ElementFactory::create_element(const Glib::ustring& factory_name, const Glib::ustring& name) |
| 199 | { |
| 200 | return Glib::wrap(gst_element_factory_make(factory_name.c_str(), name.empty() ? nullptr : name.c_str())); |
| 201 | } |
| 202 | |
| 203 | Glib::RefPtr<Gst::Element> ElementFactory::create_element(const Glib::ustring& factory_name) |
| 204 | { |
| 205 | return Glib::wrap(gst_element_factory_make(factory_name.c_str(), nullptr)); |
| 206 | } |
| 207 | |
| 208 | bool ElementFactory::can_sink_all_caps(const Glib::RefPtr<const Gst::Caps>& caps) const |
| 209 | { |
| 210 | return gst_element_factory_can_sink_all_caps(const_cast<GstElementFactory*>(gobj()), Glib::unwrap(caps)); |
| 211 | } |
| 212 | |
| 213 | bool ElementFactory::can_src_all_caps(const Glib::RefPtr<const Gst::Caps>& caps) const |
| 214 | { |
| 215 | return gst_element_factory_can_src_all_caps(const_cast<GstElementFactory*>(gobj()), Glib::unwrap(caps)); |
| 216 | } |
| 217 | |
| 218 | bool ElementFactory::can_sink_any_caps(const Glib::RefPtr<const Gst::Caps>& caps) const |
| 219 | { |
| 220 | return gst_element_factory_can_sink_any_caps(const_cast<GstElementFactory*>(gobj()), Glib::unwrap(caps)); |
| 221 | } |
| 222 | |
| 223 | bool ElementFactory::can_src_any_caps(const Glib::RefPtr<const Gst::Caps>& caps) const |
| 224 | { |
| 225 | return gst_element_factory_can_src_any_caps(const_cast<GstElementFactory*>(gobj()), Glib::unwrap(caps)); |
| 226 | } |
| 227 | |
| 228 | GType ElementFactory::get_element_type() const |
| 229 | { |
| 230 | return gst_element_factory_get_element_type(const_cast<GstElementFactory*>(gobj())); |
| 231 | } |
| 232 | |
| 233 | std::vector<Glib::ustring> ElementFactory::get_metadata_keys() const |
| 234 | { |
| 235 | return Glib::ArrayHandler<Glib::ustring>::array_to_vector(gst_element_factory_get_metadata_keys(const_cast<GstElementFactory*>(gobj())), Glib::OWNERSHIP_DEEP); |
| 236 | } |
| 237 | |
| 238 | Glib::ustring ElementFactory::get_metadata(const Glib::ustring& key) const |
| 239 | { |
| 240 | return Glib::convert_const_gchar_ptr_to_ustring(gst_element_factory_get_metadata(const_cast<GstElementFactory*>(gobj()), key.c_str())); |
| 241 | } |
| 242 | |
| 243 | guint ElementFactory::get_num_pad_templates() const |
| 244 | { |
| 245 | return gst_element_factory_get_num_pad_templates(const_cast<GstElementFactory*>(gobj())); |
| 246 | } |
| 247 | |
| 248 | URIType ElementFactory::get_uri_type() const |
| 249 | { |
| 250 | return ((URIType)(gst_element_factory_get_uri_type(const_cast<GstElementFactory*>(gobj())))); |
| 251 | } |
| 252 | |
| 253 | std::vector<Glib::ustring> ElementFactory::get_uri_protocols() const |
| 254 | { |
| 255 | return Glib::ArrayHandler<Glib::ustring>::array_to_vector(gst_element_factory_get_uri_protocols(const_cast<GstElementFactory*>(gobj())), Glib::OWNERSHIP_DEEP); |
| 256 | } |
| 257 | |
| 258 | bool ElementFactory::has_interface(const Glib::ustring& name) const |
| 259 | { |
| 260 | return gst_element_factory_has_interface(const_cast<GstElementFactory*>(gobj()), name.c_str()); |
| 261 | } |
| 262 | |
| 263 | std::vector< Gst::StaticPadTemplate > ElementFactory::get_static_pad_templates() const |
| 264 | { |
| 265 | return Glib::ListHandler< Gst::StaticPadTemplate, StaticPadTemplateTraits >::list_to_vector(const_cast<GList*>(gst_element_factory_get_static_pad_templates(const_cast<GstElementFactory*>(gobj()))), Glib::OWNERSHIP_NONE); |
| 266 | } |
| 267 | |
| 268 | std::vector< Glib::RefPtr<Gst::ElementFactory> > ElementFactory::filter(const std::vector< Glib::RefPtr<Gst::ElementFactory> >& list, const Glib::RefPtr<const Gst::Caps>& caps, PadDirection direction, bool subsetonly) |
| 269 | { |
| 270 | return Glib::ListHandler< Glib::RefPtr<Gst::ElementFactory> >::list_to_vector(gst_element_factory_list_filter(Glib::ListHandler< Glib::RefPtr<Gst::ElementFactory> >::vector_to_list(list).data(), Glib::unwrap(caps), ((GstPadDirection)(direction)), static_cast<int>(subsetonly)), Glib::OWNERSHIP_DEEP); |
| 271 | } |
| 272 | |
| 273 | std::vector< Glib::RefPtr<Gst::ElementFactory> > ElementFactory::get_elements(ElementFactoryListType type, Rank minrank) |
| 274 | { |
| 275 | return Glib::ListHandler< Glib::RefPtr<Gst::ElementFactory> >::list_to_vector(gst_element_factory_list_get_elements(_list_types[type], ((GstRank)(minrank))), Glib::OWNERSHIP_DEEP); |
| 276 | } |
| 277 | |
| 278 | bool ElementFactory::is_type(ElementFactoryListType type) const |
| 279 | { |
| 280 | return gst_element_factory_list_is_type(const_cast<GstElementFactory*>(gobj()), _list_types[type]); |
| 281 | } |
| 282 | |
| 283 | |
| 284 | } // namespace Gst |
| 285 | |
| 286 |