// Generated by gmmproc 2.42.0 -- DO NOT MODIFY!


#include <glibmm.h>

#include <gstreamermm/typefind.h>
#include <gstreamermm/private/typefind_p.h>

#include <cstring> // std::memset()

/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2009 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/gst.h>
#include <gstreamermm/caps.h>
#include <gstreamermm/plugin.h>

namespace
{

extern "C"
{

static void TypeFind_Find_gstreamermm_callback(GstTypeFind*, void* data)
{
  Gst::TypeFind::SlotFind& slot_find = *static_cast<Gst::TypeFind::SlotFind*>(data);

  try
  {
    slot_find();
  }
  catch (...)
  {
    Glib::exception_handlers_invoke();
  }
}

static void TypeFind_Find_gstreamermm_callback_destroy(void* data)
{
  delete static_cast<Gst::TypeFind::SlotFind*>(data);
}

} // extern "C"

} // anonymous namespace

namespace Gst
{

bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
  const Glib::ustring& name, guint rank, const SlotFind& find_slot,
  const Glib::StringArrayHandle& extensions,
  const Glib::RefPtr<const Gst::Caps>& caps)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback,
    (gchar*)extensions.data(), const_cast<GstCaps*>(Glib::unwrap(caps)), slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
  const Glib::ustring& name, guint rank, const SlotFind& find_slot,
  const Glib::RefPtr<const Gst::Caps>& caps)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback, 0, const_cast<GstCaps*>(Glib::unwrap(caps)), slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
  const Glib::ustring& name, guint rank, const SlotFind& find_slot,
  const Glib::StringArrayHandle& extensions)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback,
    (gchar*)extensions.data(), 0, slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::RefPtr<Gst::Plugin>& plugin,
  const Glib::ustring& name, guint rank, const SlotFind& find_slot)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(Glib::unwrap(plugin), name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback, 0, 0, slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
  const SlotFind& find_slot, const Glib::StringArrayHandle& extensions,
  const Glib::RefPtr<const Gst::Caps>& caps)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(0, name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback,
    (gchar*)extensions.data(), const_cast<GstCaps*>(Glib::unwrap(caps)), slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
  const SlotFind& find_slot, const Glib::RefPtr<const Gst::Caps>& caps)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(0, name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback, 0, const_cast<GstCaps*>(Glib::unwrap(caps)), slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
  const SlotFind& find_slot, const Glib::StringArrayHandle& extensions)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(0, name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback,
    (gchar*)extensions.data(), 0, slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

bool TypeFind::register_slot(const Glib::ustring& name, guint rank,
  const SlotFind& find_slot)
{
  SlotFind* slot_copy = new SlotFind(find_slot);
  return gst_type_find_register(0, name.c_str(), rank,
    &TypeFind_Find_gstreamermm_callback, 0, 0, slot_copy,
    &TypeFind_Find_gstreamermm_callback_destroy);
}

} // namespace Gst

namespace
{
} // anonymous namespace

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


namespace Glib
{

Gst::TypeFind& wrap(GstTypeFind* object)
{
  return *reinterpret_cast<Gst::TypeFind*>(object);
}

const Gst::TypeFind& wrap(const GstTypeFind* object)
{
  return *reinterpret_cast<const Gst::TypeFind*>(object);
}

} // namespace Glib


namespace Gst
{


// static
GType TypeFind::get_type()
{
  return gst_type_find_get_type();
}

TypeFind::TypeFind()
{
  std::memset(&gobject_, 0, sizeof(GstTypeFind));
}

TypeFind::TypeFind(const GstTypeFind* gobject)
{
  if(gobject)
    gobject_ = *gobject;
  else
    std::memset(&gobject_, 0, sizeof(GstTypeFind));
}


std::vector<guint8> TypeFind::peek(gint64 offset, guint size) const
{
  return Glib::ArrayHandler<guint8>::array_to_vector(gst_type_find_peek(const_cast<GstTypeFind*>(gobj()), offset, size), Glib::OWNERSHIP_NONE);
}

void TypeFind::suggest(guint probability, const Glib::RefPtr<const Gst::Caps>& caps) const
{
  gst_type_find_suggest(const_cast<GstTypeFind*>(gobj()), probability, const_cast<GstCaps*>(Glib::unwrap(caps)));
}

guint64 TypeFind::get_length() const
{
  return gst_type_find_get_length(const_cast<GstTypeFind*>(gobj()));
}


} // namespace Gst


