/* Copyright (C) 2018 The gtkmm 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, see <http://www.gnu.org/licenses/>.
 */

#include <gtkmm/mediastream.h>

_DEFS(gtkmm,gtk)
_PINCLUDE(gtkmm/private/mediastream_p.h)

namespace Gio
{
class GTKMM_API File;
class GTKMM_API InputStream;
}

namespace Gtk
{

/** Open media files for use in GTK.
 *
 * %MediaFile is the implementation for media file usage with MediaStream.
 *
 * This provides a simple way to play back video files with GTK.
 *
 * GTK+ provides a GIO extension point for %Gtk::MediaFile implementations
 * to allow for external implementations using various media frameworks.
 * GTK+ itself includes implementations using GStreamer and ffmpeg.
 *
 * @see Gtk:MediaStream, Gtk::Video
 *
 * @newin{3,94}
 */
class GTKMM_API MediaFile : public Gtk::MediaStream
{
  _CLASS_GOBJECT(MediaFile, GtkMediaFile, GTK_MEDIA_FILE, Gtk::MediaStream, GtkMediaStream, , , GTKMM_API)

protected:
  _CTOR_DEFAULT()

public:
#m4 _CONVERSION(`GtkMediaStream*',`Glib::RefPtr<MediaFile>',`Glib::wrap(GTK_MEDIA_FILE($3))')
  // All gdk_media_file_new_*() functions do more than call g_object_new().
  _WRAP_METHOD(static Glib::RefPtr<MediaFile> create(), gtk_media_file_new)
  _WRAP_METHOD(static Glib::RefPtr<MediaFile> create_for_filename(
    const std::string& filename), gtk_media_file_new_for_filename)
  _WRAP_METHOD(static Glib::RefPtr<MediaFile> create_for_resource(
    const std::string& resource_path), gtk_media_file_new_for_resource)
  _WRAP_METHOD(static Glib::RefPtr<MediaFile> create(
    const Glib::RefPtr<Gio::File>& file), gtk_media_file_new_for_file)
  _WRAP_METHOD(static Glib::RefPtr<MediaFile> create(
    const Glib::RefPtr<Gio::InputStream>& stream), gtk_media_file_new_for_input_stream)

  _WRAP_METHOD(void clear(), gtk_media_file_clear)
  _WRAP_METHOD(void set_filename(const std::string& filename), gtk_media_file_set_filename)
  _WRAP_METHOD(void set_resource(const std::string& resource_path), gtk_media_file_set_resource)

  _WRAP_METHOD(void set_file(const Glib::RefPtr<Gio::File>& file), gtk_media_file_set_file)
  _WRAP_METHOD(Glib::RefPtr<Gio::File> get_file(), gtk_media_file_get_file, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::File> get_file() const, gtk_media_file_get_file, refreturn, constversion)

  _WRAP_METHOD(void set_input_stream(const Glib::RefPtr<Gio::InputStream>& stream), gtk_media_file_set_input_stream)
  _WRAP_METHOD(Glib::RefPtr<Gio::InputStream> get_input_stream(), gtk_media_file_get_input_stream, refreturn)
  _WRAP_METHOD(Glib::RefPtr<const Gio::InputStream> get_input_stream() const, gtk_media_file_get_input_stream, refreturn, constversion)
  
  _WRAP_PROPERTY("file", Glib::RefPtr<Gio::File>)
  _WRAP_PROPERTY("input-stream", Glib::RefPtr<Gio::InputStream>)

protected:
  _WRAP_VFUNC(void open(), open)
  _WRAP_VFUNC(void close(), close)

  // There are no signals.
};

} // namespace Gtk
