// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gstreamermm/basesink.h>
#include <gstreamermm/private/basesink_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/bufferlist.h>


namespace Gst
{

bool BaseSink::query_latency(bool& live, bool& upstream_live, ClockTime& min_latency, ClockTime& max_latency) const
{
  gboolean gst_live = 0;
  gboolean gst_upstream_live = 0;

  const bool result =
    gst_base_sink_query_latency(const_cast<GstBaseSink*>(gobj()),
    &gst_live, &gst_upstream_live, static_cast<GstClockTime*>(&min_latency),
    static_cast<GstClockTime*>(&max_latency));

  live = gst_live;
  upstream_live = gst_upstream_live;

  return result;
}

ClockReturn BaseSink::wait_clock(ClockTime time)
{
  return static_cast<ClockReturn>(gst_base_sink_wait_clock(const_cast<GstBaseSink*>(gobj()), static_cast<GstClockTime>(time), 0));
}

FlowReturn BaseSink::wait_eos(ClockTime time)
{
  return static_cast<FlowReturn>(gst_base_sink_wait_eos(const_cast<GstBaseSink*>(gobj()), static_cast<GstClockTime>(time), 0));
}

GstFlowReturn BaseSink_Class::buffer_alloc_vfunc_callback(GstBaseSink* self, guint64 offset, guint size, GstCaps* caps, 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.
    {
      try // Trap C++ exceptions which would normally be lost because this is a C callback.
      {
        Glib::RefPtr<Gst::Buffer> cpp_buffer;
        // Call the virtual member method, which derived classes might override.
        const GstFlowReturn result =
          static_cast<GstFlowReturn>(obj->buffer_alloc_vfunc(offset, size,
          Glib::wrap(caps, true), cpp_buffer));
        *buf = cpp_buffer->gobj_copy();
        return result;
      }
      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->buffer_alloc)
    return (*base->buffer_alloc)(self, offset, size, caps, buf);


  typedef GstFlowReturn RType;
  return RType();
}
FlowReturn Gst::BaseSink::buffer_alloc_vfunc(guint64 offset, guint 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->buffer_alloc)
  {
    GstBuffer* gst_buffer;
    const Gst::FlowReturn result =
      static_cast<Gst::FlowReturn>((*base->buffer_alloc)(gobj(), offset,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();
}
gboolean BaseSink_Class::set_caps_vfunc_callback(GstBaseSink* self, 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 static_cast<int>(obj->set_caps_vfunc(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->set_caps)
    return (*base->set_caps)(self, caps);

  return true;
}
bool Gst::BaseSink::set_caps_vfunc(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->set_caps)
    return (*base->set_caps)(gobj(),Glib::unwrap(caps));

  return true;
}
gboolean BaseSink_Class::start_vfunc_callback(GstBaseSink* self)
{
  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 static_cast<int>(obj->start_vfunc());
      #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->start)
    return (*base->start)(self);

  return true;
}
bool Gst::BaseSink::start_vfunc() 
{
  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->start)
    return (*base->start)(gobj());

  return true;
}
gboolean BaseSink_Class::stop_vfunc_callback(GstBaseSink* self)
{
  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 static_cast<int>(obj->stop_vfunc());
      #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->stop)
    return (*base->stop)(self);

  return true;
}
bool Gst::BaseSink::stop_vfunc() 
{
  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->stop)
    return (*base->stop)(gobj());

  return true;
}
gboolean BaseSink_Class::unlock_vfunc_callback(GstBaseSink* self)
{
  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 static_cast<int>(obj->unlock_vfunc());
      #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->unlock)
    return (*base->unlock)(self);

  return true;
}
bool Gst::BaseSink::unlock_vfunc() 
{
  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->unlock)
    return (*base->unlock)(gobj());

