/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008 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 <gst/gst.h>
#include <glibmm/threads.h>
_PINCLUDE(glibmm/private/object_p.h)

namespace Gst
{

Object::Object(const Glib::ConstructParams& construct_params)
:
  Glib::Object(construct_params)
{
  // Get rid of the floating reference for newly constructed Gst::Objects.
  gst_object_ref_sink(gobj());
}

Object::Object(GstObject* castitem)
:
  Glib::Object(reinterpret_cast<GObject*>(castitem))
{
  if(G_LIKELY(g_object_is_floating(castitem)))
  {
    //The floating reference is convenience for C,
    //but is useless and difficult for us:
    gst_object_ref_sink(gobj());
  }
}

bool Object::is_element() const
{
  return GST_IS_ELEMENT(gobj());
}

bool Object::is_element_factory() const
{
  return GST_IS_ELEMENT_FACTORY(gobj());
}

bool Object::is_pad() const
{
  return GST_IS_PAD(gobj());
}

bool Object::is_pad_template() const
{
  return GST_IS_PAD_TEMPLATE(gobj());
}

bool Object::is_bin() const
{
  return GST_IS_BIN(gobj());
}

} // namespace Gst
