+2005-11-30 Thomas Vander Stichele <thomas (at) apestaart (dot) org>
+
+ * Makefile.am:
+ * configure.ac:
+ * examples/Makefile.am:
+ * examples/capsfilter/Makefile.am:
+ * examples/capsfilter/capsfilter1.c:
+ * examples/gob/Makefile.am:
+ * examples/gob/gst-identity2.gob:
+ * examples/indexing/.cvsignore:
+ * examples/indexing/Makefile.am:
+ * examples/indexing/indexmpeg.c:
+ * examples/seeking/.cvsignore:
+ * examples/seeking/Makefile.am:
+ * examples/seeking/cdparanoia.c:
+ * examples/seeking/cdplayer.c:
+ * examples/seeking/chained.c:
+ * examples/seeking/scrubby.c:
+ * examples/seeking/seek.c:
+ * examples/stats/Makefile.am:
+ * examples/stats/mp2ogg.c:
+ * examples/switch/.cvsignore:
+ * examples/switch/Makefile.am:
+ * examples/switch/switcher.c:
+ * tests/Makefile.am:
+ * tests/check/generic/.cvsignore:
+ * tests/check/pipelines/.cvsignore:
+ * tests/examples/Makefile.am:
+ * tests/examples/seek/Makefile.am:
+ reorganize stuff under tests/
+
2005-11-30 Edward Hervey <edward@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind):
SUBDIRS_EXT =
endif
-if BUILD_EXAMPLES
-SUBDIRS_EXAMPLES = examples
-else
-SUBDIRS_EXAMPLES =
-endif
-
SUBDIRS = \
gst-libs \
gst sys $(SUBDIRS_EXT) \
- $(SUBDIRS_EXAMPLES) \
tools \
docs \
po \
docs \
gst-libs \
gst sys ext \
- examples \
tools \
po \
common \
gst-libs/gst/rtp/Makefile
gst-libs/gst/tag/Makefile
gst-libs/gst/video/Makefile
-examples/seeking/Makefile
-examples/Makefile
tools/Makefile
pkgconfig/Makefile
pkgconfig/gstreamer-plugins-base.pc
pkgconfig/gstreamer-plugins-base-uninstalled.pc
tests/Makefile
tests/check/Makefile
+tests/examples/Makefile
+tests/examples/seek/Makefile
docs/Makefile
docs/libs/Makefile
docs/plugins/Makefile
+++ /dev/null
-if HAVE_FT2
-FT2_SUBDIRS=seeking
-else
-FT2_SUBDIRS=
-endif
-
-# if HAVE_GTK
-# GTK_SUBDIRS=dynparams $(FT2_SUBDIRS)
-# else
-GTK_SUBDIRS=
-# endif
-
-SUBDIRS=$(GTK_SUBDIRS)
-#DIST_SUBDIRS=capsfilter seeking indexing switch
-DIST_SUBDIRS=seeking
+++ /dev/null
-noinst_PROGRAMS = capsfilter1
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
+++ /dev/null
-#include <string.h>
-#include <gst/gst.h>
-
-/* This app uses a filter to connect colorspace and videosink
- * so that only RGB data can pass the connection, colorspace will use
- * a converter to convert the I420 data to RGB. Without a filter, this
- * connection would use the I420 format (assuming Xv is enabled) */
-
-static void
-new_pad_func (GstElement * element, GstPad * newpad, gpointer data)
-{
- GstElement *pipeline = (GstElement *) data;
- GstElement *queue = gst_bin_get_by_name (GST_BIN (pipeline), "queue");
-
- if (!strcmp (gst_pad_get_name (newpad), "video_00")) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_pad_link (newpad, gst_element_get_pad (queue, "sink"));
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- }
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstElement *filesrc;
- GstElement *demux;
- GstElement *thread;
- GstElement *queue;
- GstElement *mpeg2dec;
- GstElement *colorspace;
- GstElement *videosink;
- gboolean res;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <mpeg1 system stream>\n", argv[0]);
- return (-1);
- }
-
- pipeline = gst_pipeline_new ("main_pipeline");
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_return_val_if_fail (filesrc, -1);
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
- demux = gst_element_factory_make ("mpegdemux", "demux");
- g_return_val_if_fail (demux, -1);
- g_signal_connect (G_OBJECT (demux), "new_pad", G_CALLBACK (new_pad_func),
- pipeline);
-
- thread = gst_thread_new ("thread");
- queue = gst_element_factory_make ("queue", "queue");
- mpeg2dec = gst_element_factory_make ("mpeg2dec", "mpeg2dec");
- g_return_val_if_fail (mpeg2dec, -1);
- colorspace = gst_element_factory_make ("ffmpegcolorspace", "colorspace");
- g_return_val_if_fail (colorspace, -1);
- videosink = gst_element_factory_make (DEFAULT_VIDEOSINK, "videosink");
- g_return_val_if_fail (videosink, -1);
-
- gst_bin_add (GST_BIN (pipeline), filesrc);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- gst_bin_add (GST_BIN (thread), queue);
- gst_bin_add (GST_BIN (thread), mpeg2dec);
- gst_bin_add (GST_BIN (thread), colorspace);
- gst_bin_add (GST_BIN (thread), videosink);
- gst_bin_add (GST_BIN (pipeline), thread);
-
- gst_element_link_pads (filesrc, "src", demux, "sink");
- gst_element_link_pads (queue, "src", mpeg2dec, "sink");
- gst_element_link_pads (mpeg2dec, "src", colorspace, "sink");
- /* force RGB data passing between colorspace and videosink */
- res = gst_element_link_pads_filtered (colorspace, "src", videosink, "sink",
- gst_caps_new_simple ("video/x-raw-rgb", NULL));
- if (!res) {
- g_print ("could not connect colorspace and videosink\n");
- return -1;
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- while (gst_bin_iterate (GST_BIN (pipeline)));
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
+++ /dev/null
-
-plugin_LTLIBRARIES = libgstidentity2.la
-
-GOB_FILES_ID = gst-identity2.c gst-identity2.h gst-identity2-private.h
-
-BUILT_SOURCES = \
- $(GOB_FILES_ID)
-
-libgstidentity2_la_SOURCES = gst-identity2.gob $(GOB_FILES_ID)
-libgstidentity2_la_CFLAGS = $(GST_CFLAGS)
-libgstidentity2_la_LIBADD =
-
-%.c %.h %-private.h: %.gob
- gob $<
-
-CLEANFILES = $(GOB_FILES_ID)
-
-dist-hook:
- cd $(distdir); rm -f $(CLEANFILES)
+++ /dev/null
-
-%header{
-#include <gst/gst.h>
-#include "gst-identity2.h"
-#include "gst-identity2-private.h"
-%}
-
-class Gst:Identity2 from Gst:Element {
-
- /* plugin init */
- private gboolean
- plugin_init (GModule *module, GstPlugin *plugin)
- {
- static GstElementDetails identity2_details = {
- "GOB Identity",
- "Filter/Effect",
- "Does nothing",
- "1.0",
- "Wim Taymans <wim.taymans@chello.be>",
- "(C) 2001",
- };
- GstElementFactory *factory;
-
- factory = gst_elementfactory_new ("identity2", TYPE_SELF,
- &identity2_details);
- g_return_val_if_fail (factory != NULL, FALSE);
-
- gst_plugin_add_feature (plugin, &(factory->feature));
-
- return TRUE;
- }
-
- /* pads FIXME gob oculd be improved here */
- private GstPad *sinkpad =
- {
- gst_pad_new ("sink", GST_PAD_SINK);
- gst_element_add_pad (GST_ELEMENT (o), o->_priv->sinkpad);
- gst_pad_set_chain_function (o->_priv->sinkpad, chain);
- gst_pad_set_bufferpool_function (o->_priv->sinkpad, get_bufferpool);
- //gst_pad_set_negotiate_function (o->_priv->sinkpad, negotiate_sink);
- };
- private GstPad *srcpad =
- {
- gst_pad_new ("src", GST_PAD_SRC);
- gst_element_add_pad (GST_ELEMENT (o), o->_priv->srcpad);
- //gst_pad_set_negotiate_function (o->_priv->srcpad, negotiate_src);
- };
-
- /* arguments */
- /*
- private gboolean loop_based = FALSE; argument BOOL loop_based
- get {
- ARG = self->_priv->loop_based;
- }
- set {
- self->_priv->loop_based = ARG;
- if (self->_priv->loop_based) {
- gst_element_set_loop_function (GST_ELEMENT (self), loop);
- gst_pad_set_chain_function (self->_priv->sinkpad, NULL);
- }
- else {
- gst_pad_set_chain_function (self->_priv->sinkpad, chain);
- gst_element_set_loop_function (GST_ELEMENT (self), NULL);
- }
- };*/
- private guint sleep_time = 0; argument UINT sleep_time link;
- private gboolean silent = FALSE; argument BOOL silent link;
-
- /* signals */
- private signal last NONE(NONE) void handoff(self);
-
- /* core code here */
- private GstBufferPool*
- get_bufferpool (GstPad *pad (check null))
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_get_bufferpool (self->_priv->srcpad);
- }
-
- /* private GstPadNegotiateReturn
- negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_negotiate_proxy (pad, self->_priv->sinkpad, caps);
- }
-
- private GstPadNegotiateReturn
- negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
- {
- Self *self = SELF (gst_pad_get_parent (pad));
-
- return gst_pad_negotiate_proxy (pad, self->_priv->srcpad, caps);
- } */
-
- private void
- chain (GstPad *pad (check null), GstBuffer *buf (check null))
- {
- Self *self;
-
- self = SELF (gst_pad_get_parent (pad));
-
- if (!self->_priv->silent)
- g_print("identity2: chain ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(pad));
-
- handoff (self);
- gst_pad_push (self->_priv->srcpad, buf);
-
- if (self->_priv->sleep_time)
- usleep (self->_priv->sleep_time);
- }
-
- /*private void
- loop (GstElement *element (check null))
- {
- Self *self = SELF (element);
- GstBuffer *buf;
-
- do {
- buf = gst_pad_pull (self->_priv->sinkpad);
- g_print("identity2: loop ******* (%s:%s)i \n",GST_DEBUG_PAD_NAME(self->_priv->sinkpad));
-
- handoff (self);
- gst_pad_push (self->_priv->srcpad, buf);
-
- if (self->_priv->sleep_time)
- usleep (self->_priv->sleep_time);
-
- } while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
- }*/
-}
-
-%{
-GstPluginDesc plugin_desc = {
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "identity2",
- gst_identity2_plugin_init
-};
-%}
+++ /dev/null
-examples = indexmpeg
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
+++ /dev/null
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * 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 <string.h>
-#include <gst/gst.h>
-
-static gboolean verbose = FALSE;
-static gboolean quiet = FALSE;
-
-static void
-entry_added (GstIndex * index, GstIndexEntry * entry)
-{
- switch (entry->type) {
- case GST_INDEX_ENTRY_ID:
- g_print ("id %d describes writer %s\n", entry->id,
- GST_INDEX_ID_DESCRIPTION (entry));
- break;
- case GST_INDEX_ENTRY_FORMAT:
- g_print ("%d: registered format %d for %s\n", entry->id,
- GST_INDEX_FORMAT_FORMAT (entry), GST_INDEX_FORMAT_KEY (entry));
- break;
- case GST_INDEX_ENTRY_ASSOCIATION:
- {
- gint i;
-
- g_print ("%p, %d: %08x ", entry, entry->id,
- GST_INDEX_ASSOC_FLAGS (entry));
- for (i = 0; i < GST_INDEX_NASSOCS (entry); i++) {
- g_print ("%d %" G_GINT64_FORMAT " ", GST_INDEX_ASSOC_FORMAT (entry, i),
- GST_INDEX_ASSOC_VALUE (entry, i));
- }
- g_print ("\n");
- break;
- }
- default:
- break;
- }
-}
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
- GstElement *pipeline;
- GstIndex *index;
-}
-dyn_link;
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- dyn_link *link = (dyn_link *) data;
-
- if (!strcmp (gst_pad_get_name (newpad), link->padname)) {
- gst_element_set_state (link->pipeline, GST_STATE_PAUSED);
- gst_bin_add (GST_BIN (link->pipeline), link->bin);
- gst_pad_link (newpad, link->target);
- gst_element_set_index (link->bin, link->index);
- gst_element_set_state (link->pipeline, GST_STATE_PLAYING);
- }
-}
-
-static void
-setup_dynamic_linking (GstElement * pipeline,
- GstElement * element,
- const gchar * padname, GstPad * target, GstElement * bin, GstIndex * index)
-{
- dyn_link *link;
-
- link = g_new0 (dyn_link, 1);
- link->padname = g_strdup (padname);
- link->target = target;
- link->bin = bin;
- link->pipeline = pipeline;
- link->index = index;
-
- g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link),
- link);
-}
-
-static GstElement *
-make_mpeg_systems_pipeline (const gchar * path, GstIndex * index)
-{
- GstElement *pipeline;
- GstElement *src, *demux;
-
- pipeline = gst_pipeline_new ("pipeline");
-
- src = gst_element_factory_make ("filesrc", "src");
- g_object_set (G_OBJECT (src), "location", path, NULL);
-
- demux = gst_element_factory_make ("mpegdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- if (index) {
- gst_element_set_index (pipeline, index);
- }
-
- gst_element_link_pads (src, "src", demux, "sink");
-
- return pipeline;
-}
-
-static GstElement *
-make_mpeg_decoder_pipeline (const gchar * path, GstIndex * index)
-{
- GstElement *pipeline;
- GstElement *src, *demux;
- GstElement *video_bin, *audio_bin;
- GstElement *video_decoder, *audio_decoder;
-
- pipeline = gst_pipeline_new ("pipeline");
-
- src = gst_element_factory_make ("filesrc", "src");
- g_object_set (G_OBJECT (src), "location", path, NULL);
-
- demux = gst_element_factory_make ("mpegdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
-
- gst_element_link_pads (src, "src", demux, "sink");
-
- video_bin = gst_bin_new ("video_bin");
- video_decoder = gst_element_factory_make ("mpeg2dec", "video_decoder");
-
- gst_bin_add (GST_BIN (video_bin), video_decoder);
-
- setup_dynamic_linking (pipeline, demux, "video_00",
- gst_element_get_pad (video_decoder, "sink"), video_bin, index);
-
- audio_bin = gst_bin_new ("audio_bin");
- audio_decoder = gst_element_factory_make ("mad", "audio_decoder");
-
- setup_dynamic_linking (pipeline, demux, "audio_00",
- gst_element_get_pad (audio_decoder, "sink"), audio_bin, index);
-
- gst_bin_add (GST_BIN (audio_bin), audio_decoder);
-
- if (index) {
- gst_element_set_index (pipeline, index);
- }
-
- return pipeline;
-}
-
-static void
-print_progress (GstPad * pad)
-{
- gint i = 0;
- gchar status[53];
- GstFormat format;
- gboolean res;
- gint64 value;
- gint percent = 0;
-
- status[0] = '|';
-
- format = GST_FORMAT_PERCENT;
- res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &value);
- if (res) {
- percent = value / (2 * GST_FORMAT_PERCENT_SCALE);
- }
-
- for (i = 0; i < percent; i++) {
- status[i + 1] = '=';
- }
- for (i = percent; i < 50; i++) {
- status[i + 1] = ' ';
- }
- status[51] = '|';
- status[52] = 0;
-
- g_print ("%s\r", status);
-}
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GstElement *src;
- GstPad *pad;
- GstIndex *index;
- gint count = 0;
- GstEvent *event;
- gboolean res;
- GstElement *sink;
- struct poptOption options[] = {
- {"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
- "Print index entries", NULL},
- {"quiet", 'q', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &quiet, 0,
- "don't print progress bar", NULL},
- POPT_TABLEEND
- };
-
- if (!gst_init_check_with_popt_table (&argc, &argv, options) || argc < 3) {
- g_print ("usage: %s [-v] <type> <filename> \n"
- " type can be: 0 mpeg_systems\n"
- " 1 mpeg_decoder\n"
- " -v : report added index entries\n"
- " -q : don't print progress\n", argv[0]);
- return -1;
- }
-
- /* create index that elements can fill */
- index = gst_index_factory_make ("memindex");
- if (index) {
- if (verbose)
- g_signal_connect (G_OBJECT (index), "entry_added",
- G_CALLBACK (entry_added), NULL);
-
- g_object_set (G_OBJECT (index), "resolver", 1, NULL);
- }
-
- /* construct pipeline */
- switch (atoi (argv[1])) {
- case 0:
- pipeline = make_mpeg_systems_pipeline (argv[2], index);
- break;
- case 1:
- pipeline = make_mpeg_decoder_pipeline (argv[2], index);
- break;
- default:
- g_print ("unknown type %d\n", atoi (argv[1]));
- return -1;
- }
-
- /* setup some default info/error handlers */
- g_signal_connect (G_OBJECT (pipeline), "deep_notify",
- G_CALLBACK (gst_element_default_deep_notify), NULL);
- g_signal_connect (G_OBJECT (pipeline), "error",
- G_CALLBACK (gst_element_default_error), NULL);
-
- /* get a pad to perform progress reporting on */
- src = gst_bin_get_by_name (GST_BIN (pipeline), "src");
- pad = gst_element_get_pad (src, "src");
-
- /* prepare for iteration */
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- g_print ("indexing %s...\n", argv[2]);
- /* run through the complete stream to let it generate an index */
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- if (!quiet && (count % 1000 == 0)) {
- print_progress (pad);
- }
- count++;
- }
- g_print ("\n");
-
- /* bring to ready to restart the pipeline */
- gst_element_set_state (pipeline, GST_STATE_READY);
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- if (index)
- GST_OBJECT_FLAG_UNSET (index, GST_INDEX_WRITABLE);
-
- src = gst_bin_get_by_name (GST_BIN (pipeline), "video_decoder");
-
- {
- gint id;
- GstIndexEntry *entry;
- gint64 result;
- gint total_tm;
-
- gst_index_get_writer_id (index, GST_OBJECT (src), &id);
-
- entry = gst_index_get_assoc_entry (index, id, GST_INDEX_LOOKUP_BEFORE, 0,
- GST_FORMAT_TIME, G_MAXINT64);
- g_assert (entry);
- gst_index_entry_assoc_map (entry, GST_FORMAT_TIME, &result);
- total_tm = result * 60 / GST_SECOND;
- g_print ("total time = %.2fs\n", total_tm / 60.0);
- }
-
- pad = gst_element_get_pad (src, "src");
- sink = gst_element_factory_make ("fakesink", "sink");
- gst_element_link_pads (src, "src", sink, "sink");
- gst_bin_add (GST_BIN (pipeline), sink);
-
- g_print ("seeking %s...\n", argv[2]);
- event = gst_event_new_seek (GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 5 * GST_SECOND);
-
- res = gst_pad_send_event (pad, event);
- if (!res) {
- g_warning ("seek failed");
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- count = 0;
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- if (!quiet && (count % 1000 == 0)) {
- print_progress (pad);
- }
- count++;
- }
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 1;
-}
+++ /dev/null
-cdparanoia
-cdplayer
-seek
-spider_seek
-vorbisfile
-
+++ /dev/null
-examples = seek scrubby #cdplayer cdparanoia
-
-noinst_PROGRAMS = $(examples)
-
-# we have nothing but apps here, we can do this safely
-LIBS = $(GST_LIBS) $(GTK_LIBS)
-AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static void
-get_position_info (GstElement * cdparanoia)
-{
- GstFormat track_format;
- const GstFormat *formats;
- GstPad *pad;
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- formats = gst_pad_get_formats (pad);
-
- while (*formats) {
- const GstFormatDefinition *definition;
- GstFormat format;
- gint64 position;
- gboolean res;
-
- definition = gst_format_get_details (*formats);
-
- format = *formats;
- res = gst_pad_query (pad, GST_QUERY_POSITION, &format, &position);
-
- if (format == GST_FORMAT_TIME) {
- position /= GST_SECOND;
- g_print ("%s: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT,
- definition->nick, position / 60, position % 60);
- } else {
- g_print ("%s: %" G_GINT64_FORMAT, definition->nick, position);
- }
-
- formats++;
- if (*formats) {
- g_print (", ");
- }
- }
- g_print ("\r");
-}
-
-static void
-get_track_info (GstElement * cdparanoia)
-{
- GstFormat track_format;
- gint64 total_tracks = 0, total_time = 0;
- GstPad *pad;
- const GstFormat *formats;
- gint i;
- gint64 time_count = 0;
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- formats = gst_pad_get_formats (pad);
-
- /* we loop over all supported formats and report the total
- * number of them */
- while (*formats) {
- const GstFormatDefinition *definition;
- gint64 total;
- GstFormat format;
- gboolean res;
-
- definition = gst_format_get_details (*formats);
-
- format = *formats;
- res = gst_pad_query (pad, GST_QUERY_TOTAL, &format, &total);
- if (res) {
- if (format == GST_FORMAT_TIME) {
- total /= GST_SECOND;
- g_print ("%s total: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
- definition->nick, total / 60, total % 60);
- } else
- g_print ("%s total: %" G_GINT64_FORMAT "\n", definition->nick, total);
-
- if (format == track_format)
- total_tracks = total;
- else if (format == GST_FORMAT_TIME)
- total_time = total;
- } else
- g_print ("failed to get %s total\n", definition->nick);
-
- formats++;
- }
-
- /* then we loop over all the tracks to get more info.
- * since pad_convert always works from 0, the time from track 1 needs
- * to be substracted from track 2 */
- for (i = 0; i <= total_tracks; i++) {
- gint64 time;
- gboolean res;
-
- if (i < total_tracks) {
- GstFormat format;
-
- format = GST_FORMAT_TIME;
- res = gst_pad_convert (pad, track_format, i, &format, &time);
- time /= GST_SECOND;
- } else {
- time = total_time;
- res = TRUE;
- }
-
- if (res) {
- /* for the first track (i==0) we wait until we have the
- * time of the next track */
- if (i > 0) {
- gint64 length = time - time_count;
-
- g_print ("track %d: %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT
- " -> %" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ", length: %"
- G_GINT64_FORMAT ":%02" G_GINT64_FORMAT "\n",
- i - 1,
- time_count / 60, time_count % 60,
- time / 60, time % 60, length / 60, length % 60);
- }
- } else {
- g_print ("could not get time for track %d\n", i);
- }
-
- time_count = time;
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipeline;
- GstElement *cdparanoia;
- GstElement *audiosink;
- GstPad *pad;
- GstFormat track_format;
- GstEvent *event;
- gint count;
- gboolean res;
-
- gst_init (&argc, &argv);
-
- pipeline = gst_pipeline_new ("pipeline");
-
- cdparanoia = gst_element_factory_make ("cdparanoia", "cdparanoia");
- g_assert (cdparanoia);
- g_object_set (G_OBJECT (cdparanoia), "paranoia_mode", 0, NULL);
-
- audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
- g_assert (audiosink);
-
- gst_bin_add (GST_BIN (pipeline), cdparanoia);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link_pads (cdparanoia, "src", audiosink, "sink");
-
- g_signal_connect (G_OBJECT (pipeline), "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- /* now we go into probe mode */
- get_track_info (cdparanoia);
-
- track_format = gst_format_get_by_nick ("track");
- g_assert (track_format != 0);
-
- pad = gst_element_get_pad (cdparanoia, "src");
- g_assert (pad);
-
- g_print ("playing from track 3\n");
- /* seek to track3 */
- event = gst_event_new_seek (track_format |
- GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, 3);
-
- res = gst_pad_send_event (pad, event);
- if (!res)
- g_warning ("seek failed");
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- count = 0;
- while (count++ < 500) {
- get_position_info (cdparanoia);
- g_usleep (G_USEC_PER_SEC / 2);
- }
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- g_print ("\nplaying from second 25 to second 29\n");
- /* seek to some seconds */
- event = gst_event_new_segment_seek (GST_FORMAT_TIME |
- GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH, 25 * GST_SECOND, 29 * GST_SECOND);
- res = gst_pad_send_event (pad, event);
- if (!res)
- g_warning ("seek failed");
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- count = 0;
- while (count++ < 500) {
- get_position_info (cdparanoia);
- g_usleep (G_USEC_PER_SEC / 2);
- }
- g_print ("\n");
-
- /* shutdown everything again */
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
+++ /dev/null
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GList *seekable_elements = NULL;
-
-static GstElement *pipeline;
-static GtkAdjustment *adjustment;
-static gboolean stats = FALSE;
-static guint64 duration;
-
-static guint update_id;
-
-#define UPDATE_INTERVAL 500
-
-static GstElement *
-make_cdaudio_pipeline (void)
-{
- GstElement *cdaudio;
-
- cdaudio = gst_element_factory_make ("cdaudio", "cdaudio");
- g_assert (cdaudio != NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, cdaudio);
-
- return cdaudio;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / 100;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / 100);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-typedef struct
-{
- const gchar *name;
- const GstFormat format;
-}
-seek_format;
-
-static seek_format seek_formats[] = {
- {"tim", GST_FORMAT_TIME},
- {"byt", GST_FORMAT_BYTES},
- {"buf", GST_FORMAT_BUFFERS},
- {"def", GST_FORMAT_DEFAULT},
- {NULL, 0},
-};
-
-
-G_GNUC_UNUSED static void
-query_durations ()
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("durations %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gboolean res;
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
- res = gst_element_query (element, GST_QUERY_TOTAL, &format, &value);
- if (res) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions ()
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gboolean res;
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
- res = gst_element_query (element, GST_QUERY_POSITION, &format, &value);
- if (res) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
- walk = g_list_next (walk);
- }
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstClock *clock;
- guint64 position = 0;
- GstFormat format = GST_FORMAT_TIME;
-
- duration = 0;
- clock = gst_pipeline_get_clock (GST_PIPELINE (pipeline));
-
- if (seekable_elements) {
- GstElement *element = GST_ELEMENT (seekable_elements->data);
-
- gst_element_query (element, GST_QUERY_TOTAL, &format, &duration);
- gst_element_query (element, GST_QUERY_POSITION, &format, &position);
- }
-
- if (stats) {
- if (clock)
- g_print ("clock: %13" G_GUINT64_FORMAT " (%s)\n",
- position, gst_object_get_name (GST_OBJECT (clock)));
- query_durations ();
- query_positions ();
- }
- if (duration > 0) {
- gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
- }
-
- return TRUE;
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gtk_timeout_remove (update_id);
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- gint64 real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
- gboolean res;
- GstEvent *s_event;
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *seekable = GST_ELEMENT (walk->data);
-
- g_print ("seek to %" G_GINT64_FORMAT " on element %s\n", real,
- GST_ELEMENT_NAME (seekable));
- s_event =
- gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
- GST_SEEK_FLAG_FLUSH, real);
-
- res = gst_element_send_event (seekable, s_event);
-
- walk = g_list_next (walk);
- }
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PLAYING) {
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- gtk_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PAUSED) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gtk_timeout_remove (update_id);
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_READY) {
- gst_element_set_state (pipeline, GST_STATE_READY);
- gtk_timeout_remove (update_id);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox,
- *play_button, *pause_button, *stop_button, *hscale;
- struct poptOption options[] = {
- {"stats", 's', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &stats, 0,
- "Show element stats", NULL},
- POPT_TABLEEND
- };
-
- gst_init_with_popt_table (&argc, &argv, options);
- gtk_init (&argc, &argv);
-
- pipeline = make_cdaudio_pipeline ();
-
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- play_button = gtk_button_new_with_label ("play");
- pause_button = gtk_button_new_with_label ("pause");
- stop_button = gtk_button_new_with_label ("stop");
-
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_press_event", G_CALLBACK (start_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_release_event", G_CALLBACK (stop_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "format_value", G_CALLBACK (format_value), pipeline);
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- gtk_main ();
-
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
+++ /dev/null
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-#include <stdlib.h>
-#include <gst/gst.h>
-#include <string.h>
-
-static GstElement *bin;
-
-static void
-unlinked (GstPad * pad, GstPad * peerpad, GstElement * pipeline)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_bin_remove (GST_BIN (pipeline), bin);
- gst_element_set_state (bin, GST_STATE_READY);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-static void
-new_pad (GstElement * elem, GstPad * newpad, GstElement * pipeline)
-{
- GstScheduler *sched;
- GstClock *clock;
-
- g_print ("new pad %s\n", gst_pad_get_name (newpad));
-
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_bin_add (GST_BIN (pipeline), bin);
-
- sched = gst_element_get_scheduler (GST_ELEMENT (pipeline));
- clock = gst_scheduler_get_clock (sched);
- gst_scheduler_set_clock (sched, clock);
-
- gst_pad_link (newpad, gst_element_get_pad (bin, "sink"));
-
- g_signal_connect (G_OBJECT (newpad), "unlinked", G_CALLBACK (unlinked),
- pipeline);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char **argv)
-{
- GstElement *pipeline;
- GstElement *filesrc;
- GstElement *oggdemux;
- GstElement *vorbisdec;
- GstElement *audioconvert;
- GstElement *audiosink;
-
- gst_init (&argc, &argv);
-
- if (argc < 2) {
- g_print ("usage: %s <oggfile>\n", argv[0]);
- return (-1);
- }
-
- pipeline = gst_pipeline_new ("pipeline");
-
- filesrc = gst_element_factory_make ("filesrc", "filesrc");
- g_assert (filesrc);
- g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
-
- oggdemux = gst_element_factory_make ("oggdemux", "oggdemux");
- g_assert (oggdemux);
-
- gst_bin_add (GST_BIN (pipeline), filesrc);
- gst_bin_add (GST_BIN (pipeline), oggdemux);
-
- gst_element_link_pads (filesrc, "src", oggdemux, "sink");
-
- g_signal_connect (G_OBJECT (oggdemux), "new_pad", G_CALLBACK (new_pad),
- pipeline);
-
- bin = gst_bin_new ("bin");
- vorbisdec = gst_element_factory_make ("vorbisdec", "vorbisdec");
- g_assert (vorbisdec);
- audioconvert = gst_element_factory_make ("audioconvert", "audioconvert");
- g_assert (audioconvert);
- audiosink = gst_element_factory_make (DEFAULT_AUDIOSINK, DEFAULT_AUDIOSINK);
- g_assert (audiosink);
- gst_bin_add (GST_BIN (bin), vorbisdec);
- gst_bin_add (GST_BIN (bin), audioconvert);
- gst_bin_add (GST_BIN (bin), audiosink);
-
- gst_element_link_pads (vorbisdec, "src", audioconvert, "sink");
- gst_element_link_pads (audioconvert, "src", audiosink, "sink");
-
- gst_element_add_ghost_pad (bin, gst_element_get_pad (vorbisdec, "sink"),
- "sink");
-
- g_object_ref (G_OBJECT (bin));
-
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_element_default_deep_notify), NULL);
-
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- while (gst_bin_iterate (GST_BIN (pipeline)))
- /* nop */ ;
-
- /* stop probe */
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- return 0;
-}
+++ /dev/null
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY (scrubby_debug);
-#define GST_CAT_DEFAULT (scrubby_debug)
-
-static GstElement *pipeline;
-static gint64 position;
-static gint64 duration;
-static GtkAdjustment *adjustment;
-static GtkWidget *hscale;
-static GtkAdjustment *sadjustment;
-static GtkWidget *shscale;
-static gboolean verbose = FALSE;
-
-static guint bus_watch = 0;
-static guint update_id = 0;
-static guint changed_id = 0;
-static guint schanged_id = 0;
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
-#define ASINK "alsasink"
-//#define ASINK "osssink"
-#define VSINK "xvimagesink"
-//#define VSINK "ximagesink"
-//#define VSINK "aasink"
-//#define VSINK "cacasink"
-
-#define RANGE_PREC 10000
-#define SEGMENT_LEN 100
-#define UPDATE_INTERVAL 500
-
-gdouble prev_range = -1.0;
-GstClockTime prev_time = -1;
-gdouble cur_range;
-GstClockTime cur_time;
-GstClockTimeDiff diff;
-gdouble cur_speed = 1.0;
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
-}
-dyn_link;
-
-static GstElement *
-gst_element_factory_make_or_warn (gchar * type, gchar * name)
-{
- GstElement *element = gst_element_factory_make (type, name);
-
- if (!element) {
- g_warning ("Failed to create element %s of type %s", name, type);
- }
-
- return element;
-}
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- dyn_link *connect = (dyn_link *) data;
-
- if (connect->padname == NULL ||
- !strcmp (gst_pad_get_name (newpad), connect->padname)) {
- if (connect->bin)
- gst_bin_add (GST_BIN (pipeline), connect->bin);
- gst_pad_link (newpad, connect->target);
- }
-}
-
-static void
-setup_dynamic_link (GstElement * element, const gchar * padname,
- GstPad * target, GstElement * bin)
-{
- dyn_link *connect;
-
- connect = g_new0 (dyn_link, 1);
- connect->padname = g_strdup (padname);
- connect->target = target;
- connect->bin = bin;
-
- g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
- connect);
-}
-
-static GstElement *
-make_wav_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
-
- setup_dynamic_link (decoder, "src", gst_element_get_pad (audiosink, "sink"),
- NULL);
-
- return pipeline;
-}
-
-static GstElement *
-make_playerbin_pipeline (const gchar * location)
-{
- GstElement *player;
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- g_object_set (G_OBJECT (player), "uri", location, NULL);
-
- return player;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / RANGE_PREC;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / RANGE_PREC);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstFormat format;
-
- position = 0;
- duration = 0;
-
- format = GST_FORMAT_TIME;
-
- gst_element_query_position (pipeline, &format, &position);
- gst_element_query_duration (pipeline, &format, &duration);
-
- if (position >= duration)
- duration = position;
-
- if (duration > 0) {
- gtk_adjustment_set_value (adjustment,
- position * (gdouble) RANGE_PREC / duration);
- gtk_widget_queue_draw (hscale);
- }
-
- return TRUE;
-}
-
-static void
-speed_cb (GtkWidget * widget)
-{
- GstEvent *s_event;
- gboolean res;
-
- GST_DEBUG ("speed change");
- cur_speed = gtk_range_get_value (GTK_RANGE (widget));
-
- s_event = gst_event_new_seek (cur_speed,
- GST_FORMAT_TIME, 0, GST_SEEK_TYPE_NONE, -1, GST_SEEK_TYPE_NONE, -1);
-
- res = gst_element_send_event (pipeline, s_event);
- if (!res)
- g_print ("speed change failed\n");
-}
-
-static gboolean do_seek (GtkWidget * widget, gboolean flush, gboolean segment);
-
-static void
-seek_cb (GtkWidget * widget)
-{
- if (changed_id) {
- GST_DEBUG ("seek because of slider move");
-
- if (do_seek (widget, TRUE, TRUE)) {
- g_source_remove (changed_id);
- changed_id = 0;
- }
- }
-}
-
-static gboolean
-do_seek (GtkWidget * widget, gboolean flush, gboolean segment)
-{
- gint64 start, stop;
- gboolean res = FALSE;
- GstEvent *s_event;
- gdouble rate;
- GTimeVal tv;
- gboolean valid;
- gdouble new_range;
-
- if (segment)
- new_range = gtk_range_get_value (GTK_RANGE (widget));
- else {
- new_range = (gdouble) RANGE_PREC;
- cur_time = -1;
- }
-
- valid = prev_time != -1;
-
- GST_DEBUG ("flush %d, segment %d, valid %d", flush, segment, valid);
-
- if (new_range == cur_range)
- return FALSE;
-
- prev_time = cur_time;
- prev_range = cur_range;
-
- cur_range = new_range;
-
- g_get_current_time (&tv);
- cur_time = GST_TIMEVAL_TO_TIME (tv);
-
- if (!valid)
- return FALSE;
-
- GST_DEBUG ("cur: %lf, %" GST_TIME_FORMAT, cur_range,
- GST_TIME_ARGS (cur_time));
- GST_DEBUG ("prev: %lf, %" GST_TIME_FORMAT, prev_range,
- GST_TIME_ARGS (prev_time));
-
- diff = cur_time - prev_time;
-
- GST_DEBUG ("diff: %" GST_TIME_FORMAT, GST_TIME_ARGS (diff));
-
- start = prev_range * duration / RANGE_PREC;
- /* play 50 milliseconds */
- stop = segment ? cur_range * duration / RANGE_PREC : duration;
-
- if (start == stop)
- return FALSE;
-
- if (segment)
- rate = (stop - start) / (gdouble) diff;
- else
- rate = cur_speed;
-
- if (start > stop) {
- gint64 tmp;
-
- tmp = start;
- start = stop;
- stop = tmp;
- }
-
-
- GST_DEBUG ("seek to %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", rate %lf"
- " on element %s",
- GST_TIME_ARGS (start), GST_TIME_ARGS (stop), rate,
- GST_ELEMENT_NAME (pipeline));
-
- s_event = gst_event_new_seek (rate,
- GST_FORMAT_TIME,
- (flush ? GST_SEEK_FLAG_FLUSH : 0) |
- (segment ? GST_SEEK_FLAG_SEGMENT : 0),
- GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_SET, stop);
-
- res = gst_element_send_event (pipeline, s_event);
- if (!res)
- g_print ("seek failed\n");
-
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
-
- return TRUE;
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- if (update_id) {
- g_source_remove (update_id);
- update_id = 0;
- }
-
- if (changed_id == 0) {
- changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
- "value_changed", G_CALLBACK (seek_cb), pipeline);
- }
-
- GST_DEBUG ("start seek");
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, gpointer user_data)
-{
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
-
- GST_DEBUG ("stop seek");
-
- if (changed_id) {
- g_source_remove (changed_id);
- changed_id = 0;
- }
-
- do_seek (hscale, FALSE, FALSE);
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PLAYING) {
- g_print ("PLAY pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE);
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_PAUSED) {
- g_print ("PAUSE pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- g_source_remove (update_id);
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- GstState state;
-
- gst_element_get_state (pipeline, &state, NULL, GST_CLOCK_TIME_NONE);
- if (state != GST_STATE_READY) {
- g_print ("READY pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- gst_element_set_state (pipeline, GST_STATE_READY);
- gtk_adjustment_set_value (adjustment, 0.0);
- g_source_remove (update_id);
- }
-}
-
-static void
-print_message (GstMessage * message)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("Got Message from element \"%s\"\n",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
-
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- }
-}
-
-static gboolean
-bus_message (GstBus * bus, GstMessage * message, gpointer data)
-{
- switch (GST_MESSAGE_TYPE (message)) {
- case GST_MESSAGE_EOS:
- g_print ("EOS\n");
- break;
- case GST_MESSAGE_ERROR:
- case GST_MESSAGE_WARNING:
- print_message (message);
- break;
- case GST_MESSAGE_SEGMENT_START:
- break;
- case GST_MESSAGE_SEGMENT_DONE:
- GST_DEBUG ("segment_done, doing next seek");
- if (!do_seek (hscale, FALSE, update_id == 0)) {
- if (changed_id == 0) {
- changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
- "value_changed", G_CALLBACK (seek_cb), pipeline);
- }
- }
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-
-typedef struct
-{
- gchar *name;
- GstElement *(*func) (const gchar * location);
-}
-Pipeline;
-
-static Pipeline pipelines[] = {
- {"wav", make_wav_pipeline},
- {"playerbin", make_playerbin_pipeline},
- {NULL, NULL},
-};
-
-#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
-
-static void
-print_usage (int argc, char **argv)
-{
- gint i;
-
- g_print ("usage: %s <type> <filename>\n", argv[0]);
- g_print (" possible types:\n");
-
- for (i = 0; i < NUM_TYPES; i++) {
- g_print (" %d = %s\n", i, pipelines[i].name);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
- GstBus *bus;
- GOptionEntry options[] = {
- {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
- "Verbose properties", NULL},
- {NULL}
- };
- gint type;
- GOptionContext *ctx;
- GError *err = NULL;
-
- ctx = g_option_context_new ("seek");
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
-
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", err->message);
- exit (1);
- }
-
- GST_DEBUG_CATEGORY_INIT (scrubby_debug, "scrubby", 0, "scrubby example");
-
- gtk_init (&argc, &argv);
-
- if (argc != 3) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- type = atoi (argv[1]);
-
- if (type < 0 || type >= NUM_TYPES) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- pipeline = pipelines[type].func (argv[2]);
- g_assert (pipeline);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- play_button = gtk_button_new_with_label ("play");
- pause_button = gtk_button_new_with_label ("pause");
- stop_button = gtk_button_new_with_label ("stop");
-
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, (gdouble) RANGE_PREC, 0.1,
- 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- sadjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (1.0, 0.0, 5.0, 0.1, 1.0, 1.0));
- shscale = gtk_hscale_new (sadjustment);
- gtk_scale_set_digits (GTK_SCALE (shscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (shscale), GTK_UPDATE_CONTINUOUS);
-
- schanged_id = gtk_signal_connect (GTK_OBJECT (shscale),
- "value_changed", G_CALLBACK (speed_cb), pipeline);
-
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_press_event", G_CALLBACK (start_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_release_event", G_CALLBACK (stop_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "format_value", G_CALLBACK (format_value), pipeline);
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 96, 96);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), shscale, TRUE, TRUE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- if (verbose) {
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
- }
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- g_assert (bus);
-
- bus_watch = gst_bus_add_watch_full (bus,
- G_PRIORITY_LOW, bus_message, pipeline, NULL);
-
- gtk_main ();
-
- g_print ("NULL pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- g_print ("free pipeline\n");
- gst_object_unref (pipeline);
-
- return 0;
-}
+++ /dev/null
-#include <stdlib.h>
-#include <glib.h>
-#include <gtk/gtk.h>
-#include <gst/gst.h>
-#include <string.h>
-
-GST_DEBUG_CATEGORY (seek_debug);
-#define GST_CAT_DEFAULT (seek_debug)
-
-static GList *seekable_pads = NULL;
-static GList *rate_pads = NULL;
-static GList *seekable_elements = NULL;
-
-static gboolean accurate_seek = FALSE;
-static gboolean keyframe_seek = FALSE;
-static gboolean loop_seek = FALSE;
-
-static GstElement *pipeline;
-static gint64 position;
-static gint64 duration;
-static GtkAdjustment *adjustment;
-static GtkWidget *hscale;
-static gboolean stats = FALSE;
-static gboolean elem_seek = FALSE;
-static gboolean verbose = FALSE;
-
-static GstState state;
-static guint update_id = 0;
-static guint seek_timeout_id = 0;
-static gulong changed_id;
-
-//#define SOURCE "filesrc"
-#define SOURCE "gnomevfssrc"
-#define ASINK "alsasink"
-//#define ASINK "osssink"
-#define VSINK "xvimagesink"
-//#define VSINK "sdlvideosink"
-//#define VSINK "ximagesink"
-//#define VSINK "aasink"
-//#define VSINK "cacasink"
-
-//#define UPDATE_INTERVAL 500
-#define UPDATE_INTERVAL 100
-
-/* number of milliseconds to play for after a seek */
-//#define SCRUB_TIME 250
-//#define SCRUB
-
-#define THREAD
-#define PAD_SEEK
-
-typedef struct
-{
- const gchar *padname;
- GstPad *target;
- GstElement *bin;
-}
-dyn_link;
-
-static GstElement *
-gst_element_factory_make_or_warn (gchar * type, gchar * name)
-{
- GstElement *element = gst_element_factory_make (type, name);
-
- if (!element) {
- g_warning ("Failed to create element %s of type %s", name, type);
- }
-
- return element;
-}
-
-static void
-dynamic_link (GstPadTemplate * templ, GstPad * newpad, gpointer data)
-{
- gchar *padname;
- dyn_link *connect = (dyn_link *) data;
-
- padname = gst_pad_get_name (newpad);
-
- if (connect->padname == NULL || !strcmp (padname, connect->padname)) {
- if (connect->bin)
- gst_bin_add (GST_BIN (pipeline), connect->bin);
- gst_pad_link (newpad, connect->target);
-
- //seekable_pads = g_list_prepend (seekable_pads, newpad);
- rate_pads = g_list_prepend (rate_pads, newpad);
- }
- g_free (padname);
-}
-
-static void
-setup_dynamic_link (GstElement * element, const gchar * padname,
- GstPad * target, GstElement * bin)
-{
- dyn_link *connect;
-
- connect = g_new0 (dyn_link, 1);
- connect->padname = g_strdup (padname);
- connect->target = target;
- connect->bin = bin;
-
- g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
- connect);
-}
-
-static GstElement *
-make_mod_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("modplug", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_dv_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *demux, *decoder, *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("dvdemux", "demuxer");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- decoder = gst_element_factory_make_or_warn ("ffdec_dvvideo", "decoder");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn ("alsasink", "a_sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (pipeline), a_queue);
- gst_bin_add (GST_BIN (pipeline), audiosink);
- gst_bin_add (GST_BIN (pipeline), v_queue);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), videosink);
-
- gst_element_link (src, demux);
- gst_element_link (a_queue, audiosink);
- gst_element_link (v_queue, decoder);
- gst_element_link (decoder, videosink);
-
- setup_dynamic_link (demux, "video", gst_element_get_pad (v_queue, "sink"),
- NULL);
- setup_dynamic_link (demux, "audio", gst_element_get_pad (a_queue, "sink"),
- NULL);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
-
- return pipeline;
-}
-
-static GstElement *
-make_wav_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("wavparse", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
-
- setup_dynamic_link (decoder, "src", gst_element_get_pad (audiosink, "sink"),
- NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, audiosink);
-
- /* force element seeking on this pipeline */
- elem_seek = TRUE;
-
- return pipeline;
-}
-
-static GstElement *
-make_flac_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("flacdec", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_sid_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *audiosink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("siddec", "decoder");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- //g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), audiosink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, audiosink);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_parse_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *parser, *fakesink;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- parser = gst_element_factory_make_or_warn ("mpegparse", "parse");
- fakesink = gst_element_factory_make_or_warn ("fakesink", "sink");
- g_object_set (G_OBJECT (fakesink), "silent", TRUE, NULL);
- g_object_set (G_OBJECT (fakesink), "sync", TRUE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), parser);
- gst_bin_add (GST_BIN (pipeline), fakesink);
-
- gst_element_link (src, parser);
- gst_element_link (parser, fakesink);
-
- seekable = gst_element_get_pad (parser, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (parser, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_vorbis_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin;
- GstElement *src, *demux, *decoder, *convert, *audiosink;
- GstPad *pad, *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
- decoder = gst_element_factory_make_or_warn ("vorbisdec", "decoder");
- convert = gst_element_factory_make_or_warn ("audioconvert", "convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "sink");
- g_object_set (G_OBJECT (audiosink), "sync", TRUE, NULL);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (audio_bin), decoder);
- gst_bin_add (GST_BIN (audio_bin), convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- gst_element_link (src, demux);
- gst_element_link (decoder, convert);
- gst_element_link (convert, audiosink);
-
- pad = gst_element_get_pad (decoder, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
- NULL);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_theora_pipeline (const gchar * location)
-{
- GstElement *pipeline, *video_bin;
- GstElement *src, *demux, *decoder, *convert, *videosink;
- GstPad *pad, *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
- decoder = gst_element_factory_make_or_warn ("theoradec", "decoder");
- convert = gst_element_factory_make_or_warn ("ffmpegcolorspace", "convert");
- videosink = gst_element_factory_make_or_warn (VSINK, "sink");
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_bin_add (GST_BIN (video_bin), decoder);
- gst_bin_add (GST_BIN (video_bin), convert);
- gst_bin_add (GST_BIN (video_bin), videosink);
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- gst_element_link (src, demux);
- gst_element_link (decoder, convert);
- gst_element_link (convert, videosink);
-
- pad = gst_element_get_pad (decoder, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
- NULL);
-
- seekable = gst_element_get_pad (decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_vorbis_theora_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue, *v_scale;
- GstPad *seekable;
- GstPad *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("oggdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- a_decoder = gst_element_factory_make_or_warn ("vorbisdec", "a_dec");
- a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_queue, a_decoder);
- gst_element_link (a_decoder, a_convert);
- gst_element_link (a_convert, audiosink);
-
- pad = gst_element_get_pad (a_queue, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
- NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_decoder = gst_element_factory_make_or_warn ("theoradec", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
- v_scale = gst_element_factory_make_or_warn ("videoscale", "v_scale");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_convert);
- gst_bin_add (GST_BIN (video_bin), v_scale);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link_many (v_queue, v_decoder, v_convert, v_scale, videosink,
- NULL);
-
- pad = gst_element_get_pad (v_queue, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
- NULL);
-
- seekable = gst_element_get_pad (a_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_avi_msmpeg4v3_mp3_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *a_convert, *v_decoder, *v_convert;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable, *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("avidemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_convert = gst_element_factory_make_or_warn ("audioconvert", "a_convert");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
-
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_convert);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_queue, a_decoder);
- gst_element_link (a_decoder, a_convert);
- gst_element_link (a_convert, audiosink);
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- pad = gst_element_get_pad (a_queue, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (audio_bin, "sink"),
- NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_decoder = gst_element_factory_make_or_warn ("ffdec_msmpeg4", "v_dec");
- v_convert =
- gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_convert");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_convert);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link_many (v_queue, v_decoder, v_convert, videosink, NULL);
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- pad = gst_element_get_pad (v_queue, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, NULL, gst_element_get_pad (video_bin, "sink"),
- NULL);
-
- seekable = gst_element_get_pad (a_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mp3_pipeline (const gchar * location)
-{
- GstElement *pipeline;
- GstElement *src, *decoder, *osssink, *queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- decoder = gst_element_factory_make_or_warn ("mad", "dec");
- queue = gst_element_factory_make_or_warn ("queue", "queue");
- osssink = gst_element_factory_make_or_warn (ASINK, "sink");
-
- seekable_elements = g_list_prepend (seekable_elements, osssink);
-
- g_object_set (G_OBJECT (src), "location", location, NULL);
- //g_object_set (G_OBJECT (osssink), "fragment", 0x00180008, NULL);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), decoder);
- gst_bin_add (GST_BIN (pipeline), queue);
- gst_bin_add (GST_BIN (pipeline), osssink);
-
- gst_element_link (src, decoder);
- gst_element_link (decoder, queue);
- gst_element_link (queue, osssink);
-
- seekable = gst_element_get_pad (queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_avi_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *audiosink, *videosink;
- GstElement *a_queue = NULL, *v_queue = NULL;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("avidemux", "demux");
- seekable_elements = g_list_prepend (seekable_elements, demux);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
- gst_element_set_state (audio_bin, GST_STATE_PAUSED);
-
- setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
- "sink"), audio_bin);
-
- seekable = gst_element_get_pad (a_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("ffmpegdecall", "v_dec");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- gst_element_link (v_decoder, v_queue);
- gst_element_link (v_queue, videosink);
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_set_state (video_bin, GST_STATE_PAUSED);
-
- setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
- "sink"), video_bin);
-
- seekable = gst_element_get_pad (v_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mpeg_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
- GstElement *audiosink, *videosink;
- GstElement *a_queue, *v_queue;
- GstPad *seekable;
- GstPad *pad;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- //demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
- demux = gst_element_factory_make_or_warn ("flupsdemux", "demux");
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
-
- gst_bin_add (GST_BIN (pipeline), audio_bin);
-
- pad = gst_element_get_pad (a_decoder, "sink");
- gst_element_add_pad (audio_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, "audio_c0", gst_element_get_pad (audio_bin,
- "sink"), NULL);
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
- v_queue = gst_element_factory_make_or_warn ("queue", "v_queue");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
-
- gst_bin_add (GST_BIN (video_bin), v_decoder);
- gst_bin_add (GST_BIN (video_bin), v_queue);
- gst_bin_add (GST_BIN (video_bin), v_filter);
- gst_bin_add (GST_BIN (video_bin), videosink);
-
- gst_element_link (v_decoder, v_queue);
- gst_element_link (v_queue, v_filter);
- gst_element_link (v_filter, videosink);
-
- gst_bin_add (GST_BIN (pipeline), video_bin);
-
- pad = gst_element_get_pad (v_decoder, "sink");
- gst_element_add_pad (video_bin, gst_ghost_pad_new ("sink", pad));
- gst_object_unref (pad);
-
- setup_dynamic_link (demux, "video_e0", gst_element_get_pad (video_bin,
- "sink"), NULL);
-
- seekable = gst_element_get_pad (v_filter, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_mpegnt_pipeline (const gchar * location)
-{
- GstElement *pipeline, *audio_bin, *video_bin;
- GstElement *src, *demux, *a_decoder, *v_decoder, *v_filter;
- GstElement *audiosink, *videosink;
- GstElement *a_queue;
- GstPad *seekable;
-
- pipeline = gst_pipeline_new ("app");
-
- src = gst_element_factory_make_or_warn (SOURCE, "src");
- g_object_set (G_OBJECT (src), "location", location, NULL);
-
- demux = gst_element_factory_make_or_warn ("mpegdemux", "demux");
- //g_object_set (G_OBJECT (demux), "sync", TRUE, NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, demux);
-
- gst_bin_add (GST_BIN (pipeline), src);
- gst_bin_add (GST_BIN (pipeline), demux);
- gst_element_link (src, demux);
-
- audio_bin = gst_bin_new ("a_decoder_bin");
- a_decoder = gst_element_factory_make_or_warn ("mad", "a_dec");
- a_queue = gst_element_factory_make_or_warn ("queue", "a_queue");
- audiosink = gst_element_factory_make_or_warn (ASINK, "a_sink");
- //g_object_set (G_OBJECT (audiosink), "fragment", 0x00180008, NULL);
- g_object_set (G_OBJECT (audiosink), "sync", FALSE, NULL);
- gst_element_link (a_decoder, a_queue);
- gst_element_link (a_queue, audiosink);
- gst_bin_add (GST_BIN (audio_bin), a_decoder);
- gst_bin_add (GST_BIN (audio_bin), a_queue);
- gst_bin_add (GST_BIN (audio_bin), audiosink);
-
- setup_dynamic_link (demux, "audio_00", gst_element_get_pad (a_decoder,
- "sink"), audio_bin);
-
- seekable = gst_element_get_pad (a_queue, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (a_decoder, "sink"));
-
- video_bin = gst_bin_new ("v_decoder_bin");
- v_decoder = gst_element_factory_make_or_warn ("mpeg2dec", "v_dec");
- v_filter = gst_element_factory_make_or_warn ("ffmpegcolorspace", "v_filter");
- videosink = gst_element_factory_make_or_warn (VSINK, "v_sink");
- gst_element_link_many (v_decoder, v_filter, videosink, NULL);
-
- gst_bin_add_many (GST_BIN (video_bin), v_decoder, v_filter, videosink, NULL);
-
- setup_dynamic_link (demux, "video_00", gst_element_get_pad (v_decoder,
- "sink"), video_bin);
-
- seekable = gst_element_get_pad (v_decoder, "src");
- seekable_pads = g_list_prepend (seekable_pads, seekable);
- rate_pads = g_list_prepend (rate_pads, seekable);
- rate_pads =
- g_list_prepend (rate_pads, gst_element_get_pad (v_decoder, "sink"));
-
- return pipeline;
-}
-
-static GstElement *
-make_playerbin_pipeline (const gchar * location)
-{
- GstElement *player;
-
- player = gst_element_factory_make ("playbin", "player");
- g_assert (player);
-
- g_object_set (G_OBJECT (player), "uri", location, NULL);
-
- seekable_elements = g_list_prepend (seekable_elements, player);
-
- /* force element seeking on this pipeline */
- elem_seek = TRUE;
-
- return player;
-}
-
-static GstElement *
-make_parselaunch_pipeline (const gchar * description)
-{
- GstElement *pipeline;
- GError *error;
-
- pipeline = gst_parse_launch (description, &error);
-
- seekable_elements = g_list_prepend (seekable_elements, pipeline);
-
- elem_seek = TRUE;
-
- return pipeline;
-}
-
-static gchar *
-format_value (GtkScale * scale, gdouble value)
-{
- gint64 real;
- gint64 seconds;
- gint64 subseconds;
-
- real = value * duration / 100;
- seconds = (gint64) real / GST_SECOND;
- subseconds = (gint64) real / (GST_SECOND / 100);
-
- return g_strdup_printf ("%02" G_GINT64_FORMAT ":%02" G_GINT64_FORMAT ":%02"
- G_GINT64_FORMAT, seconds / 60, seconds % 60, subseconds % 100);
-}
-
-typedef struct
-{
- const gchar *name;
- const GstFormat format;
-}
-seek_format;
-
-static seek_format seek_formats[] = {
- {"tim", GST_FORMAT_TIME},
- {"byt", GST_FORMAT_BYTES},
- {"buf", GST_FORMAT_BUFFERS},
- {"def", GST_FORMAT_DEFAULT},
- {NULL, 0},
-};
-
-G_GNUC_UNUSED static void
-query_rates (void)
-{
- GList *walk = rate_pads;
-
- while (walk) {
- GstPad *pad = GST_PAD (walk->data);
- gint i = 0;
-
- g_print ("rate/sec %8.8s: ", GST_PAD_NAME (pad));
- while (seek_formats[i].name) {
- gint64 value;
- GstFormat format;
-
- format = seek_formats[i].format;
-
- if (gst_pad_query_convert (pad, GST_FORMAT_TIME, GST_SECOND, &format,
- &value)) {
- g_print ("%s %13" G_GINT64_FORMAT " | ", seek_formats[i].name, value);
- } else {
- g_print ("%s %13.13s | ", seek_formats[i].name, "*NA*");
- }
-
- i++;
- }
- g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions_elems ()
-{
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *element = GST_ELEMENT (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_ELEMENT_NAME (element));
- while (seek_formats[i].name) {
- gint64 position, total;
- GstFormat format;
-
- format = seek_formats[i].format;
-
- if (gst_element_query_position (element, &format, &position) &&
- gst_element_query_duration (element, &format, &total)) {
- g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
- seek_formats[i].name, position, total);
- } else {
- g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
- "*NA*");
- }
- i++;
- }
- g_print (" %s\n", GST_ELEMENT_NAME (element));
-
- walk = g_list_next (walk);
- }
-}
-
-G_GNUC_UNUSED static void
-query_positions_pads ()
-{
- GList *walk = seekable_pads;
-
- while (walk) {
- GstPad *pad = GST_PAD (walk->data);
- gint i = 0;
-
- g_print ("positions %8.8s: ", GST_PAD_NAME (pad));
- while (seek_formats[i].name) {
- GstFormat format;
- gint64 position, total;
-
- format = seek_formats[i].format;
-
- if (gst_pad_query_position (pad, &format, &position) &&
- gst_pad_query_duration (pad, &format, &total)) {
- g_print ("%s %13" G_GINT64_FORMAT " / %13" G_GINT64_FORMAT " | ",
- seek_formats[i].name, position, total);
- } else {
- g_print ("%s %13.13s / %13.13s | ", seek_formats[i].name, "*NA*",
- "*NA*");
- }
-
- i++;
- }
- g_print (" %s:%s\n", GST_DEBUG_PAD_NAME (pad));
-
- walk = g_list_next (walk);
- }
-}
-
-static gboolean
-update_scale (gpointer data)
-{
- GstFormat format;
-
- position = 0;
- duration = 0;
-
- format = GST_FORMAT_TIME;
-
- if (elem_seek) {
- if (seekable_elements) {
- GstElement *element = GST_ELEMENT (seekable_elements->data);
-
- gst_element_query_position (element, &format, &position);
- gst_element_query_duration (element, &format, &duration);
- }
- } else {
- if (seekable_pads) {
- GstPad *pad = GST_PAD (seekable_pads->data);
-
- gst_pad_query_position (pad, &format, &position);
- gst_pad_query_duration (pad, &format, &duration);
- }
- }
-
- if (stats) {
- if (elem_seek) {
- query_positions_elems ();
- } else {
- query_positions_pads ();
- }
- query_rates ();
- }
- if (position >= duration)
- duration = position;
-
- if (duration > 0) {
- gtk_adjustment_set_value (adjustment, position * 100.0 / duration);
- gtk_widget_queue_draw (hscale);
- }
-
- return TRUE;
-}
-
-static void do_seek (GtkWidget * widget);
-
-#ifdef SCRUB
-static gboolean
-end_scrub (GtkWidget * widget)
-{
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- seek_timeout_id = 0;
-
- return FALSE;
-}
-#endif
-
-static gboolean
-send_event (GstEvent * event)
-{
- gboolean res = FALSE;
-
- if (!elem_seek) {
- GList *walk = seekable_pads;
-
- while (walk) {
- GstPad *seekable = GST_PAD (walk->data);
-
- GST_DEBUG ("send event on pad %s:%s", GST_DEBUG_PAD_NAME (seekable));
-
- gst_event_ref (event);
- res = gst_pad_send_event (seekable, event);
-
- walk = g_list_next (walk);
- }
- } else {
- GList *walk = seekable_elements;
-
- while (walk) {
- GstElement *seekable = GST_ELEMENT (walk->data);
-
- GST_DEBUG ("send event on element %s", GST_ELEMENT_NAME (seekable));
-
- gst_event_ref (event);
- res = gst_element_send_event (seekable, event);
-
- walk = g_list_next (walk);
- }
- }
- gst_event_unref (event);
- return res;
-}
-
-static void
-do_seek (GtkWidget * widget)
-{
- gint64 real;
- gboolean res = FALSE;
- GstEvent *s_event;
- GstSeekFlags flags;
-
- real = gtk_range_get_value (GTK_RANGE (widget)) * duration / 100;
-
- flags = GST_SEEK_FLAG_FLUSH;
- if (accurate_seek)
- flags |= GST_SEEK_FLAG_ACCURATE;
- if (keyframe_seek)
- flags |= GST_SEEK_FLAG_KEY_UNIT;
- if (loop_seek)
- flags |= GST_SEEK_FLAG_SEGMENT;
-
- s_event = gst_event_new_seek (1.0,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
-
- GST_DEBUG ("seek to %" GST_TIME_FORMAT, GST_TIME_ARGS (real));
-
- res = send_event (s_event);
-
- if (res) {
- gst_pipeline_set_new_stream_time (GST_PIPELINE (pipeline), 0);
- gst_element_get_state (GST_ELEMENT (pipeline), NULL, NULL,
- 50 * GST_MSECOND);
- } else
- g_print ("seek failed\n");
-}
-
-static void
-seek_cb (GtkWidget * widget)
-{
-#ifdef SCRUB
- /* If the timer hasn't expired yet, then the pipeline is running */
- if (seek_timeout_id != 0) {
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
- }
-#endif
-
- do_seek (widget);
-
-#ifdef SCRUB
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
-
- if (seek_timeout_id == 0) {
- seek_timeout_id =
- g_timeout_add (SCRUB_TIME, (GSourceFunc) end_scrub, widget);
- }
-#endif
-}
-
-static void
-set_update_scale (gboolean active)
-{
- if (active) {
- if (update_id == 0) {
- update_id =
- g_timeout_add (UPDATE_INTERVAL, (GtkFunction) update_scale, pipeline);
- }
- } else {
- if (update_id) {
- g_source_remove (update_id);
- update_id = 0;
- }
- }
-}
-
-static gboolean
-start_seek (GtkWidget * widget, GdkEventButton * event, gpointer user_data)
-{
- if (state == GST_STATE_PLAYING)
- gst_element_set_state (pipeline, GST_STATE_PAUSED);
-
- set_update_scale (FALSE);
-
- if (changed_id == 0) {
- changed_id = gtk_signal_connect (GTK_OBJECT (hscale),
- "value_changed", G_CALLBACK (seek_cb), pipeline);
- }
-
- return FALSE;
-}
-
-static gboolean
-stop_seek (GtkWidget * widget, gpointer user_data)
-{
- g_signal_handler_disconnect (GTK_OBJECT (hscale), changed_id);
- changed_id = 0;
- if (seek_timeout_id != 0) {
- g_source_remove (seek_timeout_id);
- seek_timeout_id = 0;
- /* Still scrubbing, so the pipeline is already playing */
- } else {
- if (state == GST_STATE_PLAYING)
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- }
-
- set_update_scale (TRUE);
-
- return FALSE;
-}
-
-static void
-play_cb (GtkButton * button, gpointer data)
-{
- GstStateChangeReturn ret;
-
- if (state != GST_STATE_PLAYING) {
- g_print ("PLAY pipeline\n");
- ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto failed;
-
- set_update_scale (TRUE);
- state = GST_STATE_PLAYING;
- }
- return;
-
-failed:
- {
- g_print ("PLAY failed\n");
- }
-}
-
-static void
-pause_cb (GtkButton * button, gpointer data)
-{
- GstStateChangeReturn ret;
-
- if (state != GST_STATE_PAUSED) {
- g_print ("PAUSE pipeline\n");
- ret = gst_element_set_state (pipeline, GST_STATE_PAUSED);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto failed;
-
- set_update_scale (FALSE);
- state = GST_STATE_PAUSED;
- }
- return;
-
-failed:
- {
- g_print ("PAUSE failed\n");
- }
-}
-
-static void
-stop_cb (GtkButton * button, gpointer data)
-{
- GstStateChangeReturn ret;
-
- if (state != GST_STATE_READY) {
- g_print ("READY pipeline\n");
- ret = gst_element_set_state (pipeline, GST_STATE_READY);
- if (ret == GST_STATE_CHANGE_FAILURE)
- goto failed;
-
- gtk_adjustment_set_value (adjustment, 0.0);
- set_update_scale (FALSE);
-
- state = GST_STATE_READY;
- }
- return;
-
-failed:
- {
- g_print ("READY failed\n");
- }
-}
-
-static void
-accurate_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- accurate_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-key_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- keyframe_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-loop_toggle_cb (GtkToggleButton * button, GstPipeline * pipeline)
-{
- loop_seek = gtk_toggle_button_get_active (button);
-}
-
-static void
-segment_done (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- GstEvent *event;
- GstSeekFlags flags;
- gboolean res;
-
- flags = 0;
- if (loop_seek)
- flags |= GST_SEEK_FLAG_SEGMENT;
-
- event = gst_event_new_seek (1.0,
- GST_FORMAT_TIME, flags, GST_SEEK_TYPE_SET, 0, GST_SEEK_TYPE_NONE, 0);
-
- GST_DEBUG ("segmeent seek to start");
-
- res = send_event (event);
- if (!res) {
- g_print ("segment seek failed\n");
- }
-}
-
-static void
-message_received (GstBus * bus, GstMessage * message, GstPipeline * pipeline)
-{
- const GstStructure *s;
-
- s = gst_message_get_structure (message);
- g_print ("message from \"%s\" (%s): ",
- GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))),
- gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
- if (s) {
- gchar *sstr;
-
- sstr = gst_structure_to_string (s);
- g_print ("%s\n", sstr);
- g_free (sstr);
- } else {
- g_print ("no message details\n");
- }
-}
-
-
-typedef struct
-{
- gchar *name;
- GstElement *(*func) (const gchar * location);
-}
-Pipeline;
-
-static Pipeline pipelines[] = {
- {"mp3", make_mp3_pipeline},
- {"avi", make_avi_pipeline},
- {"mpeg1", make_mpeg_pipeline},
- {"mpegparse", make_parse_pipeline},
- {"vorbis", make_vorbis_pipeline},
- {"theora", make_theora_pipeline},
- {"ogg/v/t", make_vorbis_theora_pipeline},
- {"avi/msmpeg4v3/mp3", make_avi_msmpeg4v3_mp3_pipeline},
- {"sid", make_sid_pipeline},
- {"flac", make_flac_pipeline},
- {"wav", make_wav_pipeline},
- {"mod", make_mod_pipeline},
- {"dv", make_dv_pipeline},
- {"mpeg1nothreads", make_mpegnt_pipeline},
- {"playerbin", make_playerbin_pipeline},
- {"parse-launch", make_parselaunch_pipeline},
- {NULL, NULL},
-};
-
-#define NUM_TYPES ((sizeof (pipelines) / sizeof (Pipeline)) - 1)
-
-static void
-print_usage (int argc, char **argv)
-{
- gint i;
-
- g_print ("usage: %s <type> <filename>\n", argv[0]);
- g_print (" possible types:\n");
-
- for (i = 0; i < NUM_TYPES; i++) {
- g_print (" %d = %s\n", i, pipelines[i].name);
- }
-}
-
-int
-main (int argc, char **argv)
-{
- GtkWidget *window, *hbox, *vbox, *play_button, *pause_button, *stop_button;
- GtkWidget *accurate_checkbox, *key_checkbox, *loop_checkbox;
- GOptionEntry options[] = {
- {"stats", 's', 0, G_OPTION_ARG_NONE, &stats,
- "Show pad stats", NULL},
- {"elem", 'e', 0, G_OPTION_ARG_NONE, &elem_seek,
- "Seek on elements instead of pads", NULL},
- {"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
- "Verbose properties", NULL},
- {NULL}
- };
- gint type;
- GOptionContext *ctx;
- GError *err = NULL;
-
- ctx = g_option_context_new ("seek");
- g_option_context_add_main_entries (ctx, options, NULL);
- g_option_context_add_group (ctx, gst_init_get_option_group ());
-
- if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
- g_print ("Error initializing: %s\n", err->message);
- exit (1);
- }
-
- GST_DEBUG_CATEGORY_INIT (seek_debug, "seek", 0, "seek example");
-
- gtk_init (&argc, &argv);
-
- if (argc != 3) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- type = atoi (argv[1]);
-
- if (type < 0 || type >= NUM_TYPES) {
- print_usage (argc, argv);
- exit (-1);
- }
-
- pipeline = pipelines[type].func (argv[2]);
- g_assert (pipeline);
-
- /* initialize gui elements ... */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- hbox = gtk_hbox_new (FALSE, 0);
- vbox = gtk_vbox_new (FALSE, 0);
- play_button = gtk_button_new_with_label ("play");
- pause_button = gtk_button_new_with_label ("pause");
- stop_button = gtk_button_new_with_label ("stop");
-
- accurate_checkbox = gtk_check_button_new_with_label ("Accurate Seek");
- key_checkbox = gtk_check_button_new_with_label ("Key_unit Seek");
- loop_checkbox = gtk_check_button_new_with_label ("Loop");
-
- adjustment =
- GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.00, 100.0, 0.1, 1.0, 1.0));
- hscale = gtk_hscale_new (adjustment);
- gtk_scale_set_digits (GTK_SCALE (hscale), 2);
- gtk_range_set_update_policy (GTK_RANGE (hscale), GTK_UPDATE_CONTINUOUS);
-
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_press_event", G_CALLBACK (start_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "button_release_event", G_CALLBACK (stop_seek), pipeline);
- gtk_signal_connect (GTK_OBJECT (hscale),
- "format_value", G_CALLBACK (format_value), pipeline);
-
- /* do the packing stuff ... */
- gtk_window_set_default_size (GTK_WINDOW (window), 250, 96);
- gtk_container_add (GTK_CONTAINER (window), vbox);
- gtk_container_add (GTK_CONTAINER (vbox), hbox);
- gtk_box_pack_start (GTK_BOX (hbox), play_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), pause_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), stop_button, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), accurate_checkbox, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), key_checkbox, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (hbox), loop_checkbox, FALSE, FALSE, 2);
- gtk_box_pack_start (GTK_BOX (vbox), hscale, TRUE, TRUE, 2);
-
- /* connect things ... */
- g_signal_connect (G_OBJECT (play_button), "clicked", G_CALLBACK (play_cb),
- pipeline);
- g_signal_connect (G_OBJECT (pause_button), "clicked", G_CALLBACK (pause_cb),
- pipeline);
- g_signal_connect (G_OBJECT (stop_button), "clicked", G_CALLBACK (stop_cb),
- pipeline);
- g_signal_connect (G_OBJECT (accurate_checkbox), "toggled",
- G_CALLBACK (accurate_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (key_checkbox), "toggled",
- G_CALLBACK (key_toggle_cb), pipeline);
- g_signal_connect (G_OBJECT (loop_checkbox), "toggled",
- G_CALLBACK (loop_toggle_cb), pipeline);
-
- g_signal_connect (G_OBJECT (window), "delete_event", gtk_main_quit, NULL);
-
- /* show the gui. */
- gtk_widget_show_all (window);
-
- if (verbose) {
- g_signal_connect (pipeline, "deep_notify",
- G_CALLBACK (gst_object_default_deep_notify), NULL);
- }
- {
- GstBus *bus;
-
- bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
- gst_bus_add_signal_watch_full (bus, G_PRIORITY_HIGH);
-
-// g_signal_connect (bus, "message::state-changed", (GCallback) message_received, pipeline);
- g_signal_connect (bus, "message::new-clock", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::error", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::warning", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::eos", (GCallback) message_received,
- pipeline);
- g_signal_connect (bus, "message::segment-done",
- (GCallback) message_received, pipeline);
- g_signal_connect (bus, "message::segment-done", (GCallback) segment_done,
- pipeline);
- }
- gtk_main ();
-
- g_print ("NULL pipeline\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
-
- g_print ("free pipeline\n");
- gst_object_unref (pipeline);
-
- return 0;
-}
+++ /dev/null
-noinst_PROGRAMS = mp2ogg
-
-LDADD = $(GST_LIBS)
-AM_CFLAGS = $(GST_CFLAGS)
-
-
+++ /dev/null
-/* GStreamer
- * Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
- *
- * 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/gst.h>
-
-/* This example app demonstartes the use of pad query and convert to
- * get useful statistics about a plugin. In this case we monitor the
- * compression status of mpeg audio to ogg vorbis transcoding.
- */
-
-gint
-main (gint argc, gchar * argv[])
-{
- GstElement *pipeline;
- GError *error = NULL;
- gchar *description;
- GstElement *encoder, *decoder;
- GstPad *dec_sink, *enc_src;
-
- gst_init (&argc, &argv);
-
- if (argc < 3) {
- g_print ("usage: %s <inputfile> <outputfile>\n", argv[0]);
- return -1;
- }
-
- description = g_strdup_printf ("filesrc location=\"%s\" ! mad name=decoder ! "
- "vorbisenc name=encoder ! filesink location=\"%s\"", argv[1], argv[2]);
-
- pipeline = GST_ELEMENT (gst_parse_launch (description, &error));
- if (!pipeline) {
- if (error)
- g_print ("ERROR: pipeline could not be constructed: %s\n",
- error->message);
- else
- g_print ("ERROR: pipeline could not be constructed\n");
- return -1;
- }
-
- decoder = gst_bin_get_by_name (GST_BIN (pipeline), "decoder");
- encoder = gst_bin_get_by_name (GST_BIN (pipeline), "encoder");
-
- dec_sink = gst_element_get_pad (decoder, "sink");
- enc_src = gst_element_get_pad (encoder, "src");
-
- if (gst_element_set_state (pipeline,
- GST_STATE_PLAYING) != GST_STATE_CHANGE_SUCCESS) {
- g_print ("pipeline doesn't want to play\n");
- return -1;
- }
-
- while (gst_bin_iterate (GST_BIN (pipeline))) {
- gint64 position;
- gint64 duration;
- gint64 bitrate_enc, bitrate_dec;
- GstFormat format;
-
- format = GST_FORMAT_TIME;
- /* get the position */
- gst_pad_query (enc_src, GST_QUERY_POSITION, &format, &position);
-
- /* get the total duration */
- gst_pad_query (enc_src, GST_QUERY_TOTAL, &format, &duration);
-
- format = GST_FORMAT_BYTES;
- /* see how many bytes are genereated per 8 seconds (== bitrate) */
- gst_pad_convert (enc_src, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_enc);
-
- gst_pad_convert (dec_sink, GST_FORMAT_TIME, 8 * GST_SECOND,
- &format, &bitrate_dec);
-
- g_print ("[%2dm %.2ds] of [%2dm %.2ds], "
- "src avg bitrate: %" G_GINT64_FORMAT ", dest avg birate: %"
- G_GINT64_FORMAT ", ratio [%02.2f] \r",
- (gint) (position / (GST_SECOND * 60)),
- (gint) (position / (GST_SECOND)) % 60,
- (gint) (duration / (GST_SECOND * 60)),
- (gint) (duration / (GST_SECOND)) % 60, bitrate_dec, bitrate_enc,
- (gfloat) bitrate_dec / bitrate_enc);
- }
-
- g_print ("\n");
-
- return 0;
-}
+++ /dev/null
-
-noinst_PROGRAMS = switcher
-
-switcher_SOURCES = switcher.c
-switcher_CFLAGS = $(GST_CFLAGS)
-switcher_LDFLAGS = $(GST_LIBS)
-
+++ /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 <gst/gst.h>
-
-static GMainLoop *loop = NULL;
-
-
-
-static void
-got_eos (GstElement * pipeline)
-{
- g_main_loop_quit (loop);
-}
-
-static gboolean
-idle_iterate (GstElement * pipeline)
-{
- gst_bin_iterate (GST_BIN (pipeline));
- return (GST_STATE (GST_ELEMENT (pipeline)) == GST_STATE_PLAYING);
-}
-
-static gboolean
-switch_timer (GstElement * video_switch)
-{
- gint nb_sources, active_source;
-
- g_object_get (G_OBJECT (video_switch), "nb_sources", &nb_sources, NULL);
- g_object_get (G_OBJECT (video_switch), "active_source", &active_source, NULL);
-
- active_source++;
-
- if (active_source > nb_sources - 1)
- active_source = 0;
-
- g_object_set (G_OBJECT (video_switch), "active_source", active_source, NULL);
-
- g_message ("current number of sources : %d, active source %d",
- nb_sources, active_source);
-
- return (GST_STATE (GST_ELEMENT (video_switch)) == GST_STATE_PLAYING);
-}
-
-int
-main (int argc, char *argv[])
-{
- GstElement *pipeline, *src1, *src2, *video_switch, *video_sink;
-
- /* Initing GStreamer library */
- gst_init (&argc, &argv);
-
- loop = g_main_loop_new (NULL, FALSE);
-
- pipeline = gst_pipeline_new ("pipeline");
- src1 = gst_element_factory_make ("videotestsrc", "src1");
- g_object_set (G_OBJECT (src1), "pattern", 0, NULL);
- src2 = gst_element_factory_make ("videotestsrc", "src2");
- g_object_set (G_OBJECT (src2), "pattern", 1, NULL);
- video_switch = gst_element_factory_make ("switch", "video_switch");
- video_sink = gst_element_factory_make (DEFAULT_VIDEOSINK, "video_sink");
-
- gst_bin_add_many (GST_BIN (pipeline), src1, src2, video_switch,
- video_sink, NULL);
-
- gst_element_link (src1, video_switch);
- gst_element_link (src2, video_switch);
- gst_element_link (video_switch, video_sink);
-
- g_signal_connect (G_OBJECT (pipeline), "eos", G_CALLBACK (got_eos), NULL);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
-
- g_idle_add ((GSourceFunc) idle_iterate, pipeline);
- g_timeout_add (2000, (GSourceFunc) switch_timer, video_switch);
-
- g_main_loop_run (loop);
-
- gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_READY);
-
- /* unref */
- gst_object_unref (pipeline);
-
- exit (0);
-}
--- /dev/null
+if BUILD_EXAMPLES
+SUBDIRS_EXAMPLES = examples
+else
+SUBDIRS_EXAMPLES =
+endif
+
+if HAVE_CHECK
+SUBDIRS_CHECK = check
+else
+SUBDIRS_CHECK =
+endif
+
+SUBDIRS = \
+ $(SUBDIRS_CHECK) \
+ $(SUBDIRS_EXAMPLES)
+
+DIST_SUBDIRS = \
+ check \
+ examples
.dirstamp
+clock-selection
states
.dirstamp
-simple_launch_lines
+simple-launch-lines
--- /dev/null
+if HAVE_FT2
+FT2_SUBDIRS = seek
+else
+FT2_SUBDIRS =
+endif
+
+SUBDIRS = $(FT2_SUBDIRS)
+
+DIST_SUBDIRS = seek
-examples = seek scrubby #cdplayer cdparanoia
+examples = seek scrubby
noinst_PROGRAMS = $(examples)
-# we have nothing but apps here, we can do this safely
LIBS = $(GST_LIBS) $(GTK_LIBS)
AM_CFLAGS = $(GST_CFLAGS) $(GTK_CFLAGS)