// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gstreamermm/basetransform.h>
#include <gstreamermm/private/basetransform_p.h>

/* 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 <gstreamermm/pad.h>
#include <gstreamermm/caps.h>
#include <gstreamermm/buffer.h>


namespace Gst
{

const Glib::ustring BaseTransform::SINK_NAME = GST_BASE_TRANSFORM_SINK_NAME;
const Glib::ustring BaseTransform::SRC_NAME = GST_BASE_TRANSFORM_SRC_NAME;

void BaseTransform::lock()
{
  GST_BASE_TRANSFORM_LOCK(gobj());
}

void BaseTransform::unlock()
{
  GST_BASE_TRANSFORM_UNLOCK(gobj());
}

#ifdef GLIBMM_VFUNCS_ENABLED
GstFlowReturn BaseTransform_Class::prepare_output_buffer_vfunc_callback(GstBaseTransform* self, GstBuffer* input, gint size, GstCaps* caps, GstBuffer** buffer)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        Glib::RefPtr<Gst::Buffer> cpp_buffer;
        // Call the virtual member method, which derived classes might override.
        const GstFlowReturn result =
          static_cast<GstFlowReturn>(obj->prepare_output_buffer_vfunc(
          Gst::wrap(input, true), size , Glib::wrap(caps, true), cpp_buffer));
        *buffer = cpp_buffer->gobj_copy();
        return result;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->prepare_output_buffer)
    return (*base->prepare_output_buffer)(self, input, size, caps, buffer);


  typedef GstFlowReturn RType;
  return RType();
}
FlowReturn Gst::BaseTransform::prepare_output_buffer_vfunc(const Glib::RefPtr<Gst::Buffer>& input, int size, const Glib::RefPtr<Gst::Caps>& caps, Glib::RefPtr<Gst::Buffer>& buffer)
{
  BaseClassType *const 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->prepare_output_buffer)
  {
    GstBuffer* gst_buffer;
    const Gst::FlowReturn result =
      static_cast<Gst::FlowReturn>((*base->prepare_output_buffer)(gobj(),
      Glib::unwrap(input), size, Glib::unwrap(caps), &gst_buffer));
    buffer = Gst::wrap(gst_buffer, false); // Don't take copy because callback returns a newly created copy.
    return result;
  }

  typedef FlowReturn RType;
  return RType();
}
#endif //GLIBMM_VFUNCS_ENABLED

} //namespace Gst

namespace
{
} // anonymous namespace


namespace Glib
{

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

} /* namespace Glib */


namespace Gst
{


/* The *_Class implementation: */

const Glib::Class& BaseTransform_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_ = &BaseTransform_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_base_transform_get_type());

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

  }

  return *this;
}


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

#ifdef GLIBMM_VFUNCS_ENABLED
  klass->transform_caps = &transform_caps_vfunc_callback;
  klass->fixate_caps = &fixate_caps_vfunc_callback;
  klass->transform = &transform_vfunc_callback;
  klass->transform_ip = &transform_ip_vfunc_callback;
  klass->before_transform = &before_transform_vfunc_callback;
  klass->prepare_output_buffer = &prepare_output_buffer_vfunc_callback;
  #endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
}

#ifdef GLIBMM_VFUNCS_ENABLED
GstCaps* BaseTransform_Class::transform_caps_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return Glib::unwrap(obj->transform_caps_vfunc(((PadDirection)(direction))
, Glib::wrap(caps, true)
));
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->transform_caps)
    return (*base->transform_caps)(self, direction, caps);


  typedef GstCaps* RType;
  return RType();
}
void BaseTransform_Class::fixate_caps_vfunc_callback(GstBaseTransform* self, GstPadDirection direction, GstCaps* caps, GstCaps* othercaps)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->fixate_caps_vfunc(((PadDirection)(direction))
, Glib::wrap(caps, true)
, Glib::wrap(othercaps, true)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->fixate_caps)
    (*base->fixate_caps)(self, direction, caps, othercaps);

}
GstFlowReturn BaseTransform_Class::transform_vfunc_callback(GstBaseTransform* self, GstBuffer* inbuf, GstBuffer* outbuf)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return ((GstFlowReturn)(obj->transform_vfunc(Gst::wrap(inbuf, true)
, Gst::wrap(outbuf, true)
)));
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->transform)
    return (*base->transform)(self, inbuf, outbuf);


  typedef GstFlowReturn RType;
  return RType();
}
GstFlowReturn BaseTransform_Class::transform_ip_vfunc_callback(GstBaseTransform* self, GstBuffer* buf)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        return ((GstFlowReturn)(obj->transform_ip_vfunc(Gst::wrap(buf, true)
)));
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->transform_ip)
    return (*base->transform_ip)(self, buf);


  typedef GstFlowReturn RType;
  return RType();
}
void BaseTransform_Class::before_transform_vfunc_callback(GstBaseTransform* self, GstBuffer* buffer)
{
  Glib::ObjectBase *const 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_())
  {
    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
    if(obj) // This can be NULL during destruction.
    {
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
      #endif //GLIBMM_EXCEPTIONS_ENABLED
        // Call the virtual member method, which derived classes might override.
        obj->before_transform_vfunc(Gst::wrap(buffer, true)
);
        return;
      #ifdef GLIBMM_EXCEPTIONS_ENABLED
      }
      catch(...)
      {
        Glib::exception_handlers_invoke();
      }
      #endif //GLIBMM_EXCEPTIONS_ENABLED
    }
  }
  
  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->before_transform)
    (*base->before_transform)(self, buffer);

}
#endif //GLIBMM_VFUNCS_ENABLED