  return true;
}
gboolean BaseSink_Class::event_vfunc_callback(GstBaseSink* self, GstEvent* event)
{
  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 static_cast<int>(obj->event_vfunc(Gst::wrap(event, 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->event)
    return (*base->event)(self, event);

  return true;
}
bool Gst::BaseSink::event_vfunc(const Glib::RefPtr<Gst::Event>& event) 
{
  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->event)
    return (*base->event)(gobj(),Gst::unwrap(event));

  return true;
}
gboolean BaseSink_Class::activate_pull_vfunc_callback(GstBaseSink* self, gboolean active)
{
  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 static_cast<int>(obj->activate_pull_vfunc(active
));
      #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->activate_pull)
    return (*base->activate_pull)(self, active);

  return true;
}
bool Gst::BaseSink::activate_pull_vfunc(bool active) 
{
  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->activate_pull)
    return (*base->activate_pull)(gobj(),static_cast<int>(active));

  return true;
}
gboolean BaseSink_Class::unlock_stop_vfunc_callback(GstBaseSink* self)
{
  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 static_cast<int>(obj->unlock_stop_vfunc());
      #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->unlock_stop)
    return (*base->unlock_stop)(self);

  return true;
}
bool Gst::BaseSink::unlock_stop_vfunc() 
{
  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->unlock_stop)
    return (*base->unlock_stop)(gobj());

  return true;
}

} // namespace Gst

namespace
{
} // anonymous namespace


namespace Glib
{

Glib::RefPtr<Gst::BaseSink> wrap(GstBaseSink* object, bool take_copy)
{
  return Glib::RefPtr<Gst::BaseSink>( dynamic_cast<Gst::BaseSink*> (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& BaseSink_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_ = &BaseSink_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_sink_get_type());

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

  }

  return *this;
}


void BaseSink_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);

  klass->get_caps = &get_caps_vfunc_callback;
  klass->get_times = &get_times_vfunc_callback;
  klass->preroll = &preroll_vfunc_callback;
  klass->render = &render_vfunc_callback;
  klass->async_play = &async_play_vfunc_callback;
  klass->fixate = &fixate_vfunc_callback;
  klass->render_list = &render_list_vfunc_callback;
  klass->buffer_alloc = &buffer_alloc_vfunc_callback;
  klass->set_caps = &set_caps_vfunc_callback;
  klass->start = &start_vfunc_callback;
  klass->stop = &stop_vfunc_callback;
  klass->unlock = &unlock_vfunc_callback;
  klass->event = &event_vfunc_callback;
  klass->activate_pull = &activate_pull_vfunc_callback;
  klass->unlock_stop = &unlock_stop_vfunc_callback;
  
}

