/* 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 <gst/audio/gstaudiobasesrc.h>
#include <gstreamermm/pushsrc.h>

_PINCLUDE(gstreamermm/private/pushsrc_p.h)

_DEFS(gstreamermm,gst)

namespace Gst
{

class AudioRingBuffer;

_WRAP_ENUM(AudioBaseSrcSlaveMethod, GstAudioBaseSrcSlaveMethod)

/** The base class for audio sources.
 * This is the base class for audio sources. Subclasses need to implement the
 * create_ringbuffer_vfunc vmethod. This base class will then take care of
 * reading samples from the audioringbuffer, synchronisation and flushing.
 *
 * Last reviewed on 2016-04-23 (1.8.0).
 *
 * @ingroup GstBaseClasses
 */
class AudioBaseSrc : public Gst::PushSrc
{
  _CLASS_GOBJECT(AudioBaseSrc, GstAudioBaseSrc, GST_AUDIO_BASE_SRC, Gst::PushSrc, GstPushSrc)

public:
  /** Get the Gst::Clock of the Gst::AudioSrc.
   */
  _MEMBER_GET_GOBJECT(clock, clock, Gst::Clock, GstClock*)

  _WRAP_METHOD(Glib::RefPtr<Gst::AudioRingBuffer> create_ring_buffer(), gst_audio_base_src_create_ringbuffer)

  _WRAP_METHOD(void set_provide_clock(bool provide), gst_audio_base_src_set_provide_clock)
  _WRAP_METHOD(bool get_provide_clock() const, gst_audio_base_src_get_provide_clock)
  _WRAP_METHOD(void set_slave_method(Gst::AudioBaseSrcSlaveMethod method), gst_audio_base_src_set_slave_method)
  _WRAP_METHOD(Gst::AudioBaseSrcSlaveMethod get_slave_method() const, gst_audio_base_src_get_slave_method)

  _WRAP_PROPERTY("actual-buffer-time", gint64)
  _WRAP_PROPERTY("actual-latency-time", gint64)
  _WRAP_PROPERTY("buffer-time", gint64)
  _WRAP_PROPERTY("latency-time", gint64)
  _WRAP_PROPERTY("provide-clock", bool)

  _WRAP_PROPERTY("slave-method", AudioBaseSrcSlaveMethod)

  /** vfunc to create and return a Gst::AudioRingBuffer to read from.
   */
  _WRAP_VFUNC(Glib::RefPtr<Gst::AudioRingBuffer> create_ring_buffer(), "create_ringbuffer")
};

} // namespace Gst
