/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2011 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/pbutils/pbutils.h>
#include <gstreamermm/caps.h>
#include <gstreamermm/structure.h>
#include <gstreamermm/taglist.h>

_PINCLUDE(gstreamermm/private/miniobject_p.h)

namespace
{

extern "C"
{

static void DiscovererInfo_gstreamermm_callback_destroy(void* data,
  GstMiniObject* /* where_the_object_was */)
{
  delete static_cast<Gst::DiscovererInfo*>(data);
}

static void DiscovererStreamInfo_gstreamermm_callback_destroy(void* data,
  GstMiniObject* /* where_the_object_was */)
{
  delete static_cast<Gst::DiscovererStreamInfo*>(data);
}

static void DiscovererContainerInfo_gstreamermm_callback_destroy(void* data,
  GstMiniObject* /* where_the_object_was */)
{
  delete static_cast<Gst::DiscovererContainerInfo*>(data);
}

static void DiscovererAudioInfo_gstreamermm_callback_destroy(void* data,
  GstMiniObject* /* where_the_object_was */)
{
  delete static_cast<Gst::DiscovererAudioInfo*>(data);
}

static void DiscovererVideoInfo_gstreamermm_callback_destroy(void* data,
  GstMiniObject* /* where_the_object_was */)
{
  delete static_cast<Gst::DiscovererVideoInfo*>(data);
}

}

}

namespace Gst
{

Gst::MiniObject* DiscovererInfo_Class::wrap_new(GstMiniObject* object)
{
  // Use this wrap_new() method to ensure that the wrapper is destroyed
  // when the miniobject loses its last reference.

  Gst::DiscovererInfo* wrapper =
    new Gst::DiscovererInfo((GstDiscovererInfo*)(object));

  gst_mini_object_weak_ref(object,
    &DiscovererInfo_gstreamermm_callback_destroy, wrapper);

  return wrapper;
}

Gst::MiniObject* DiscovererStreamInfo_Class::wrap_new(GstMiniObject* object)
{
  // Use this wrap_new() method to ensure that the wrapper is destroyed
  // when the miniobject loses its last reference.

  Gst::DiscovererStreamInfo* wrapper =
    new Gst::DiscovererStreamInfo((GstDiscovererStreamInfo*)(object));

  gst_mini_object_weak_ref(object,
    &DiscovererStreamInfo_gstreamermm_callback_destroy, wrapper);

  return wrapper;
}

Gst::MiniObject* DiscovererContainerInfo_Class::wrap_new(GstMiniObject* object)
{
  // Use this wrap_new() method to ensure that the wrapper is destroyed
  // when the miniobject loses its last reference.

  Gst::DiscovererContainerInfo* wrapper =
    new Gst::DiscovererContainerInfo((GstDiscovererContainerInfo*)(object));

  gst_mini_object_weak_ref(object,
    &DiscovererContainerInfo_gstreamermm_callback_destroy, wrapper);

  return wrapper;
}

Gst::MiniObject* DiscovererAudioInfo_Class::wrap_new(GstMiniObject* object)
{
  // Use this wrap_new() method to ensure that the wrapper is destroyed
  // when the miniobject loses its last reference.

  Gst::DiscovererAudioInfo* wrapper =
    new Gst::DiscovererAudioInfo((GstDiscovererAudioInfo*)(object));

  gst_mini_object_weak_ref(object,
    &DiscovererAudioInfo_gstreamermm_callback_destroy, wrapper);

  return wrapper;
}

Gst::MiniObject* DiscovererVideoInfo_Class::wrap_new(GstMiniObject* object)
{
  // Use this wrap_new() method to ensure that the wrapper is destroyed
  // when the miniobject loses its last reference.

  Gst::DiscovererVideoInfo* wrapper =
    new Gst::DiscovererVideoInfo((GstDiscovererVideoInfo*)(object));

  gst_mini_object_weak_ref(object,
    &DiscovererVideoInfo_gstreamermm_callback_destroy, wrapper);

  return wrapper;
}

} // namespace Gst
