// Generated by gmmproc 2.50.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gstreamermm-plugins-bad/glfilter.h>
#include <gstreamermm-plugins-bad/private/glfilter_p.h>


/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008-2015 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.
 */


static void Slot_Texture_Operation_gstreamermm_callback(gint param1, gint param2, guint param3, gpointer stuff)
{
  Gst::Bad::GLFilter::SlotTextureOperation* the_slot = static_cast<Gst::Bad::GLFilter::SlotTextureOperation*>(stuff);
  (*the_slot)(param1, param2, param3);
  delete the_slot;
}

namespace Gst
{
namespace Bad
{
void GLFilter::render_to_target(bool resize, GLuint input, GLuint target, const SlotTextureOperation& slot)
{
  SlotTextureOperation* slot_copy = new SlotTextureOperation(slot);
  gst_gl_filter_render_to_target(gobj(), resize, input, target, &Slot_Texture_Operation_gstreamermm_callback, slot_copy);
}

} // namespace Bad
} //namespace Gst

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gst::Bad::GLFilter> wrap(GstGLFilter* object, bool take_copy)
{
  return Glib::RefPtr<Gst::Bad::GLFilter>( dynamic_cast<Gst::Bad::GLFilter*> (Glib::wrap_auto ((GObject*)(object), take_copy)) );
  //We use dynamic_cast<> in case of multiple inheritance.
}

} /* namespace Glib */


namespace Gst
{

namespace Bad
{


/* The *_Class implementation: */

const Glib::Class& GLFilter_Class::init()
{
  if(!gtype_) // create the GType if necessary
  {
    // Glib::Class has to know the class init function to clone custom types.
    class_init_func_ = &GLFilter_Class::class_init_function;

    // This is actually just optimized away, apparently with no harm.
    // Make sure that the parent type has been created.
    //CppClassParent::CppObjectType::get_type();

    // Create the wrapper type, with the same class/instance size as the base type.
    register_derived_type(gst_gl_filter_get_type());

    // Add derived versions of interfaces, if the C type implements any interfaces:

  }

  return *this;
}


void GLFilter_Class::class_init_function(void* g_class, void* class_data)
{
  const auto klass = static_cast<BaseClassType*>(g_class);
  CppClassParent::class_init_function(klass, class_data);

  klass->filter = &filter_vfunc_callback;
  klass->filter_texture = &filter_texture_vfunc_callback;
  klass->init_fbo = &init_fbo_vfunc_callback;

}

gboolean GLFilter_Class::filter_vfunc_callback(GstGLFilter* self, GstBuffer* inbuf, GstBuffer* outbuf)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->filter_vfunc(Glib::wrap(inbuf, true)
, Glib::wrap(outbuf, true)
));
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->filter)
    return (*base->filter)(self, inbuf, outbuf);

  using RType = gboolean;
  return RType();
}
gboolean GLFilter_Class::filter_texture_vfunc_callback(GstGLFilter* self, guint in_tex, guint out_tex)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->filter_texture_vfunc(in_tex, out_tex));
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->filter_texture)
    return (*base->filter_texture)(self, in_tex, out_tex);

  using RType = gboolean;
  return RType();
}
gboolean GLFilter_Class::init_fbo_vfunc_callback(GstGLFilter* self)
{
  const auto obj_base = static_cast<Glib::ObjectBase*>(
      Glib::ObjectBase::_get_current_wrapper((GObject*)self));

  // Non-gtkmmproc-generated custom classes implicitly call the default
  // Glib::ObjectBase constructor, which sets is_derived_. But gtkmmproc-
  // generated classes can use this optimisation, which avoids the unnecessary
  // parameter conversions if there is no possibility of the virtual function
  // being overridden:
  if(obj_base && obj_base->is_derived_())
  {
    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        // Call the virtual member method, which derived classes might override.
        return static_cast<int>(obj->init_fbo_vfunc());
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
    }
  }

  BaseClassType *const base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(self)) // Get the parent class of the object class (The original underlying C class).
  );

  // Call the original underlying C function:
  if(base && base->init_fbo)
    return (*base->init_fbo)(self);

  return static_cast<int>(true);
}


Glib::ObjectBase* GLFilter_Class::wrap_new(GObject* object)
{
  return new GLFilter((GstGLFilter*)object);
}


