/* 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 #include #include #include #include #include #include #include _PINCLUDE(gstreamermm/private/object_p.h) namespace Gst { namespace Enums { Glib::ustring get_name(State s) { return gst_element_state_get_name(GstState(s)); } Glib::ustring get_name(StateChangeReturn s) { return gst_element_state_change_return_get_name(GstStateChangeReturn(s)); } } //namespace Enums Glib::RefPtr Element::link(const Glib::RefPtr& dest) { if(!dest) gstreamermm_handle_error("Failed to link null element."); const bool result = gst_element_link(gobj(), Glib::unwrap(dest)); if(result) return dest; else { gstreamermm_handle_error("failed to link: " + get_name() + "->" + dest->get_name()); return Glib::RefPtr(); } } Glib::RefPtr Element::link(const Glib::RefPtr& dest, const Glib::RefPtr& filter) { if(!dest) gstreamermm_handle_error("Failed to link null element."); const bool result = gst_element_link_filtered(gobj(), Glib::unwrap(dest), Glib::unwrap(filter)); if(result) return dest; else { gstreamermm_handle_error("failed to link: " + get_name() + "->" + dest->get_name()); return Glib::RefPtr(); } } void Element::post_message(int code, int line, MessageType type, const Glib::QueryQuark& domain, const Glib::ustring& text, const Glib::ustring& debug, const Glib::ustring& file, const Glib::ustring& function) { gchar* gst_text = g_strdup(text.c_str()); gchar* gst_debug = g_strdup(debug.c_str()); gst_element_message_full(gobj(), static_cast(type), domain, code, gst_text, gst_debug, file.c_str(), function.c_str(), line); } bool Element::send_event(const Glib::RefPtr& event) { event->reference(); return gst_element_send_event(gobj(), Glib::unwrap(event)); } Glib::RefPtr Gst::Element::get_pad_template(const Glib::ustring &factory_name) const { return Glib::wrap(gst_element_class_get_pad_template(GST_ELEMENT_GET_CLASS(gobject_), factory_name.c_str()), true); } } //namespace Gst