/* 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/interfaces/propertyprobe.h>
#include <glibmm/valuearray.h>
#include <glibmm/interface.h>

_DEFS(gstreamermm,gst)

namespace Gst
{

/** An interface for probing possible property values.
 * The property probe is a way to autodetect allowed values for a GObject
 * property. Its primary use is to autodetect device-names in several
 * elements.
 *
 * The interface is implemented by many hardware sources and sinks.
 * @ingroup GstInterfaces
 */
class PropertyProbe : public Glib::Interface
{
  _CLASS_INTERFACE(PropertyProbe, GstPropertyProbe, GST_PROPERTY_PROBE, GstPropertyProbeInterface)

public:
  //TODO: Use something other than const GList* as return (A Glib::ListHandle<>
  //is not used because it's hard to know how to place GParamSpec* in one):
  _WRAP_METHOD(const GList* get_properties() const, gst_property_probe_get_properties)

  _WRAP_METHOD(const GParamSpec* get_property(const Glib::ustring& name) const, gst_property_probe_get_property)

#m4 _CONVERSION(`GValueArray*', `Glib::ValueArray', `Glib::wrap($3)')
  _WRAP_METHOD(Glib::ValueArray get_values(const GParamSpec* pspec) const, gst_property_probe_get_values)
  _WRAP_METHOD(Glib::ValueArray get_values(const Glib::ustring& name) const, gst_property_probe_get_values_name)

  _WRAP_METHOD(bool needs_probe(const GParamSpec* pspec) const, gst_property_probe_needs_probe)
  _WRAP_METHOD(bool needs_probe(const Glib::ustring& name) const, gst_property_probe_needs_probe_name)
  _WRAP_METHOD(Glib::ValueArray probe_and_get_values(const GParamSpec* pspec), gst_property_probe_probe_and_get_values)
  _WRAP_METHOD(Glib::ValueArray probe_and_get_values(const Glib::ustring& name), gst_property_probe_probe_and_get_values_name)
  _WRAP_METHOD(void probe_property(const GParamSpec *pspec), gst_property_probe_probe_property)
  _WRAP_METHOD(void probe_property(const Glib::ustring& name), gst_property_probe_probe_property_name)

  _WRAP_SIGNAL(void probe_needed(const GParamSpec* pspec), "probe_needed")

  _WRAP_VFUNC(const GList* get_properties() const, "get_properties")
  _WRAP_VFUNC(bool needs_probe(guint prop_id, const GParamSpec* pspec) const, "needs_probe")
  _WRAP_VFUNC(void probe_property(guint prop_id, const GParamSpec* pspec), "probe_property")

#m4 _CONVERSION(`Glib::ValueArray', `GValueArray*', `($3).gobj_copy()')
#m4 _CONVERSION(`GValueArray*', `Glib::ValueArray', `Glib::wrap($3)')
  _WRAP_VFUNC(Glib::ValueArray get_values(guint prop_id, const GParamSpec* pspec) const, "get_values")
};

} // namespace Gst
