// Generated by gtkmmproc -- DO NOT MODIFY!


#include <gstreamermm/format.h>
#include <gstreamermm/private/format_p.h>

/* 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/gstenumtypes.h>
#include <gstreamermm/iterator.h>

namespace Gst
{

FormatDefinition::FormatDefinition()
: value(Gst::FORMAT_UNDEFINED),
  quark(static_cast<GQuark>(0))
{}

FormatDefinition::FormatDefinition(const GstFormatDefinition* castitem)
: value(Gst::FORMAT_UNDEFINED),
  quark((castitem) ? castitem->quark : static_cast<GQuark>(0))
{
  if(castitem)
  {
    value = static_cast<Format>(castitem->value);
    nick = castitem->nick;
    description = castitem->description;
  }
}

namespace Enums
{

Glib::ustring get_name(Format f)
{
  return gst_format_get_name(static_cast<GstFormat>(f));
}

Glib::QueryQuark get_quark(Format f)
{
  return Glib::QueryQuark(gst_format_to_quark(static_cast<GstFormat>(f)));
}

} //namespace Enums

Format get_format(const Glib::ustring& nick)
{
  return static_cast<Format>(gst_format_get_by_nick(nick.c_str()));
}

Format register_format(const Glib::ustring& nick, const Glib::ustring&
description)
{
  return static_cast<Format>(gst_format_register(nick.c_str(), description.c_str()));
}

bool formats_contain(const Glib::ArrayHandle<Format>& formats, Format format)
{
  return gst_formats_contains(reinterpret_cast<const GstFormat*>((formats).data()), static_cast<GstFormat>(format));
}

bool get_format_details(Format format, FormatDefinition& def)
{
  const GstFormatDefinition* gstdef = gst_format_get_details(static_cast<GstFormat>(format));

  if(!gstdef)
    return false;

  def.value = Format(gstdef->value);
  def.nick = gstdef->nick;
  def.description = gstdef->description;
  def.quark = gstdef->quark;

  return true;
}

IteratorBasic<const FormatDefinition> iterate_format_definitions()
{
  return IteratorBasic<const FormatDefinition>(gst_format_iterate_definitions());
}

} //namespace Gst

namespace
{
} // anonymous namespace

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


namespace Gst
{


} // namespace Gst


