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


#include <glibmm.h>

#include <gstreamermm/audiobasesrc.h>
#include <gstreamermm/private/audiobasesrc_p.h>


/* 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 <gstreamermm/audioringbuffer.h>


namespace
{
} // anonymous namespace

// static
GType Glib::Value<Gst::AudioBaseSrcSlaveMethod>::value_type()
{
  return gst_audio_base_src_slave_method_get_type();
}


namespace Glib
{

Glib::RefPtr<Gst::AudioBaseSrc> wrap(GstAudioBaseSrc* object, bool take_copy)
{
  return Glib::RefPtr<Gst::AudioBaseSrc>( dynamic_cast<Gst::AudioBaseSrc*> (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& AudioBaseSrc_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_ = &AudioBaseSrc_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_audio_base_src_get_type());

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

  }

  return *this;
}


void AudioBaseSrc_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->create_ringbuffer = &create_ringbuffer_vfunc_callback;

}

GstAudioRingBuffer* AudioBaseSrc_Class::create_ringbuffer_vfunc_callback(GstAudioBaseSrc* 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 Glib::unwrap(obj->create_ring_buffer_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->create_ringbuffer)
    return (*base->create_ringbuffer)(self);

  using RType = GstAudioRingBuffer*;
  return RType();
}


Glib::ObjectBase* AudioBaseSrc_Class::wrap_new(GObject* object)
{
  return new AudioBaseSrc((GstAudioBaseSrc*)object);
}


/* The implementation: */

GstAudioBaseSrc* AudioBaseSrc::gobj_copy()
{
  reference();
  return gobj();
}

AudioBaseSrc::AudioBaseSrc(const Glib::ConstructParams& construct_params)
:
  Gst::PushSrc(construct_params)
{

}

AudioBaseSrc::AudioBaseSrc(GstAudioBaseSrc* castitem)
:
  Gst::PushSrc((GstPushSrc*)(castitem))
{}


AudioBaseSrc::AudioBaseSrc(AudioBaseSrc&& src) noexcept
: Gst::PushSrc(std::move(src))
{}

AudioBaseSrc& AudioBaseSrc::operator=(AudioBaseSrc&& src) noexcept
{
  Gst::PushSrc::operator=(std::move(src));
  return *this;
}


AudioBaseSrc::~AudioBaseSrc() noexcept
{}


AudioBaseSrc::CppClassType AudioBaseSrc::audiobasesrc_class_; // initialize static member

GType AudioBaseSrc::get_type()
{
  return audiobasesrc_class_.init().get_type();
}


GType AudioBaseSrc::get_base_type()
{
  return gst_audio_base_src_get_type();
}


Glib::RefPtr<Gst::Clock> AudioBaseSrc::get_clock()
{
  Glib::RefPtr<Gst::Clock> ref_ptr(Glib::wrap(gobj()->clock));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

Glib::RefPtr<const Gst::Clock> AudioBaseSrc::get_clock() const
{
  Glib::RefPtr<const Gst::Clock> ref_ptr(Glib::wrap(gobj()->clock));

  if(ref_ptr)
    ref_ptr->reference();

  return ref_ptr;
}

Glib::RefPtr<Gst::AudioRingBuffer> AudioBaseSrc::create_ring_buffer()
{
  return Glib::wrap(gst_audio_base_src_create_ringbuffer(gobj()));
}

void AudioBaseSrc::set_provide_clock(bool provide)
{
  gst_audio_base_src_set_provide_clock(gobj(), static_cast<int>(provide));
}

bool AudioBaseSrc::get_provide_clock() const
{
  return gst_audio_base_src_get_provide_clock(const_cast<GstAudioBaseSrc*>(gobj()));
}

void AudioBaseSrc::set_slave_method(Gst::AudioBaseSrcSlaveMethod method)
{
  gst_audio_base_src_set_slave_method(gobj(), ((GstAudioBaseSrcSlaveMethod)(method)));
}

Gst::AudioBaseSrcSlaveMethod AudioBaseSrc::get_slave_method() const
{
  return ((Gst::AudioBaseSrcSlaveMethod)(gst_audio_base_src_get_slave_method(const_cast<GstAudioBaseSrc*>(gobj()))));
}


Glib::PropertyProxy_ReadOnly< gint64 > AudioBaseSrc::property_actual_buffer_time() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "actual-buffer-time");
}

Glib::PropertyProxy_ReadOnly< gint64 > AudioBaseSrc::property_actual_latency_time() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "actual-latency-time");
}

Glib::PropertyProxy< gint64 > AudioBaseSrc::property_buffer_time() 
{
  return Glib::PropertyProxy< gint64 >(this, "buffer-time");
}

Glib::PropertyProxy_ReadOnly< gint64 > AudioBaseSrc::property_buffer_time() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "buffer-time");
}

Glib::PropertyProxy< gint64 > AudioBaseSrc::property_latency_time() 
{
  return Glib::PropertyProxy< gint64 >(this, "latency-time");
}

Glib::PropertyProxy_ReadOnly< gint64 > AudioBaseSrc::property_latency_time() const
{
  return Glib::PropertyProxy_ReadOnly< gint64 >(this, "latency-time");
}

Glib::PropertyProxy< bool > AudioBaseSrc::property_provide_clock() 
{
  return Glib::PropertyProxy< bool >(this, "provide-clock");
}

Glib::PropertyProxy_ReadOnly< bool > AudioBaseSrc::property_provide_clock() const
{
  return Glib::PropertyProxy_ReadOnly< bool >(this, "provide-clock");
}

Glib::PropertyProxy< AudioBaseSrcSlaveMethod > AudioBaseSrc::property_slave_method() 
{
  return Glib::PropertyProxy< AudioBaseSrcSlaveMethod >(this, "slave-method");
}

Glib::PropertyProxy_ReadOnly< AudioBaseSrcSlaveMethod > AudioBaseSrc::property_slave_method() const
{
  return Glib::PropertyProxy_ReadOnly< AudioBaseSrcSlaveMethod >(this, "slave-method");
}


Glib::RefPtr<Gst::AudioRingBuffer> Gst::AudioBaseSrc::create_ring_buffer_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->create_ringbuffer)
  {
    Glib::RefPtr<Gst::AudioRingBuffer> retval(Glib::wrap((*base->create_ringbuffer)(gobj())));
    return retval;
  }

  using RType = Glib::RefPtr<Gst::AudioRingBuffer>;
  return RType();
}


} // namespace Gst


