2005-04-25 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* configure.ac:
+ * examples/Makefile.am:
+ * examples/gstplay/.cvsignore:
+ * examples/gstplay/Makefile.am:
+ * examples/gstplay/player.c:
+ * gst-libs/gst/Makefile.am:
+ * gst-libs/gst/play/.cvsignore:
+ * gst-libs/gst/play/Makefile.am:
+ * gst-libs/gst/play/play.c:
+ * gst-libs/gst/play/play.h:
+ * gst-libs/gst/play/play.vcproj:
+ * pkgconfig/Makefile.am:
+ * pkgconfig/gstreamer-play-uninstalled.pc.in:
+ * pkgconfig/gstreamer-play.pc.in:
+ Remove libgstplay, playbin is now the official successor.
+
+2005-04-25 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
+
+ * configure.ac:
* gst-libs/gst/Makefile.am:
* gst-libs/gst/xwindowlistener/Makefile.am:
* gst-libs/gst/xwindowlistener/xwindowlistener.c:
gst-libs/gst/media-info/Makefile
gst-libs/gst/mixer/Makefile
gst-libs/gst/navigation/Makefile
-gst-libs/gst/play/Makefile
gst-libs/gst/propertyprobe/Makefile
gst-libs/gst/riff/Makefile
gst-libs/gst/tag/Makefile
examples/capsfilter/Makefile
examples/seeking/Makefile
examples/indexing/Makefile
-examples/gstplay/Makefile
examples/switch/Makefile
examples/Makefile
testsuite/embed/Makefile
pkgconfig/gstreamer-libs-uninstalled.pc
pkgconfig/gstreamer-media-info.pc
pkgconfig/gstreamer-media-info-uninstalled.pc
-pkgconfig/gstreamer-play.pc
-pkgconfig/gstreamer-play-uninstalled.pc
pkgconfig/gstreamer-plugins.pc
pkgconfig/gstreamer-plugins-uninstalled.pc
po/Makefile.in
GTK_SUBDIRS=
endif
-if USE_GCONF
-GCONF_SUBDIRS=gstplay
-else
-GCONF_SUBDIRS=
-endif
-
-SUBDIRS=$(GTK_SUBDIRS) $(GCONF_SUBDIRS) switch
-DIST_SUBDIRS=capsfilter dynparams seeking indexing gstplay switch
+SUBDIRS=$(GTK_SUBDIRS) switch
+DIST_SUBDIRS=capsfilter dynparams seeking indexing switch
+++ /dev/null
-
-noinst_PROGRAMS = player
-
-player_SOURCES = player.c
-player_CFLAGS = $(GST_CFLAGS) $(GCONF_CFLAGS)
-player_LDFLAGS = \
- $(GST_LIBS) \
- $(top_builddir)/gst-libs/gst/gconf/libgstgconf-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/play/libgstplay-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/play/play.h>
-#include <gst/gconf/gconf.h>
-
-static GMainLoop *loop = NULL;
-static gint64 length = 0;
-
-static void
-print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
-{
- gint i, count;
-
- count = gst_tag_list_get_tag_size (list, tag);
-
- for (i = 0; i < count; i++) {
- gchar *str;
-
- if (gst_tag_get_type (tag) == G_TYPE_STRING) {
- if (!gst_tag_list_get_string_index (list, tag, i, &str))
- g_assert_not_reached ();
- } else {
- str =
- g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
- }
-
- if (i == 0) {
- g_print ("%15s: %s\n", gst_tag_get_nick (tag), str);
- } else {
- g_print (" : %s\n", str);
- }
-
- g_free (str);
- }
-}
-
-static void
-got_found_tag (GstPlay * play, GstElement * source, GstTagList * tag_list)
-{
- gst_tag_list_foreach (tag_list, print_tag, NULL);
-}
-
-static void
-got_time_tick (GstPlay * play, gint64 time_nanos)
-{
- g_print ("time tick %f\n", time_nanos / (float) GST_SECOND);
-}
-
-static void
-got_stream_length (GstPlay * play, gint64 length_nanos)
-{
- g_print ("got length %" G_GUINT64_FORMAT "\n", length_nanos);
- length = length_nanos;
-}
-
-static void
-got_video_size (GstPlay * play, gint width, gint height)
-{
- g_print ("got video size %d, %d\n", width, height);
-}
-
-static void
-got_eos (GstPlay * play)
-{
- g_print ("End Of Stream\n");
- g_main_loop_quit (loop);
-}
-
-static gboolean
-seek_timer (GstPlay * play)
-{
- gst_play_seek_to_time (play, length / 2);
- return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstPlay *play;
- GstElement *data_src, *video_sink, *audio_sink, *vis_element;
- GError *error = NULL;
-
- /* Initing GStreamer library */
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_print ("usage: %s <video filename>\n", argv[0]);
- exit (-1);
- }
-
- loop = g_main_loop_new (NULL, FALSE);
-
- /* Creating the GstPlay object */
- play = gst_play_new (&error);
- if (error) {
- g_print ("Error: could not create play object:\n%s\n", error->message);
- g_error_free (error);
- return 1;
- }
-
- /* Getting default audio and video plugins from GConf */
- vis_element = gst_element_factory_make ("goom", "vis_element");
- data_src = gst_element_factory_make ("gnomevfssrc", "source");
-
- audio_sink = gst_gconf_get_default_audio_sink ();
- if (!GST_IS_ELEMENT (audio_sink))
- g_error ("Could not get default audio sink from GConf");
- video_sink = gst_gconf_get_default_video_sink ();
- if (!GST_IS_ELEMENT (video_sink))
- g_error ("Could not get default video sink from GConf");
-
-
- /* Let's send them to GstPlay object */
- if (!gst_play_set_audio_sink (play, audio_sink))
- g_warning ("Could not set audio sink");
- if (!gst_play_set_video_sink (play, video_sink))
- g_warning ("Could not set video sink");
- if (!gst_play_set_data_src (play, data_src))
- g_warning ("Could not set data src");
- if (!gst_play_set_visualization (play, vis_element))
- g_warning ("Could not set visualisation");
-
- /* Setting location we want to play */
- if (!gst_play_set_location (play, argv[1]))
- g_warning ("Could not set location");
-
- /* Uncomment that line to get an XML dump of the pipeline */
- /* gst_xml_write_file (GST_ELEMENT (play), stdout); */
-
- g_signal_connect (G_OBJECT (play), "time_tick",
- G_CALLBACK (got_time_tick), NULL);
- g_signal_connect (G_OBJECT (play), "stream_length",
- G_CALLBACK (got_stream_length), NULL);
- g_signal_connect (G_OBJECT (play), "have_video_size",
- G_CALLBACK (got_video_size), NULL);
- g_signal_connect (G_OBJECT (play), "found_tag",
- G_CALLBACK (got_found_tag), NULL);
- g_signal_connect (G_OBJECT (play), "error",
- G_CALLBACK (gst_element_default_error), NULL);
- g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL);
-
- /* Change state to PLAYING */
- if (gst_element_set_state (GST_ELEMENT (play),
- GST_STATE_PLAYING) == GST_STATE_FAILURE)
- g_error ("Could not set state to PLAYING");
-
- g_timeout_add (20000, (GSourceFunc) seek_timer, play);
-
- g_main_loop_run (loop);
-
- g_print ("setting pipeline to ready\n");
-
- gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
- /* unref
- gst_object_unref (GST_OBJECT (play)); */
-
- exit (0);
-}
tuner \
video \
xoverlay \
- . \
- play
+ .
DIST_SUBDIRS = \
audio \
media-info \
mixer \
navigation \
- play \
propertyprobe \
riff \
tag \
+++ /dev/null
-play-enumtypes.[ch]
-play-marshal.[ch]
-play-marshal.list
+++ /dev/null
-# variables used for enum generation
-glib_enum_headers=$(play_headers)
-glib_enum_define=GST_PLAY
-glib_enum_prefix=gst_play
-
-librarydir = $(libdir)
-
-play_headers = \
- play.h
-
-built_headers = \
- play-enumtypes.h
-
-library_LTLIBRARIES = libgstplay-@GST_MAJORMINOR@.la
-
-libgstplay_@GST_MAJORMINOR@_la_SOURCES = play.c
-nodist_libgstplay_@GST_MAJORMINOR@_la_SOURCES = play-enumtypes.c
-
-libgstplay_@GST_MAJORMINOR@includedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/play
-libgstplay_@GST_MAJORMINOR@include_HEADERS = $(play_headers)
-nodist_libgstplay_@GST_MAJORMINOR@include_HEADERS = $(built_headers)
-
-libgstplay_@GST_MAJORMINOR@_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_CFLAGS)
-libgstplay_@GST_MAJORMINOR@_la_LIBADD = \
- $(GST_LIBS) $(GST_PLUGINS_LIBS) \
- $(GST_CONTROL_LIBS) \
- $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-libgstplay_@GST_MAJORMINOR@_la_LDFLAGS = \
- -version-info @GST_PLUGINS_LIBVERSION@
-
-BUILT_SOURCES = \
- play-enumtypes.c \
- $(built_headers)
-
-CLEANFILES = $(BUILT_SOURCES)
-
-include $(top_srcdir)/common/glib-gen.mak
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <string.h>
-#include <unistd.h>
-#include <gst/gst.h>
-#include <gst/gst-i18n-plugin.h>
-
-#include "play.h"
-
-#define TICK_INTERVAL_MSEC 200
-
-GST_DEBUG_CATEGORY_STATIC (play_debug);
-#define GST_CAT_DEFAULT play_debug
-
-enum
-{
- TIME_TICK,
- STREAM_LENGTH,
- HAVE_VIDEO_SIZE,
- LAST_SIGNAL
-};
-
-struct _GstPlayPrivate
-{
- /* progress indicators */
- guint64 time_nanos;
- guint64 length_nanos;
- gint get_length_attempt;
- guint tick_id;
-
- /* playbin object */
- GstElement *playbin;
-
- /* visualization */
- gboolean enable_vis;
- GstElement *vis_element;
-
- /* location */
- char *location;
-};
-
-static guint gst_play_signals[LAST_SIGNAL] = { 0 };
-
-static GstPipelineClass *parent_class = NULL;
-
-/* ======================================================= */
-/* */
-/* Private Methods */
-/* */
-/* ======================================================= */
-
-static void
-caps_set (GstPad * pad, GParamSpec * pspec, GstPlay * play)
-{
- const GstCaps *caps = GST_PAD_CAPS (pad);
- GstStructure *s = gst_caps_get_structure (caps, 0);
-
- if (s) {
- const GValue *par;
- gint w, h;
-
- /* get effective size */
- gst_structure_get_int (s, "width", &w);
- gst_structure_get_int (s, "height", &h);
- if ((par = gst_structure_get_value (s, "pixel-aspect-ratio"))) {
- gint num = gst_value_get_fraction_numerator (par),
- den = gst_value_get_fraction_denominator (par);
-
- if (num > den)
- w *= (gfloat) num / den;
- else
- h *= (gfloat) den / num;
- }
-
- g_signal_emit (play, gst_play_signals[HAVE_VIDEO_SIZE], 0, w, h);
- g_signal_handlers_disconnect_by_func (pad, caps_set, play);
- }
-}
-
-static void
-setup_size (GstPlay * play)
-{
- const GList *streaminfo = NULL;
- GstPad *pad = NULL;
-
- g_object_get (G_OBJECT (play->priv->playbin),
- "stream-info", &streaminfo, NULL);
-
- for (; streaminfo != NULL; streaminfo = streaminfo->next) {
- GObject *info = streaminfo->data;
- gint type;
- GParamSpec *pspec;
- GEnumValue *val;
-
- g_object_get (info, "type", &type, NULL);
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (info), "type");
- val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
-
- if (g_strrstr (val->value_name, "VIDEO")) {
- g_object_get (info, "object", &pad, NULL);
- pad = (GstPad *) GST_PAD_REALIZE (pad);
- break;
- }
- }
-
- if (pad) {
- /* handle explicit caps as well - they're set later */
- if (GST_PAD_CAPS (pad))
- caps_set (pad, NULL, play);
- else
- g_signal_connect (pad, "notify::caps", G_CALLBACK (caps_set), play);
- }
-}
-
-static gboolean
-gst_play_tick_callback (GstPlay * play)
-{
- GstFormat fmt = GST_FORMAT_TIME;
- gint64 value;
-
- /* check length/pos of stream */
- if (!GST_CLOCK_TIME_IS_VALID (play->priv->length_nanos) &&
- play->priv->get_length_attempt < 16) {
- if (gst_element_query (GST_ELEMENT (play->priv->playbin),
- GST_QUERY_TOTAL, &fmt, &value)) {
- play->priv->length_nanos = value;
- g_signal_emit (G_OBJECT (play), gst_play_signals[STREAM_LENGTH],
- 0, play->priv->length_nanos);
- }
- play->priv->get_length_attempt++;
- }
- if (gst_element_query (GST_ELEMENT (play->priv->playbin),
- GST_QUERY_POSITION, &fmt, &value)) {
- play->priv->time_nanos = value;
- g_signal_emit (G_OBJECT (play), gst_play_signals[TIME_TICK],
- 0, play->priv->time_nanos);
- }
-
- return TRUE;
-}
-
-/*
- * Virtual function.
- */
-
-static void
-gst_play_change_state (GstElement * element,
- GstElementState old, GstElementState new, gpointer data)
-{
- GstPlay *play = GST_PLAY (data);
- gint t = (old << 8) | new;
-
- /* now set up tickers */
- switch (t) {
- case GST_STATE_PAUSED_TO_PLAYING:
- play->priv->tick_id = g_timeout_add (TICK_INTERVAL_MSEC,
- (GSourceFunc) gst_play_tick_callback, play);
- break;
- case GST_STATE_PLAYING_TO_PAUSED:
- if (play->priv->tick_id != 0) {
- g_source_remove (play->priv->tick_id);
- play->priv->tick_id = 0;
- }
- break;
- case GST_STATE_PAUSED_TO_READY:
- play->priv->length_nanos = GST_CLOCK_TIME_NONE;
- play->priv->time_nanos = GST_CLOCK_TIME_NONE;
- play->priv->get_length_attempt = 0;
- break;
- case GST_STATE_READY_TO_PAUSED:
- setup_size (play);
- break;
- default:
- break;
- }
-}
-
-/* =========================================== */
-/* */
-/* Init & Dispose & Class init */
-/* */
-/* =========================================== */
-
-static void
-gst_play_dispose (GObject * object)
-{
- GstPlay *play = GST_PLAY (object);
-
- /* reset */
- gst_element_set_state (GST_ELEMENT (play), GST_STATE_NULL);
-
- /* no vis */
- if (play->priv->vis_element) {
- gst_object_unref (GST_OBJECT (play->priv->vis_element));
- play->priv->vis_element = NULL;
- }
-
- g_free (play->priv->location);
- play->priv->location = NULL;
-
- /* parent will clean up the rest */
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-gst_play_init (GstPlay * play)
-{
- play->priv = g_new0 (GstPlayPrivate, 1);
-
- /* default */
- play->priv->length_nanos = GST_CLOCK_TIME_NONE;
- play->priv->time_nanos = GST_CLOCK_TIME_NONE;
- play->priv->tick_id = 0;
- play->priv->get_length_attempt = 0;
-
- play->priv->enable_vis = FALSE;
- play->priv->vis_element = NULL;
-
- play->priv->location = NULL;
-
- /* make playbin */
- play->priv->playbin = gst_element_factory_make ("playbin", "player");
- if (play->priv->playbin) {
- gst_bin_add (GST_BIN (play), play->priv->playbin);
- g_signal_connect (play->priv->playbin, "state-change",
- G_CALLBACK (gst_play_change_state), play);
- }
-}
-
-static void
-gst_play_class_init (GstPlayClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GST_TYPE_PIPELINE);
-
- gobject_class->dispose = gst_play_dispose;
-
- gst_play_signals[TIME_TICK] =
- g_signal_new ("time-tick", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, time_tick), NULL, NULL,
- gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
- gst_play_signals[STREAM_LENGTH] =
- g_signal_new ("stream-length", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, stream_length), NULL, NULL,
- gst_marshal_VOID__INT64, G_TYPE_NONE, 1, G_TYPE_INT64);
- gst_play_signals[HAVE_VIDEO_SIZE] =
- g_signal_new ("have-video-size", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (GstPlayClass, have_video_size), NULL, NULL,
- gst_marshal_VOID__INT_INT, G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- GST_DEBUG_CATEGORY_INIT (play_debug, "GST_PLAY", 0, "GStreamer Play library");
-
- GST_DEBUG ("Play class initialized");
-}
-
-/* ======================================================= */
-/* */
-/* Public Methods */
-/* */
-/* ======================================================= */
-
-/**
- * gst_play_set_location:
- * @play: a #GstPlay.
- * @location: a const #char* indicating location to play
- *
- * Set location of @play to @location.
- *
- * Returns: TRUE if location was set successfully.
- */
-
-gboolean
-gst_play_set_location (GstPlay * play, const char *location)
-{
- char *uri;
-
- g_return_val_if_fail (play != NULL, FALSE);
- g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
- g_return_val_if_fail (location != NULL, FALSE);
-
- /* cache */
- if (play->priv->location)
- g_free (play->priv->location);
- play->priv->location = g_strdup (location);
-
- /* get file */
- gst_element_set_state (play->priv->playbin, GST_STATE_READY);
- if (strchr (location, ':'))
- uri = g_strdup (location);
- else if (location[0] == '/')
- uri = g_strdup_printf ("file://%s", location);
- else {
- char cwd[256];
-
- getcwd (cwd, 255);
- uri = g_strdup_printf ("file://%s/%s", cwd, location);
- }
- g_object_set (play->priv->playbin, "uri", uri, NULL);
- g_free (uri);
-
- /* open */
- if (gst_element_set_state (play->priv->playbin,
- GST_STATE_PAUSED) != GST_STATE_SUCCESS) {
- return FALSE;
- }
-
- return TRUE;
-}
-
-/**
- * gst_play_get_location:
- * @play: a #GstPlay.
- *
- * Get current location of @play.
- *
- * Returns: a #char* pointer to current location.
- */
-
-char *
-gst_play_get_location (GstPlay * play)
-{
- g_return_val_if_fail (play != NULL, NULL);
- g_return_val_if_fail (GST_IS_PLAY (play), NULL);
-
- return g_strdup (play->priv->location);
-}
-
-/**
- * gst_play_seek_to_time:
- * @play: a #GstPlay.
- * @time_nanos: a #gint64 indicating a time position.
- *
- * Performs a seek on @play until @time_nanos.
- */
-
-/*
- * FIXME: use GstClockTime for 0.9
- */
-
-gboolean
-gst_play_seek_to_time (GstPlay * play, gint64 time_nanos)
-{
- return gst_element_seek (play->priv->playbin,
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, time_nanos);
-}
-
-/**
- * gst_play_set_data_src:
- * @play: a #GstPlay.
- * @data_src: a #GstElement.
- *
- * Set @data_src as the source element of @play.
- *
- * Returns: TRUE if call succeeded.
- */
-
-gboolean
-gst_play_set_data_src (GstPlay * play, GstElement * data_src)
-{
- /* deprecated - use URIs */
- return FALSE;
-}
-
-/**
- * gst_play_set_video_sink:
- * @play: a #GstPlay.
- * @video_sink: a #GstElement.
- *
- * Set @video_sink as the video sink element of @play.
- *
- * Returns: TRUE if call succeeded.
- */
-
-gboolean
-gst_play_set_video_sink (GstPlay * play, GstElement * video_sink)
-{
- g_object_set (G_OBJECT (play->priv->playbin), "video-sink", video_sink, NULL);
-
- return TRUE;
-}
-
-/**
- * gst_play_set_audio_sink:
- * @play: a #GstPlay.
- * @audio_sink: a #GstElement.
- *
- * Set @audio_sink as the audio sink element of @play.
- *
- * Returns: TRUE if call succeeded.
- */
-
-gboolean
-gst_play_set_audio_sink (GstPlay * play, GstElement * audio_sink)
-{
- g_object_set (G_OBJECT (play->priv->playbin), "audio-sink", audio_sink, NULL);
-
- return TRUE;
-}
-
-/**
- * gst_play_set_visualization:
- * @play: a #GstPlay.
- * @element: a #GstElement.
- *
- * Set @video_sink as the video sink element of @play.
- *
- * Returns: TRUE if call succeeded.
- */
-
-gboolean
-gst_play_set_visualization (GstPlay * play, GstElement * vis_element)
-{
- /* unset old */
- if (play->priv->vis_element) {
- gst_object_unref (GST_OBJECT (play->priv->vis_element));
- play->priv->vis_element = NULL;
- }
-
- /* set new */
- if (vis_element) {
- gst_object_ref (GST_OBJECT (vis_element));
- play->priv->vis_element = vis_element;
- }
-
- /* use */
- if (play->priv->vis_element && play->priv->enable_vis) {
- g_object_set (G_OBJECT (play->priv->playbin),
- "vis-plugin", vis_element, NULL);
- } else {
- g_object_set (G_OBJECT (play->priv->playbin), "vis-plugin", NULL, NULL);
- }
-
- return TRUE;
-}
-
-/**
- * gst_play_connect_visualization:
- * @play: a #GstPlay.
- * @connect: a #gboolean indicating wether or not
- * visualization should be connected.
- *
- * Connect or disconnect visualization bin in @play.
- *
- * Returns: TRUE if call succeeded.
- */
-
-gboolean
-gst_play_connect_visualization (GstPlay * play, gboolean connect)
-{
- play->priv->enable_vis = connect;
-
- /* use */
- if (play->priv->vis_element && play->priv->enable_vis) {
- g_object_set (G_OBJECT (play->priv->playbin),
- "vis-plugin", play->priv->vis_element, NULL);
- } else {
- g_object_set (G_OBJECT (play->priv->playbin), "vis-plugin", NULL, NULL);
- }
-
- return TRUE;
-}
-
-/**
- * gst_play_get_framerate:
- * @play: a #GstPlay.
- *
- * Get the video framerate from @play.
- *
- * Returns: a #gdouble indicating video framerate in frame per second.
- */
-
-gdouble
-gst_play_get_framerate (GstPlay * play)
-{
- const GList *streaminfo = NULL;
- const GstStructure *str = NULL;
- gdouble value;
-
- g_object_get (G_OBJECT (play->priv->playbin),
- "stream-info", &streaminfo, NULL);
-
- for (; streaminfo != NULL; streaminfo = streaminfo->next) {
- GObject *info = streaminfo->data;
- gint type;
- GParamSpec *pspec;
- GEnumValue *val;
-
- g_object_get (info, "type", &type, NULL);
- pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (info), "type");
- val = g_enum_get_value (G_PARAM_SPEC_ENUM (pspec)->enum_class, type);
-
- if (strstr (val->value_name, "VIDEO")) {
- const GstCaps *caps = NULL;
- GstPad *pad = NULL;
-
- g_object_get (info, "object", &pad, NULL);
- g_assert (GST_IS_PAD (pad));
- pad = (GstPad *) GST_PAD_REALIZE (pad);
- caps = GST_PAD_CAPS (pad);
- str = gst_caps_get_structure (caps, 0);
- break;
- }
- }
-
- if (!str)
- return 0.;
-
- gst_structure_get_double (str, "framerate", &value);
-
- return value;
-}
-
-/**
- * gst_play_get_sink_element:
- * @play: a #GstPlay.
- * @element: a #GstElement.
- * @sink_type: a #GstPlaySinkType.
- *
- * Searches recursively for a sink #GstElement with
- * type @sink_type in @element which is supposed to be a #GstBin.
- *
- * Returns: the sink #GstElement of @element.
- */
-
-/*
- * (Ronald) what is this?
- */
-
-GstElement *
-gst_play_get_sink_element (GstPlay * play,
- GstElement * element, GstPlaySinkType sink_type)
-{
- GList *elements = NULL;
- const GList *pads = NULL;
- gboolean has_src, has_correct_type;
-
- g_return_val_if_fail (GST_IS_PLAY (play), NULL);
- g_return_val_if_fail (GST_IS_ELEMENT (element), NULL);
-
- GST_DEBUG_OBJECT (play, "looking for sink element in %s",
- GST_ELEMENT_NAME (element));
-
- if (!GST_IS_BIN (element)) {
- /* since its not a bin, we'll assume this
- * element is a sink element */
- GST_DEBUG_OBJECT (play, "not a bin, returning %s as sink element",
- GST_ELEMENT_NAME (element));
- return element;
- }
-
- /* FIXME, not MT safe */
- elements = (GList *) GST_BIN (element)->children;
-
- /* traverse all elements looking for one without src pad */
-
- while (elements) {
- element = GST_ELEMENT (elements->data);
- GST_DEBUG_OBJECT (play, "looking at element %s",
- GST_ELEMENT_NAME (element));
-
- /* Recursivity :) */
-
- if (GST_IS_BIN (element)) {
- element = gst_play_get_sink_element (play, element, sink_type);
- if (GST_IS_ELEMENT (element))
- return element;
- } else {
- /* FIXME, not MT safe */
- pads = element->pads;
- has_src = FALSE;
- has_correct_type = FALSE;
- while (pads) {
- /* check for src pad */
- if (GST_PAD_DIRECTION (GST_PAD (pads->data)) == GST_PAD_SRC) {
- GST_DEBUG_OBJECT (play, "element %s has a src pad",
- GST_ELEMENT_NAME (element));
- has_src = TRUE;
- break;
- } else {
- /* If not a src pad checking caps */
- GstPad *pad;
- GstCaps *caps;
- GstStructure *structure;
- int i;
- gboolean has_video_cap = FALSE;
- gboolean has_audio_cap = FALSE;
-
- pad = GST_PAD (pads->data);
- caps = gst_pad_get_caps (pad);
- /* loop over all caps members to find mime types */
- for (i = 0; i < gst_caps_get_size (caps); ++i) {
- structure = gst_caps_get_structure (caps, i);
-
- GST_DEBUG_OBJECT (play,
- "looking at caps %d pad %s:%s on element %s with mime %s", i,
- GST_DEBUG_PAD_NAME (pad),
- GST_ELEMENT_NAME (element), gst_structure_get_name (structure));
-
- if (strcmp (gst_structure_get_name (structure),
- "audio/x-raw-int") == 0) {
- has_audio_cap = TRUE;
- }
-
- if (strcmp (gst_structure_get_name (structure),
- "video/x-raw-yuv") == 0 ||
- strcmp (gst_structure_get_name (structure),
- "video/x-raw-rgb") == 0) {
- has_video_cap = TRUE;
- }
- }
-
- gst_caps_unref (caps);
-
- switch (sink_type) {
- case GST_PLAY_SINK_TYPE_AUDIO:
- if (has_audio_cap)
- has_correct_type = TRUE;
- break;
- case GST_PLAY_SINK_TYPE_VIDEO:
- if (has_video_cap)
- has_correct_type = TRUE;
- break;
- case GST_PLAY_SINK_TYPE_ANY:
- if ((has_video_cap) || (has_audio_cap))
- has_correct_type = TRUE;
- break;
- default:
- has_correct_type = FALSE;
- }
- }
-
- pads = g_list_next (pads);
-
- }
-
- if ((!has_src) && (has_correct_type)) {
- GST_DEBUG_OBJECT (play, "found %s with src pad and correct type",
- GST_ELEMENT_NAME (element));
- return element;
- }
- }
-
- elements = g_list_next (elements);
- }
-
- /* we didn't find a sink element */
-
- return NULL;
-}
-
-/**
- * gst_play_get_all_by_interface:
- * @play: a #GstPlay.
- * @interface: an interface.
- *
- * Returns all elements that are used by @play implementing the given interface.
- *
- * Returns: a #GList of #GstElement implementing the interface.
- *
- * Not MT safe.
- */
-
-GList *
-gst_play_get_all_by_interface (GstPlay * play, GType interface_type)
-{
- GstElement *videosink = NULL, *audiosink = NULL;
- GList *res = NULL;
- GstIterator *it = NULL;
-
- g_object_get (G_OBJECT (play->priv->playbin),
- "video-sink", &videosink, "audio-sink", &audiosink, NULL);
-
- /* ehw... */
- if (videosink && GST_IS_BIN (videosink)) {
- it = gst_bin_iterate_all_by_interface (GST_BIN (videosink), interface_type);
- }
- if (!res && audiosink && GST_IS_BIN (audiosink)) {
- it = gst_bin_iterate_all_by_interface (GST_BIN (audiosink), interface_type);
- }
- if (it != NULL) {
- gpointer data;
-
- while (gst_iterator_next (it, &data) == GST_ITERATOR_OK) {
- res = g_list_prepend (res, data);
- }
- }
-
- return res;
-}
-
-/**
- * gst_play_new:
- * @error: a pointer to a #GError, which will be filled in on error.
- *
- * Creates a new GstPlay object.
- *
- * Returns: a newly created #GstPlay, or NULL on error (the #GError
- * will be set accordingly).
- */
-
-GstPlay *
-gst_play_new (GError ** error)
-{
- GstPlay *play = g_object_new (GST_TYPE_PLAY, NULL);
-
- if (!play->priv->playbin) {
- g_set_error (error, 0, 0, _("Failed to create playbin object"));
- g_object_unref (G_OBJECT (play));
-
- return NULL;
- }
-
- return play;
-}
-
-/* =========================================== */
-/* */
-/* Object typing & Creation */
-/* */
-/* =========================================== */
-
-GType
-gst_play_get_type (void)
-{
- static GType play_type = 0;
-
- if (!play_type) {
- static const GTypeInfo play_info = {
- sizeof (GstPlayClass),
- NULL,
- NULL,
- (GClassInitFunc) gst_play_class_init,
- NULL,
- NULL,
- sizeof (GstPlay),
- 0,
- (GInstanceInitFunc) gst_play_init,
- NULL
- };
-
- play_type = g_type_register_static (GST_TYPE_PIPELINE, "GstPlay",
- &play_info, 0);
- }
-
- return play_type;
-}
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __GST_PLAY_H__
-#define __GST_PLAY_H__
-
-#include <gst/gst.h>
-#include <gst/xoverlay/xoverlay.h>
-#include <gst/play/play-enumtypes.h>
-
-G_BEGIN_DECLS
-
-/* GError stuff */
-
-#define GST_PLAY_ERROR gst_play_error_quark ()
-/* GObject stuff */
-
-#define GST_TYPE_PLAY (gst_play_get_type())
-#define GST_PLAY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PLAY, GstPlay))
-#define GST_PLAY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
-#define GST_IS_PLAY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PLAY))
-#define GST_IS_PLAY_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
-#define GST_PLAY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_PLAY, GstPlayClass))
-
-typedef enum
-{
- GST_PLAY_SINK_TYPE_AUDIO,
- GST_PLAY_SINK_TYPE_VIDEO,
- GST_PLAY_SINK_TYPE_ANY,
-} GstPlaySinkType;
-
-typedef struct _GstPlay GstPlay;
-typedef struct _GstPlayClass GstPlayClass;
-typedef struct _GstPlayPrivate GstPlayPrivate;
-
-struct _GstPlay
-{
- GstPipeline pipeline;
-
- GstPlayPrivate *priv;
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-struct _GstPlayClass
-{
- GstPipelineClass parent_class;
-
- void (*time_tick) (GstPlay *play, gint64 time_nanos);
- void (*stream_length) (GstPlay *play, gint64 length_nanos);
- void (*have_video_size) (GstPlay *play, gint width, gint height);
-
- gpointer _gst_reserved[GST_PADDING];
-};
-
-GType gst_play_get_type (void);
-GstPlay * gst_play_new (GError **error);
-
-gboolean gst_play_set_data_src (GstPlay *play,
- GstElement *data_src);
-gboolean gst_play_set_video_sink (GstPlay *play,
- GstElement *video_sink);
-gboolean gst_play_set_audio_sink (GstPlay *play,
- GstElement *audio_sink);
-
-gboolean gst_play_set_visualization (GstPlay *play,
- GstElement *element);
-gboolean gst_play_connect_visualization (GstPlay *play,
- gboolean connect);
-
-gboolean gst_play_set_location (GstPlay *play,
- const char *location);
-char * gst_play_get_location (GstPlay *play);
-
-gboolean gst_play_seek_to_time (GstPlay *play,
- gint64 time_nanos);
-
-GstElement * gst_play_get_sink_element (GstPlay *play,
- GstElement *element,
- GstPlaySinkType sink_type);
-GList * gst_play_get_all_by_interface (GstPlay *play,
- GType interface);
-
-gdouble gst_play_get_framerate (GstPlay *play);
-
-G_END_DECLS
-
-#endif /* __GST_PLAY_H__ */
+++ /dev/null
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="play"
- ProjectGUID="{979C216F-0ACF-4956-AE00-055A42D67899}"
- RootNamespace="play"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../../win32/Debug"
- IntermediateDirectory="../../../win32/Debug"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;"../../../gst-libs";../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="4"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstplay.dll"
- LinkIncremental="2"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Debug;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="play.def"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/play.pdb"
- SubSystem="2"
- OptimizeReferences="2"
- ImportLibrary="$(OutDir)/gstplay.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../../win32/Release"
- IntermediateDirectory="../../../win32/Release"
- ConfigurationType="2"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../gstreamer/win32;../../../../gstreamer;../../../../gstreamer/libs;../../../../glib;../../../../glib/glib;../../../../glib/gmodule;"../../../gst-libs";../../../../popt/include;../../../../libxml2/include/libxml2"
- PreprocessorDefinitions="WIN32;NDEBUG;GST_DISABLE_GST_DEBUG;_WINDOWS;_USRDLL;HAVE_CONFIG_H;_USE_MATH_DEFINES"
- RuntimeLibrary="2"
- UsePrecompiledHeader="0"
- WarningLevel="3"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="glib-2.0.lib gmodule-2.0.lib gthread-2.0.lib gobject-2.0.lib libgstreamer.lib gstbytestream.lib iconv.lib intl.lib"
- OutputFile="$(OutDir)/gstplay.dll"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../gstreamer/win32/Release;../../../../glib/glib;../../../../glib/gmodule;../../../../glib/gthread;../../../../glib/gobject;../../../../gettext/lib;../../../../libiconv/lib"
- ModuleDefinitionFile="play.def"
- GenerateDebugInformation="TRUE"
- SubSystem="2"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- ImportLibrary="$(OutDir)/gstplay.lib"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"
- CommandLine="copy /Y $(TargetPath) c:\gstreamer\plugins"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath=".\play.c">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- <File
- RelativePath=".\play.h">
- </File>
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
gstreamer-interfaces-@GST_MAJORMINOR@.pc \
gstreamer-libs-@GST_MAJORMINOR@.pc \
gstreamer-media-info-@GST_MAJORMINOR@.pc \
- gstreamer-play-@GST_MAJORMINOR@.pc \
gstreamer-plugins-@GST_MAJORMINOR@.pc
pcverfiles_uninstalled = \
$(GCONF_PC_UNINSTALLED) \
gstreamer-interfaces-@GST_MAJORMINOR@-uninstalled.pc \
gstreamer-libs-@GST_MAJORMINOR@-uninstalled.pc \
gstreamer-media-info-@GST_MAJORMINOR@-uninstalled.pc \
- gstreamer-play-@GST_MAJORMINOR@-uninstalled.pc \
gstreamer-plugins-@GST_MAJORMINOR@-uninstalled.pc
pcverfiles_gconf = $(GCONF_PC) $(GCONF_PC_UNINSTALLED)
gstreamer-interfaces.pc.in gstreamer-interfaces-uninstalled.pc.in \
gstreamer-libs.pc.in gstreamer-libs-uninstalled.pc.in \
gstreamer-media-info.pc.in gstreamer-media-info-uninstalled.pc.in \
- gstreamer-play.pc.in gstreamer-play-uninstalled.pc.in \
gstreamer-plugins.pc.in gstreamer-plugins-uninstalled.pc.in
DISTCLEANFILES = $(pcinfiles:.in=)
+++ /dev/null
-prefix=
-exec_prefix=
-libdir=${pcfiledir}/../gst-libs/gst/play
-includedir=${pcfiledir}/../gst-libs
-
-Name: GStreamer Play Library, uninstalled
-Description: Streaming-media framework, play libraries, not installed
-Requires: gstreamer-@GST_MAJORMINOR@ \
- gstreamer-interfaces-@GST_MAJORMINOR@ >= @VERSION@
- gstreamer-control-@GST_MAJORMINOR@ >= @VERSION@
-Version: @VERSION@
-
-Libs: ${libdir}/libgstplay-@GST_MAJORMINOR@.la
-Cflags: -I${includedir}
+++ /dev/null
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@/gstreamer-@GST_MAJORMINOR@
-
-Name: GStreamer Play Library
-Description: Streaming-media framework, play libraries
-Requires: gstreamer-@GST_MAJORMINOR@ gstreamer-interfaces-@GST_MAJORMINOR@ gstreamer-control-@GST_MAJORMINOR@
-Version: @VERSION@
-
-Libs: -L${libdir} -lgstplay-@GST_MAJORMINOR@
-Cflags: -I${includedir}
GTK_SUBDIRS=
endif
-if USE_GCONF
-GCONF_SUBDIRS=gstplay
-else
-GCONF_SUBDIRS=
-endif
-
-SUBDIRS=$(GTK_SUBDIRS) $(GCONF_SUBDIRS) switch
-DIST_SUBDIRS=capsfilter dynparams seeking indexing gstplay switch
+SUBDIRS=$(GTK_SUBDIRS) switch
+DIST_SUBDIRS=capsfilter dynparams seeking indexing switch
+++ /dev/null
-
-noinst_PROGRAMS = player
-
-player_SOURCES = player.c
-player_CFLAGS = $(GST_CFLAGS) $(GCONF_CFLAGS)
-player_LDFLAGS = \
- $(GST_LIBS) \
- $(top_builddir)/gst-libs/gst/gconf/libgstgconf-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/play/libgstplay-@GST_MAJORMINOR@.la \
- $(top_builddir)/gst-libs/gst/libgstinterfaces-$(GST_MAJORMINOR).la
-
+++ /dev/null
-/* GStreamer
- * Copyright (C) 2003 Julien Moutte <julien@moutte.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 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
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <gst/play/play.h>
-#include <gst/gconf/gconf.h>
-
-static GMainLoop *loop = NULL;
-static gint64 length = 0;
-
-static void
-print_tag (const GstTagList * list, const gchar * tag, gpointer unused)
-{
- gint i, count;
-
- count = gst_tag_list_get_tag_size (list, tag);
-
- for (i = 0; i < count; i++) {
- gchar *str;
-
- if (gst_tag_get_type (tag) == G_TYPE_STRING) {
- if (!gst_tag_list_get_string_index (list, tag, i, &str))
- g_assert_not_reached ();
- } else {
- str =
- g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, i));
- }
-
- if (i == 0) {
- g_print ("%15s: %s\n", gst_tag_get_nick (tag), str);
- } else {
- g_print (" : %s\n", str);
- }
-
- g_free (str);
- }
-}
-
-static void
-got_found_tag (GstPlay * play, GstElement * source, GstTagList * tag_list)
-{
- gst_tag_list_foreach (tag_list, print_tag, NULL);
-}
-
-static void
-got_time_tick (GstPlay * play, gint64 time_nanos)
-{
- g_print ("time tick %f\n", time_nanos / (float) GST_SECOND);
-}
-
-static void
-got_stream_length (GstPlay * play, gint64 length_nanos)
-{
- g_print ("got length %" G_GUINT64_FORMAT "\n", length_nanos);
- length = length_nanos;
-}
-
-static void
-got_video_size (GstPlay * play, gint width, gint height)
-{
- g_print ("got video size %d, %d\n", width, height);
-}
-
-static void
-got_eos (GstPlay * play)
-{
- g_print ("End Of Stream\n");
- g_main_loop_quit (loop);
-}
-
-static gboolean
-seek_timer (GstPlay * play)
-{
- gst_play_seek_to_time (play, length / 2);
- return FALSE;
-}
-
-int
-main (int argc, char *argv[])
-{
- GstPlay *play;
- GstElement *data_src, *video_sink, *audio_sink, *vis_element;
- GError *error = NULL;
-
- /* Initing GStreamer library */
- gst_init (&argc, &argv);
-
- if (argc != 2) {
- g_print ("usage: %s <video filename>\n", argv[0]);
- exit (-1);
- }
-
- loop = g_main_loop_new (NULL, FALSE);
-
- /* Creating the GstPlay object */
- play = gst_play_new (&error);
- if (error) {
- g_print ("Error: could not create play object:\n%s\n", error->message);
- g_error_free (error);
- return 1;
- }
-
- /* Getting default audio and video plugins from GConf */
- vis_element = gst_element_factory_make ("goom", "vis_element");
- data_src = gst_element_factory_make ("gnomevfssrc", "source");
-
- audio_sink = gst_gconf_get_default_audio_sink ();
- if (!GST_IS_ELEMENT (audio_sink))
- g_error ("Could not get default audio sink from GConf");
- video_sink = gst_gconf_get_default_video_sink ();
- if (!GST_IS_ELEMENT (video_sink))
- g_error ("Could not get default video sink from GConf");
-
-
- /* Let's send them to GstPlay object */
- if (!gst_play_set_audio_sink (play, audio_sink))
- g_warning ("Could not set audio sink");
- if (!gst_play_set_video_sink (play, video_sink))
- g_warning ("Could not set video sink");
- if (!gst_play_set_data_src (play, data_src))
- g_warning ("Could not set data src");
- if (!gst_play_set_visualization (play, vis_element))
- g_warning ("Could not set visualisation");
-
- /* Setting location we want to play */
- if (!gst_play_set_location (play, argv[1]))
- g_warning ("Could not set location");
-
- /* Uncomment that line to get an XML dump of the pipeline */
- /* gst_xml_write_file (GST_ELEMENT (play), stdout); */
-
- g_signal_connect (G_OBJECT (play), "time_tick",
- G_CALLBACK (got_time_tick), NULL);
- g_signal_connect (G_OBJECT (play), "stream_length",
- G_CALLBACK (got_stream_length), NULL);
- g_signal_connect (G_OBJECT (play), "have_video_size",
- G_CALLBACK (got_video_size), NULL);
- g_signal_connect (G_OBJECT (play), "found_tag",
- G_CALLBACK (got_found_tag), NULL);
- g_signal_connect (G_OBJECT (play), "error",
- G_CALLBACK (gst_element_default_error), NULL);
- g_signal_connect (G_OBJECT (play), "eos", G_CALLBACK (got_eos), NULL);
-
- /* Change state to PLAYING */
- if (gst_element_set_state (GST_ELEMENT (play),
- GST_STATE_PLAYING) == GST_STATE_FAILURE)
- g_error ("Could not set state to PLAYING");
-
- g_timeout_add (20000, (GSourceFunc) seek_timer, play);
-
- g_main_loop_run (loop);
-
- g_print ("setting pipeline to ready\n");
-
- gst_element_set_state (GST_ELEMENT (play), GST_STATE_READY);
-
- /* unref
- gst_object_unref (GST_OBJECT (play)); */
-
- exit (0);
-}