GstCaps* BaseSink_Class::get_caps_vfunc_callback(GstBaseSink* self)
{
  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->get_caps_vfunc());
      #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->get_caps)
    return (*base->get_caps)(self);


  typedef GstCaps* RType;
  return RType();
}
void BaseSink_Class::get_times_vfunc_callback(GstBaseSink* self, GstBuffer* buffer, GstClockTime* start, GstClockTime* end)
{
  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->get_times_vfunc(Gst::wrap(buffer, true)
, *(start)
, *(end)
);
        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->get_times)
    (*base->get_times)(self, buffer, start, end);

}
GstFlowReturn BaseSink_Class::preroll_vfunc_callback(GstBaseSink* 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.
        return ((GstFlowReturn)(obj->preroll_vfunc(Gst::wrap(buffer, 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->preroll)
    return (*base->preroll)(self, buffer);


  typedef GstFlowReturn RType;
  return RType();
}
GstFlowReturn BaseSink_Class::render_vfunc_callback(GstBaseSink* 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.
        return ((GstFlowReturn)(obj->render_vfunc(Gst::wrap(buffer, 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->render)
    return (*base->render)(self, buffer);


  typedef GstFlowReturn RType;
  return RType();
}
GstStateChangeReturn BaseSink_Class::async_play_vfunc_callback(GstBaseSink* self)
{
  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 ((GstStateChangeReturn)(obj->async_play_vfunc()));
      #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->async_play)
    return (*base->async_play)(self);


  typedef GstStateChangeReturn RType;
  return RType();
}
void BaseSink_Class::fixate_vfunc_callback(GstBaseSink* self, 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.
        obj->fixate_vfunc(Glib::wrap(caps, 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)
    (*base->fixate)(self, caps);

}
GstFlowReturn BaseSink_Class::render_list_vfunc_callback(GstBaseSink* self, GstBufferList* buffer_list)
{
  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->render_list_vfunc(Gst::wrap(buffer_list, 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->render_list)
    return (*base->render_list)(self, buffer_list);


  typedef GstFlowReturn RType;
  return RType();
}


Glib::ObjectBase* BaseSink_Class::wrap_new(GObject* object)
{
  return new BaseSink((GstBaseSink*)object);
}


/* The implementation: */

GstBaseSink* BaseSink::gobj_copy()
{
  reference();
  return gobj();
}

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

}

BaseSink::BaseSink(GstBaseSink* castitem)
:
  Element((GstElement*)(castitem))
{}


BaseSink::~BaseSink()
{}


BaseSink::CppClassType BaseSink::basesink_class_; // initialize static member

GType BaseSink::get_type()
{
  return basesink_class_.init().get_type();
}


GType BaseSink::get_base_type()
{
  return gst_base_sink_get_type();
}


ClockTime BaseSink::get_latency() const
{
  return ((ClockTime)(gst_base_sink_get_latency(const_cast<GstBaseSink*>(gobj()))));
}

Gst::FlowReturn BaseSink::do_preroll(const Glib::RefPtr<Gst::MiniObject>& obj)
{
  return ((Gst::FlowReturn)(gst_base_sink_do_preroll(gobj(), Gst::unwrap(obj))));
}

FlowReturn BaseSink::wait_preroll()
{
  return ((FlowReturn)(gst_base_sink_wait_preroll(gobj())));
}

ClockReturn BaseSink::wait_clock(ClockTime time, ClockTimeDiff& jitter)
{
  return ((ClockReturn)(gst_base_sink_wait_clock(gobj(), ((GstClockTime)(time)), (GstClockTimeDiff*)(&jitter))));
}

FlowReturn BaseSink::wait_eos(ClockTime time, ClockTimeDiff& jitter)
{
  return ((FlowReturn)(gst_base_sink_wait_eos(gobj(), ((GstClockTime)(time)), (GstClockTimeDiff*)(&jitter))));
}

void BaseSink::set_sync(bool sync)
{
gst_base_sink_set_sync(gobj(), static_cast<int>(sync)); 
}

bool BaseSink::get_sync() const
{
  return gst_base_sink_get_sync(const_cast<GstBaseSink*>(gobj()));
}

void BaseSink::set_max_lateness(gint64 max_lateness)
{
gst_base_sink_set_max_lateness(gobj(), max_lateness); 
}

gint64 BaseSink::get_max_lateness() const
{
  return gst_base_sink_get_max_lateness(const_cast<GstBaseSink*>(gobj()));
}

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

bool BaseSink::is_qos_enabled() const
{
  return gst_base_sink_is_qos_enabled(const_cast<GstBaseSink*>(gobj()));
}

void BaseSink::set_async_enabled(bool enabled)
{
gst_base_sink_set_async_enabled(gobj(), static_cast<int>(enabled)); 
}

bool BaseSink::is_async_enabled() const
{
  return gst_base_sink_is_async_enabled(const_cast<GstBaseSink*>(gobj()));
}

void BaseSink::set_ts_offset(ClockTimeDiff offset)
{
gst_base_sink_set_ts_offset(gobj(), GstClockTimeDiff(offset)); 
}

ClockTimeDiff BaseSink::get_ts_offset() const
{
  return ClockTimeDiff(gst_base_sink_get_ts_offset(const_cast<GstBaseSink*>(gobj())));
}

void BaseSink::set_render_delay(ClockTime delay)
{
gst_base_sink_set_render_delay(gobj(), ((GstClockTime)(delay))); 
}

ClockTime BaseSink::get_render_delay() const
{
  return ((ClockTime)(gst_base_sink_get_render_delay(const_cast<GstBaseSink*>(gobj()))));
}

Glib::RefPtr<Gst::Buffer> BaseSink::get_last_buffer()
{
  return Gst::wrap(gst_base_sink_get_last_buffer(gobj()));
}

Glib::RefPtr<const Gst::Buffer> BaseSink::get_last_buffer() const
{
  return const_cast<BaseSink*>(this)->get_last_buffer();
}

void BaseSink::set_blocksize(guint blocksize)
{
gst_base_sink_set_blocksize(gobj(), blocksize); 
}

guint BaseSink::get_blocksize() const
{
  return gst_base_sink_get_blocksize(const_cast<GstBaseSink*>(gobj()));
}

 Glib::RefPtr<Gst::Pad> BaseSink::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> BaseSink::get_sink_pad() const
{
  Glib::RefPtr<const Gst::Pad> ref_ptr(Glib::wrap(gobj()->sinkpad));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}
 

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> BaseSink::property_async() 
{
  return Glib::PropertyProxy<bool>(this, "async");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> BaseSink::property_async() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "async");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Buffer> > BaseSink::property_last_buffer() const
{
  return Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gst::Buffer> >(this, "last-buffer");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<gint64> BaseSink::property_max_lateness() 
{
  return Glib::PropertyProxy<gint64>(this, "max-lateness");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<gint64> BaseSink::property_max_lateness() const
{
  return Glib::PropertyProxy_ReadOnly<gint64>(this, "max-lateness");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<guint> BaseSink::property_preroll_queue_len() 
{
  return Glib::PropertyProxy<guint>(this, "preroll-queue-len");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<guint> BaseSink::property_preroll_queue_len() const
{
  return Glib::PropertyProxy_ReadOnly<guint>(this, "preroll-queue-len");
}
#endif //GLIBMM_PROPERTIES_ENABLED

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

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

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> BaseSink::property_sync() 
{
  return Glib::PropertyProxy<bool>(this, "sync");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> BaseSink::property_sync() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "sync");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<gint64> BaseSink::property_ts_offset() 
{
  return Glib::PropertyProxy<gint64>(this, "ts-offset");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<gint64> BaseSink::property_ts_offset() const
{
  return Glib::PropertyProxy_ReadOnly<gint64>(this, "ts-offset");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy<bool> BaseSink::property_enable_last_buffer() 
{
  return Glib::PropertyProxy<bool>(this, "enable-last-buffer");
}
#endif //GLIBMM_PROPERTIES_ENABLED

#ifdef GLIBMM_PROPERTIES_ENABLED
Glib::PropertyProxy_ReadOnly<bool> BaseSink::property_enable_last_buffer() const
{
  return Glib::PropertyProxy_ReadOnly<bool>(this, "enable-last-buffer");
}
#endif //GLIBMM_PROPERTIES_ENABLED


Glib::RefPtr<Gst::Caps> Gst::BaseSink::get_caps_vfunc() const
{
  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->get_caps)
    return Glib::wrap((*base->get_caps)(const_cast<GstBaseSink*>(gobj())));

  typedef Glib::RefPtr<Gst::Caps> RType;
  return RType();
}
void Gst::BaseSink::get_times_vfunc(const Glib::RefPtr<Gst::Buffer>& buffer, ClockTime& start, ClockTime& end) const
{
  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->get_times)
    (*base->get_times)(const_cast<GstBaseSink*>(gobj()),Gst::unwrap(buffer),(GstClockTime*)(&start),(GstClockTime*)(&end));
}
FlowReturn Gst::BaseSink::preroll_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->preroll)
    return ((FlowReturn)((*base->preroll)(gobj(),Gst::unwrap(buffer))));

  typedef FlowReturn RType;
  return RType();
}
FlowReturn Gst::BaseSink::render_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->render)
    return ((FlowReturn)((*base->render)(gobj(),Gst::unwrap(buffer))));

  typedef FlowReturn RType;
  return RType();
}
StateChangeReturn Gst::BaseSink::async_play_vfunc() 
{
  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->async_play)
    return ((StateChangeReturn)((*base->async_play)(gobj())));

  typedef StateChangeReturn RType;
  return RType();
}
void Gst::BaseSink::fixate_vfunc(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->fixate)
    (*base->fixate)(gobj(),Glib::unwrap(caps));
}
FlowReturn Gst::BaseSink::render_list_vfunc(const Glib::RefPtr<Gst::BufferList>& buffer_list) 
{
  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->render_list)
    return ((FlowReturn)((*base->render_list)(gobj(),Glib::unwrap(buffer_list))));

  typedef FlowReturn RType;
  return RType();
}


} // namespace Gst


