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

_DEFS(gstreamermm,gst)

namespace Gst
{

class RingBuffer;

_WRAP_ENUM(BaseAudioSinkSlaveMethod, GstBaseAudioSinkSlaveMethod)

/** The base class for audio sinks.
 * This is the base class for audio sinks. Subclasses need to implement the
 * create_ringbuffer_vfunc vmethod. This base class will then take care of
 * writing samples to the ringbuffer, synchronisation, clipping and flushing.
 *
 * Last reviewed on 2006-09-27 (0.10.12).
 *
 * @ingroup GstBaseClasses
 */
class BaseAudioSink : public Gst::BaseSink
{
  _CLASS_GOBJECT(BaseAudioSink, GstBaseAudioSink, GST_BASE_AUDIO_SINK, Gst::BaseSink, GstBaseSink)

public:
  /** Get the Gst::Clock of the Gst::BaseAudioSink.
   */
  _MEMBER_GET_GOBJECT(provided_clock, provided_clock, Gst::Clock, GstClock*)

  _WRAP_METHOD(Glib::RefPtr<Gst::RingBuffer> create_ring_buffer(), gst_base_audio_sink_create_ringbuffer)
  _WRAP_METHOD(void set_provide_clock(bool provide), gst_base_audio_sink_set_provide_clock)
  _WRAP_METHOD(bool get_provide_clock() const, gst_base_audio_sink_get_provide_clock)

  _WRAP_METHOD(void set_slave_method(Gst::BaseAudioSinkSlaveMethod method), gst_base_audio_sink_set_slave_method)
  _WRAP_METHOD(Gst::BaseAudioSinkSlaveMethod get_slave_method() const, gst_base_audio_sink_get_slave_method)

  _WRAP_METHOD(gint64 get_drift_tolerance() const, gst_base_audio_sink_get_drift_tolerance)
  _WRAP_METHOD(void set_drift_tolerance(gint64 drift_tolerance), gst_base_audio_sink_set_drift_tolerance)

  _WRAP_PROPERTY("alignment-threshold", guint64)
  _WRAP_PROPERTY("buffer-time", gint64)
  _WRAP_PROPERTY("can-activate-pull", bool)
  _WRAP_PROPERTY("discont-wait", guint64)
  _WRAP_PROPERTY("drift-tolerance", gint64)
  _WRAP_PROPERTY("latency-time", gint64)
  _WRAP_PROPERTY("provide-clock", bool)
  _WRAP_PROPERTY("slave-method", Gst::BaseAudioSinkSlaveMethod)

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

} // namespace Gst
