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


#include <glibmm.h>

#include <gstreamermm/segment.h>
#include <gstreamermm/private/segment_p.h>


/* gstreamermm - a C++ wrapper for gstreamer
 *
 * Copyright 2008-2016 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>

namespace Gst
{

void Segment::set_seek(double rate, Format format, SeekFlags flags,
  SeekType start_type, gint64 start, SeekType stop_type, gint64 stop,
  bool& update)
{
  gboolean gst_update = 0;

  gst_segment_do_seek(gobj(), rate, static_cast<GstFormat>(format),
    static_cast<GstSeekFlags>(flags), static_cast<GstSeekType>(start_type),
    start, static_cast<GstSeekType>(stop_type), stop, &gst_update); 

  update = gst_update;
}

} // namespace Gst

namespace
{
} // anonymous namespace

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

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


namespace Glib
{

Gst::Segment wrap(GstSegment* object, bool take_copy)
{
  return Gst::Segment(object, take_copy);
}

} // namespace Glib


namespace Gst
{


// static
GType Segment::get_type()
{
  return gst_segment_get_type();
}

Segment::Segment()
:
  gobject_ (gst_segment_new())
{}

Segment::Segment(const Segment& other)
:
  gobject_ ((other.gobject_) ? gst_segment_copy(other.gobject_) : nullptr)
{}

Segment::Segment(Segment&& other) noexcept
:
  gobject_(other.gobject_)
{
  other.gobject_ = nullptr;
}

Segment& Segment::operator=(Segment&& other) noexcept
{
  Segment temp (other);
  swap(temp);
  return *this;
}

Segment::Segment(GstSegment* gobject, bool make_a_copy)
:
  // For BoxedType wrappers, make_a_copy is true by default.  The static
  // BoxedType wrappers must always take a copy, thus make_a_copy = true
  // ensures identical behaviour if the default argument is used.
  gobject_ ((make_a_copy && gobject) ? gst_segment_copy(gobject) : gobject)
{}

Segment& Segment::operator=(const Segment& other)
{
  Segment temp (other);
  swap(temp);
  return *this;
}

Segment::~Segment() noexcept
{
  if(gobject_)
    gst_segment_free(gobject_);
}

void Segment::swap(Segment& other) noexcept
{
  std::swap(gobject_, other.gobject_);
}

GstSegment* Segment::gobj_copy() const
{
  return gst_segment_copy(gobject_);
}


bool Segment::clip(Format format, guint64 start, guint64 stop, guint64& clip_start, guint64& clip_stop) const
{
  return gst_segment_clip(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), start, stop, &(clip_start), &(clip_stop));
}

void Segment::init(Format format)
{
  gst_segment_init(gobj(), ((GstFormat)(format)));
}

guint64 Segment::to_running_time(Format format, guint64 position) const
{
  return gst_segment_to_running_time(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), position);
}

int Segment::to_running_time(Format format, guint64 position, guint64& running_time) const
{
  return gst_segment_to_running_time_full(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), position, &(running_time));
}

guint64 Segment::to_stream_time(Format format, guint64 position) const
{
  return gst_segment_to_stream_time(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), position);
}

int Segment::to_stream_time(Format format, guint64 position, guint64& stream_time) const
{
  return gst_segment_to_stream_time_full(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), position, &(stream_time));
}

guint64 Segment::to_position(Format format, guint64 running_time) const
{
  return gst_segment_to_position(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), running_time);
}

bool Segment::set_running_time(Format format, guint64 running_time)
{
  return gst_segment_set_running_time(gobj(), ((GstFormat)(format)), running_time);
}

guint64 Segment::position_from_running_time(Gst::Format format, guint64 running_time) const
{
  return gst_segment_position_from_running_time(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), running_time);
}

int Segment::position_from_running_time(Gst::Format format, guint64 running_time, guint64& position) const
{
  return gst_segment_position_from_running_time_full(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), running_time, &(position));
}

guint64 Segment::position_from_stream_time(Gst::Format format, guint64 stream_time) const
{
  return gst_segment_position_from_stream_time(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), stream_time);
}

int Segment::position_from_stream_time(Gst::Format format, guint64 stream_time, guint64& position) const
{
  return gst_segment_position_from_stream_time_full(const_cast<GstSegment*>(gobj()), ((GstFormat)(format)), stream_time, &(position));
}

bool Segment::offset_running_time(Gst::Format format, gint64 offset)
{
  return gst_segment_offset_running_time(gobj(), ((GstFormat)(format)), offset);
}

bool Segment::is_equal(const Gst::Segment& s2) const
{
  return gst_segment_is_equal(const_cast<GstSegment*>(gobj()), s2.gobj());
}


} // namespace Gst