/* The implementation: */

GstGLFilter* GLFilter::gobj_copy()
{
  reference();
  return gobj();
}

GLFilter::GLFilter(const Glib::ConstructParams& construct_params)
:
  GLBaseFilter(construct_params)
{

}

GLFilter::GLFilter(GstGLFilter* castitem)
:
  GLBaseFilter((GstGLBaseFilter*)(castitem))
{}


GLFilter::GLFilter(GLFilter&& src) noexcept
: GLBaseFilter(std::move(src))
{}

GLFilter& GLFilter::operator=(GLFilter&& src) noexcept
{
  GLBaseFilter::operator=(std::move(src));
  return *this;
}


GLFilter::~GLFilter() noexcept
{}


GLFilter::CppClassType GLFilter::glfilter_class_; // initialize static member

GType GLFilter::get_type()
{
  return glfilter_class_.init().get_type();
}


GType GLFilter::get_base_type()
{
  return gst_gl_filter_get_type();
}


Gst::VideoInfo GLFilter::get_in_info() const
{
  return Gst::VideoInfo(Gst::VideoInfo(const_cast<GstVideoInfo*>(&gobj()->in_info), false));
}

void GLFilter::set_in_info(const Gst::VideoInfo& value)
{
  gobj()->in_info = *(value.gobj());
}

Glib::RefPtr<Gst::Caps> GLFilter::get_out_caps() const
{
  return Glib::wrap(gobj()->out_caps);
}

void GLFilter::set_out_caps(const Glib::RefPtr<Gst::Caps>& value)
{
  gobj()->out_caps = Glib::unwrap(value);
}

GLuint GLFilter::get_fbo() const
{
  return gobj()->fbo;
}

void GLFilter::set_fbo(const GLuint& value)
{
  gobj()->fbo = value;
}

GLuint GLFilter::get_depthbuffer() const
{
  return gobj()->depthbuffer;
}

void GLFilter::set_depthbuffer(const GLuint& value)
{
  gobj()->depthbuffer = value;
}

GLuint GLFilter::get_vao() const
{
  return gobj()->vao;
}

void GLFilter::set_vao(const GLuint& value)
{
  gobj()->vao = value;
}

GLuint GLFilter::get_vbo_indices() const
{
  return gobj()->vbo_indices;
}

void GLFilter::set_vbo_indices(const GLuint& value)
{
  gobj()->vbo_indices = value;
}

GLuint GLFilter::get_vertex_buffer() const
{
  return gobj()->vertex_buffer;
}

void GLFilter::set_vertex_buffer(const GLuint& value)
{
  gobj()->vertex_buffer = value;
}

GLint GLFilter::get_draw_attr_position_loc() const
{
  return gobj()->draw_attr_position_loc;
}

void GLFilter::set_draw_attr_position_loc(const GLint& value)
{
  gobj()->draw_attr_position_loc = value;
}

GLint GLFilter::get_draw_attr_texture_loc() const
{
  return gobj()->draw_attr_texture_loc;
}

void GLFilter::set_draw_attr_texture_loc(const GLint& value)
{
  gobj()->draw_attr_texture_loc = value;
}


bool Gst::Bad::GLFilter::filter_vfunc(const Glib::RefPtr<Gst::Buffer>& inbuf, const Glib::RefPtr<Gst::Buffer>& outbuf) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->filter)
  {
    bool retval((*base->filter)(gobj(),Glib::unwrap(inbuf),Glib::unwrap(outbuf)));
    return retval;
  }

  using RType = bool;
  return RType();
}
bool Gst::Bad::GLFilter::filter_texture_vfunc(guint in_tex, guint out_tex) 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->filter_texture)
  {
    bool retval((*base->filter_texture)(gobj(),in_tex,out_tex));
    return retval;
  }

  using RType = bool;
  return RType();
}
bool Gst::Bad::GLFilter::init_fbo_vfunc() 
{
  const auto base = static_cast<BaseClassType*>(
      g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject_)) // Get the parent class of the object class (The original underlying C class).
  );

  if(base && base->init_fbo)
  {
    bool retval((*base->init_fbo)(gobj()));
    return retval;
  }

  return true;
}


} // namespace Bad

} // namespace Gst