#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED


Glib::ObjectBase* BaseTransform_Class::wrap_new(GObject* object)
{
  return new BaseTransform((GstBaseTransform*)object);
}


/* The implementation: */

GstBaseTransform* BaseTransform::gobj_copy()
{
  reference();
  return gobj();
}

BaseTransform::BaseTransform(const Glib::ConstructParams& construct_params)
:
  Element(construct_params)
{

}

BaseTransform::BaseTransform(GstBaseTransform* castitem)
:
  Element((GstElement*)(castitem))
{}


BaseTransform::~BaseTransform()
{}


BaseTransform::CppClassType BaseTransform::basetransform_class_; // initialize static member

GType BaseTransform::get_type()
{
  return basetransform_class_.init().get_type();
}


GType BaseTransform::get_base_type()
{
  return gst_base_transform_get_type();
}


bool BaseTransform::is_passthrough() const
{
  return gst_base_transform_is_passthrough(const_cast<GstBaseTransform*>(gobj()));
}

void BaseTransform::set_passthrough(bool passthrough)
{
gst_base_transform_set_passthrough(gobj(), static_cast<int>(passthrough)); 
}

bool BaseTransform::is_in_place() const
{
  return gst_base_transform_is_in_place(const_cast<GstBaseTransform*>(gobj()));
}

void BaseTransform::set_in_place(bool in_place)
{
gst_base_transform_set_in_place(gobj(), static_cast<int>(in_place)); 
}

bool BaseTransform::is_qos_enabled() const
{
  return gst_base_transform_is_qos_enabled(const_cast<GstBaseTransform*>(gobj()));
}

void BaseTransform::set_qos_enabled(bool enabled)
{
gst_base_transform_set_qos_enabled(gobj(), static_cast<int>(enabled)); 
}

void BaseTransform::update_qos(double proportion, ClockTimeDiff diff, ClockTime timestamp)
{
gst_base_transform_update_qos(gobj(), proportion, GstClockTimeDiff(diff), ((GstClockTime)(timestamp))); 
}

void BaseTransform::set_gap_aware(bool gap_aware)
{
gst_base_transform_set_gap_aware(gobj(), static_cast<int>(gap_aware)); 
}

void BaseTransform::suggest(const Glib::RefPtr<Gst::Caps>& caps, guint size)
{
gst_base_transform_suggest(gobj(), Glib::unwrap(caps), size); 
}

void BaseTransform::reconfigure()
{
gst_base_transform_reconfigure(gobj()); 
}

 Glib::RefPtr<Gst::Pad> BaseTransform::get_sink_pad()
{
  Glib::RefPtr<Gst::Pad> ref_ptr(Glib::wrap(gobj()->sinkpad));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

Glib::RefPtr<const Gst::Pad> BaseTransform::get_sink_pad() const
{
  Glib::RefPtr<const Gst::Pad> ref_ptr(Glib::wrap(gobj()->sinkpad));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}
 
 Glib::RefPtr<Gst::Pad> BaseTransform::get_src_pad()
{
  Glib::RefPtr<Gst::Pad> ref_ptr(Glib::wrap(gobj()->srcpad));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

Glib::RefPtr<const Gst::Pad> BaseTransform::get_src_pad() const
{
  Glib::RefPtr<const Gst::Pad> ref_ptr(Glib::wrap(gobj()->srcpad));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}
 

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> BaseTransform::property_qos() 
{
  return Glib::PropertyProxy<bool>(this, "qos");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> BaseTransform::property_qos() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "qos");
}
#endif //GLIBMM_PROPERTIES_ENABLED


#ifdef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
#endif //GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED

#ifdef GLIBMM_VFUNCS_ENABLED
Glib::RefPtr<Gst::Caps> Gst::BaseTransform::transform_caps_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps) 
{
  BaseClassType *const 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->transform_caps)
    return Glib::wrap((*base->transform_caps)(gobj(),((GstPadDirection)(direction)),Glib::unwrap(caps)));

  typedef Glib::RefPtr<Gst::Caps> RType;
  return RType();
}
void Gst::BaseTransform::fixate_caps_vfunc(PadDirection direction, const Glib::RefPtr<Gst::Caps>& caps, const Glib::RefPtr<Gst::Caps>& othercaps) 
{
  BaseClassType *const 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->fixate_caps)
    (*base->fixate_caps)(gobj(),((GstPadDirection)(direction)),Glib::unwrap(caps),Glib::unwrap(othercaps));
}
FlowReturn Gst::BaseTransform::transform_vfunc(const Glib::RefPtr<Gst::Buffer>& inbuf, const Glib::RefPtr<Gst::Buffer>& outbuf) 
{
  BaseClassType *const 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->transform)
    return ((FlowReturn)((*base->transform)(gobj(),Gst::unwrap(inbuf),Gst::unwrap(outbuf))));

  typedef FlowReturn RType;
  return RType();
}
FlowReturn Gst::BaseTransform::transform_ip_vfunc(const Glib::RefPtr<Gst::Buffer>& buf) 
{
  BaseClassType *const 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->transform_ip)
    return ((FlowReturn)((*base->transform_ip)(gobj(),Gst::unwrap(buf))));

  typedef FlowReturn RType;
  return RType();
}
void Gst::BaseTransform::before_transform_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer) 
{
  BaseClassType *const 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->before_transform)
    (*base->before_transform)(gobj(),Gst::unwrap(buffer));
}
#endif //GLIBMM_VFUNCS_ENABLED


} // namespace Gst


