/* 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/gsturi.h>
#include <glibmm/interface.h>
#include <gstreamermm/enums.h>

_DEFS(gstreamermm,gst)

namespace Gst
{

enum URIType
{
  URI_UNKNOWN = GST_URI_UNKNOWN,
  URI_SINK = GST_URI_SINK,
  URI_SRC = GST_URI_SRC 
};

class Element;

/** Gst::URIHandler - An interface to ease URI handling in plugins.
 * The Gst::URIHandler is an interface that is implemented by Source and Sink
 * Gst::Element to simplify then handling of URI.
 *
 * An application can use the following functions to quickly get an element
 * that handles the given URI for reading or writing (make_element_from_uri()).
 *
 * Source and Sink plugins should implement this interface when possible.
 *
 * Last reviewed on 2005-11-09 (0.9.4)
 * @ingroup GstInterfaces
 */
class URIHandler : public Glib::Interface
{
  _CLASS_INTERFACE(URIHandler, GstURIHandler, GST_URI_HANDLER, GstURIHandlerInterface)

public:
  _WRAP_METHOD(static bool protocol_is_valid(const Glib::ustring& protocol), gst_uri_protocol_is_valid)
  _WRAP_METHOD(static bool protocol_is_supported(const URIType type, const Glib::ustring& protocol), gst_uri_protocol_is_supported)
  _WRAP_METHOD(static bool uri_is_valid(const Glib::ustring& uri), gst_uri_is_valid)
  _WRAP_METHOD(static bool uri_has_protocol(const Glib::ustring& uri, const Glib::ustring& protocol), gst_uri_has_protocol)
  _WRAP_METHOD(static Glib::ustring get_protocol(const Glib::ustring& uri), gst_uri_get_protocol)
  _WRAP_METHOD(static Glib::ustring get_location(const Glib::ustring& uri), gst_uri_get_location)
  _WRAP_METHOD(static Glib::ustring construct_uri(const Glib::ustring& protocol, const Glib::ustring& location), gst_uri_construct)
  _WRAP_METHOD(static Glib::RefPtr<Gst::Element> make_element_from_uri(const URIType type, const Glib::ustring& uri, const Glib::ustring& name), gst_element_make_from_uri)

  _WRAP_METHOD(guint get_uri_type() const, gst_uri_handler_get_uri_type)

#m4 _CONVERSION(`gchar**',`Glib::StringArrayHandle',`Glib::StringArrayHandle($3, Glib::OWNERSHIP_SHALLOW)')
  _WRAP_METHOD(Glib::StringArrayHandle get_protocols() const, gst_uri_handler_get_protocols)

  _WRAP_METHOD(Glib::ustring get_uri() const, gst_uri_handler_get_uri)
  _WRAP_METHOD(bool set_uri(const Glib::ustring& uri), gst_uri_handler_set_uri)
  _WRAP_METHOD(void new_uri(const Glib::ustring& uri), gst_uri_handler_new_uri)

  /** This signal is emitted when the URI of the uri handler has changed.
   */
  _WRAP_SIGNAL(void new_uri(const Glib::ustring& uri), "new-uri")

  //TODO: Wrap vfuncs.
};

} // namespace Gst
