Modified a lot of plugins to use the caps system.
authorWim Taymans <wim.taymans@gmail.com>
Sat, 24 Mar 2001 17:22:03 +0000 (17:22 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sat, 24 Mar 2001 17:22:03 +0000 (17:22 +0000)
Original commit message from CVS:
Modified a lot of plugins to use the caps system.
Modified the caps of audio/raw to our agreed properties.
Added the multidisksrc plugin of Dominic Ludlam
Renamed audiosink/src to osssink/src and updated all the examples using
the old name. Moved oss specific plugins in an oss directory. removed
the old audiosink from the elements/ dir.
removed audioraw.h metadata header files since we now use the properties.
There are still a few plugins that won't build because they include the
old audioraw.h header file. This will be fixed soon.
Make sure the caps are set in the plugins as described by their
padtemplates (this should solve problems with gstmediaplay with various
media files).

*please don't panic when some plugins won't build, just cd manually into
the plugin dirs* This will be fixed soon.

83 files changed:
configure.in
examples/autoplug/autoplug.c
examples/helloworld/helloworld.c
examples/helloworld2/helloworld2.c
examples/launch/mp3play
examples/queue/queue.c
examples/queue2/queue2.c
examples/queue3/queue3.c
examples/queue4/queue4.c
examples/thread/thread.c
examples/xml/createxml.c
gst/Makefile.am
gst/elements/Makefile.am
gst/elements/gstaudiosink.c [deleted file]
gst/elements/gstaudiosink.h [deleted file]
gst/elements/gstaudiosrc.c [deleted file]
gst/elements/gstaudiosrc.h [deleted file]
gst/elements/gstelements.c
gst/elements/gstmultidisksrc.c [new file with mode: 0644]
gst/elements/gstmultidisksrc.h [new file with mode: 0644]
gst/elements/gstmultifilesrc.c [new file with mode: 0644]
gst/elements/gstmultifilesrc.h [new file with mode: 0644]
gst/elements/gstsinesrc.c
gst/elements/gstsinesrc.h
gst/gstcaps.c
gst/gstcaps.h
gst/gstprops.c
gst/gstprops.h
gst/gstpropsprivate.h
gst/meta/Makefile.am
gst/meta/audioraw.h [deleted file]
gstplay/gstplay.c
plugins/elements/Makefile.am
plugins/elements/gstaudiosink.c [deleted file]
plugins/elements/gstaudiosink.h [deleted file]
plugins/elements/gstaudiosrc.c [deleted file]
plugins/elements/gstaudiosrc.h [deleted file]
plugins/elements/gstelements.c
plugins/elements/gstmultidisksrc.c [new file with mode: 0644]
plugins/elements/gstmultidisksrc.h [new file with mode: 0644]
plugins/elements/gstmultifilesrc.c [new file with mode: 0644]
plugins/elements/gstmultifilesrc.h [new file with mode: 0644]
plugins/elements/gstsinesrc.c
plugins/elements/gstsinesrc.h
test/a.c
test/ac3play.c
test/aviparse.c
test/m.c
test/mcut.c
test/mp1parse.c
test/mp1tomp1.c
test/mp2toavi.c
test/mp2tomp1.c
test/mp3.c
test/mp3play.c
test/mpeg2parse.c
test/mpg123.c
test/p.c
test/qtest.c
test/r.c
test/record.c
test/s.c
test/spectrum.c
test/typefind.c
test/vidcapture.c
test/vidcapture2.c
test/w.c
test/xmmstest.c
tests/autoplug.c
tests/autoplug3.c
tests/old/examples/autoplug/autoplug.c
tests/old/examples/helloworld/helloworld.c
tests/old/examples/helloworld2/helloworld2.c
tests/old/examples/launch/mp3play
tests/old/examples/queue/queue.c
tests/old/examples/queue2/queue2.c
tests/old/examples/queue3/queue3.c
tests/old/examples/queue4/queue4.c
tests/old/examples/thread/thread.c
tests/old/examples/xml/createxml.c
tests/paranoia.c
tools/README
tools/gstreamer-inspect.c

index 137fce6..45e588f 100644 (file)
@@ -766,6 +766,7 @@ plugins/mpeg1/system_encode/Makefile
 plugins/mpeg1/mpeg1encoder/Makefile
 plugins/mpeg1video/Makefile
 plugins/mpeg1video/parse/Makefile
+plugins/oss/Makefile
 plugins/rtp/Makefile
 plugins/rtp/rtpsend/Makefile
 plugins/filters/Makefile
index dbd47c6..a408c9d 100644 (file)
@@ -53,7 +53,7 @@ gst_play_typefind (GstBin *bin, GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *videosink;
+  GstElement *disksrc, *osssink, *videosink;
   GstElement *bin;
   GtkWidget *appwindow;
   GstCaps *srccaps;
@@ -88,8 +88,8 @@ int main(int argc,char *argv[])
   }
   
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* and an video sink */
   videosink = gst_elementfactory_make("videosink", "play_video");
@@ -102,7 +102,7 @@ int main(int argc,char *argv[])
   new_element = gst_autoplug_to_renderers (autoplug,
            srccaps,
            videosink,
-           audiosink,
+           osssink,
            NULL);
 
   if (!new_element) {
index 3d7c7d8..566a2fb 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *bin, *disksrc, *parse, *decoder, *audiosink;
+  GstElement *bin, *disksrc, *parse, *decoder, *osssink;
 
   gst_init(&argc,&argv);
 
@@ -35,13 +35,13 @@ int main(int argc,char *argv[])
   parse = gst_elementfactory_make("mp3parse","parse");
   decoder = gst_elementfactory_make("mpg123","decoder");
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
+  osssink = gst_elementfactory_make("osssink", "play_audio");
 
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin), disksrc);
   gst_bin_add(GST_BIN(bin), parse);
   gst_bin_add(GST_BIN(bin), decoder);
-  gst_bin_add(GST_BIN(bin), audiosink);
+  gst_bin_add(GST_BIN(bin), osssink);
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
@@ -49,7 +49,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(parse,"src"),
                   gst_element_get_pad(decoder,"sink"));
   gst_pad_connect(gst_element_get_pad(decoder,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* start playing */
   gst_element_set_state(bin, GST_STATE_PLAYING);
@@ -63,7 +63,7 @@ int main(int argc,char *argv[])
   /* stop the bin */
   gst_element_set_state(bin, GST_STATE_NULL);
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(decoder));
   gst_object_destroy(GST_OBJECT(disksrc));
index 8b70518..19e0b1e 100644 (file)
@@ -11,7 +11,7 @@ void eos(GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink;
+  GstElement *disksrc, *osssink;
   GstElement *pipeline, *thread;
 
   gst_init(&argc,&argv);
@@ -37,13 +37,13 @@ int main(int argc,char *argv[])
                      GTK_SIGNAL_FUNC(eos),NULL);
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
-  gst_pipeline_add_sink(GST_PIPELINE(pipeline), audiosink);
+  gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink);
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("unable to handle stream\n");
index 0208e13..b09ccd3 100755 (executable)
@@ -1,4 +1,4 @@
 #! /bin/sh
 for loc in "$@"; do
-../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! audiosink
+../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
 done
index e2caf58..0d34a4b 100644 (file)
@@ -3,7 +3,7 @@
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *parse, *decode, *queue;
+  GstElement *disksrc, *osssink, *parse, *decode, *queue;
   GstElement *bin;
   GstElement *thread;
 
@@ -33,8 +33,8 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   gst_bin_use_cothreads (GST_BIN (bin), TRUE);
 
@@ -44,7 +44,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(bin), decode);
   gst_bin_add(GST_BIN(bin), queue);
 
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
 
   gst_bin_add(GST_BIN(bin), thread);
   
@@ -55,7 +55,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(decode,"src"),
                   gst_element_get_pad(queue,"sink"));
   gst_pad_connect(gst_element_get_pad(queue,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* start playing */
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
index 706acc0..837732e 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue;
+  GstElement *disksrc, *osssink, *queue;
   GstElement *pipeline;
   GstElement *thread;
 
@@ -42,18 +42,18 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
   gst_pipeline_add_sink(GST_PIPELINE(pipeline), queue);
 
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
 
   gst_pad_connect(gst_element_get_pad(queue,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("cannot autoplug pipeline\n");
index 237b967..152cd1e 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *parse, *decode;
   GstElement *bin;
   GstElement *thread;
 
@@ -42,8 +42,8 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -54,7 +54,7 @@ int main(int argc,char *argv[])
 
   gst_bin_add(GST_BIN(thread), parse);
   gst_bin_add(GST_BIN(thread), decode);
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
   
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -64,7 +64,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(parse,"src"),
                   gst_element_get_pad(decode,"sink"));
   gst_pad_connect(gst_element_get_pad(decode,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
 
index a7e9d6d..cb984cc 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *queue2, *parse, *decode;
   GstElement *bin;
   GstElement *thread, *thread2;
 
@@ -45,8 +45,8 @@ int main(int argc,char *argv[])
   queue2 = gst_elementfactory_make("queue", "queue2");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -59,7 +59,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(thread), decode);
   gst_bin_add(GST_BIN(thread), queue2);
 
-  gst_bin_add(GST_BIN(thread2), audiosink);
+  gst_bin_add(GST_BIN(thread2), osssink);
   
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -72,7 +72,7 @@ int main(int argc,char *argv[])
                   gst_element_get_pad(queue2,"sink"));
 
   gst_pad_connect(gst_element_get_pad(queue2,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
   gst_bin_add(GST_BIN(bin), thread2);
index b8bc00e..5c691a0 100644 (file)
@@ -14,7 +14,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink;
+  GstElement *disksrc, *osssink;
   GstElement *pipeline;
   GstElement *thread;
 
@@ -41,13 +41,13 @@ int main(int argc,char *argv[])
                      GTK_SIGNAL_FUNC(eos), thread);
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
-  gst_pipeline_add_sink(GST_PIPELINE(pipeline), audiosink);
+  gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink);
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("unable to handle stream\n");
index 154f943..ce8b395 100644 (file)
@@ -15,7 +15,7 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
 
 int main(int argc,char *argv[])
 {
-  GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *queue2, *parse, *decode;
   GstElement *bin;
   GstElement *thread, *thread2;
 
@@ -52,8 +52,8 @@ int main(int argc,char *argv[])
   queue2 = gst_elementfactory_make("queue", "queue2");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -66,7 +66,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(thread), decode);
   gst_bin_add(GST_BIN(thread), queue2);
 
-  gst_bin_add(GST_BIN(thread2), audiosink);
+  gst_bin_add(GST_BIN(thread2), osssink);
 
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -79,7 +79,7 @@ int main(int argc,char *argv[])
                   gst_element_get_pad(queue2,"sink"));
 
   gst_pad_connect(gst_element_get_pad(queue2,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
   gst_bin_add(GST_BIN(bin), thread2);
index c5f4e93..0ccec0b 100644 (file)
@@ -1,5 +1,5 @@
 # cheap trick to build . first...
-SUBDIRS = . types meta elements autoplug
+SUBDIRS = . types elements autoplug
 
 lib_LTLIBRARIES = libgst.la
 
index 0c5b9e6..e41a972 100644 (file)
@@ -16,9 +16,8 @@ libgstelements_la_SOURCES =   \
        gstfakesink.c           \
        gstdisksrc.c            \
        gstfdsrc.c              \
-       gstaudiosink.c          \
-       gstaudiosrc.c           \
        gstfdsink.c             \
+       gstmultidisksrc.c       \
        gstpipefilter.c         \
        gsttee.c                \
        gstsinesrc.c            \
@@ -30,9 +29,8 @@ noinst_HEADERS =              \
        gstfakesink.h           \
        gstdisksrc.h            \
        gstfdsrc.h              \
+       gstmultidisksrc.h       \
        gsthttpsrc.h            \
-       gstaudiosink.h          \
-       gstaudiosrc.h           \
        gstfdsink.h             \
        gstpipefilter.h         \
        gsttee.h                \
diff --git a/gst/elements/gstaudiosink.c b/gst/elements/gstaudiosink.c
deleted file mode 100644 (file)
index 41a2b6c..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosink.c: 
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
-#include <unistd.h>
-#include <errno.h>
-
-//#define DEBUG_ENABLED
-
-#include <gstaudiosink.h>
-#include <gst/meta/audioraw.h>
-
-
-GstElementDetails gst_audiosink_details = {  
-  "Audio Sink (OSS)",
-  "Sink/Audio",
-  "Output to a sound card via OSS",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
-
-static void                    gst_audiosink_class_init        (GstAudioSinkClass *klass);
-static void                    gst_audiosink_init              (GstAudioSink *audiosink);
-
-static gboolean                gst_audiosink_open_audio        (GstAudioSink *sink);
-static void                    gst_audiosink_close_audio       (GstAudioSink *sink);
-static void                    gst_audiosink_sync_parms        (GstAudioSink *audiosink);
-static GstElementStateReturn   gst_audiosink_change_state      (GstElement *element);
-static GstPadNegotiateReturn   gst_audiosink_negotiate         (GstPad *pad, GstCaps **caps, gint counter);
-
-static void                    gst_audiosink_set_arg           (GtkObject *object, GtkArg *arg, guint id);
-static void                    gst_audiosink_get_arg           (GtkObject *object, GtkArg *arg, guint id);
-
-static void                    gst_audiosink_chain             (GstPad *pad,GstBuffer *buf);
-
-/* AudioSink signals and args */
-enum {
-  SIGNAL_HANDOFF,
-  LAST_SIGNAL
-};
-
-enum {
-  ARG_0,
-  ARG_MUTE,
-  ARG_FORMAT,
-  ARG_CHANNELS,
-  ARG_FREQUENCY,
-  /* FILL ME */
-};
-
-static GstPadFactory audiosink_sink_factory = {
-  "sink",
-  GST_PAD_FACTORY_SINK,
-  GST_PAD_FACTORY_ALWAYS,
-  GST_PAD_FACTORY_CAPS (
-  "audiosink_sink",
-    "audio/raw",
-    "format",   GST_PROPS_INT (AFMT_S16_LE),
-    "depth",    GST_PROPS_LIST (
-                 GST_PROPS_INT (8),
-                 GST_PROPS_INT (16)
-               ),
-    "rate",     GST_PROPS_INT_RANGE (8000, 48000),
-    "channels", GST_PROPS_INT_RANGE (1, 2)
-  ),
-  NULL
-};
-
-#define GST_TYPE_AUDIOSINK_FORMATS (gst_audiosink_formats_get_type())
-
-static GtkType 
-gst_audiosink_formats_get_type(void) {
-  static GtkType audiosink_formats_type = 0;
-  static GtkEnumValue audiosink_formats[] = {
-    {8, "8", "8 Bits"},
-    {16, "16", "16 Bits"},
-    {0, NULL, NULL},
-  };
-  if (!audiosink_formats_type) {
-    audiosink_formats_type = gtk_type_register_enum("GstAudiosinkFormats", audiosink_formats);
-  }
-  return audiosink_formats_type;
-}
-
-#define GST_TYPE_AUDIOSINK_CHANNELS (gst_audiosink_channels_get_type())
-
-static GtkType 
-gst_audiosink_channels_get_type(void) {
-  static GtkType audiosink_channels_type = 0;
-  static GtkEnumValue audiosink_channels[] = {
-    {1, "1", "Mono"},
-    {2, "2", "Stereo"},
-    {0, NULL, NULL},
-  };
-  if (!audiosink_channels_type) {
-    audiosink_channels_type = gtk_type_register_enum("GstAudiosinkChannels", audiosink_channels);
-  }
-  return audiosink_channels_type;
-}
-
-
-static GstElementClass *parent_class = NULL;
-static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
-
-static GstPadTemplate *gst_audiosink_sink_template;
-
-GtkType
-gst_audiosink_get_type (void) 
-{
-  static GtkType audiosink_type = 0;
-
-  if (!audiosink_type) {
-    static const GtkTypeInfo audiosink_info = {
-      "GstAudioSink",
-      sizeof(GstAudioSink),
-      sizeof(GstAudioSinkClass),
-      (GtkClassInitFunc)gst_audiosink_class_init,
-      (GtkObjectInitFunc)gst_audiosink_init,
-      (GtkArgSetFunc)NULL,
-      (GtkArgGetFunc)NULL,
-      (GtkClassInitFunc)NULL,
-    };
-    audiosink_type = gtk_type_unique (GST_TYPE_ELEMENT, &audiosink_info);
-  }
-
-  return audiosink_type;
-}
-
-static void
-gst_audiosink_class_init (GstAudioSinkClass *klass) 
-{
-  GtkObjectClass *gtkobject_class;
-  GstElementClass *gstelement_class;
-
-  gtkobject_class = (GtkObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
-
-  parent_class = gtk_type_class(GST_TYPE_ELEMENT);
-
-  gtk_object_add_arg_type ("GstAudioSink::mute", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_MUTE);
-  gtk_object_add_arg_type ("GstAudioSink::format", GST_TYPE_AUDIOSINK_FORMATS,
-                           GTK_ARG_READWRITE, ARG_FORMAT);
-  gtk_object_add_arg_type ("GstAudioSink::channels", GST_TYPE_AUDIOSINK_CHANNELS,
-                           GTK_ARG_READWRITE, ARG_CHANNELS);
-  gtk_object_add_arg_type ("GstAudioSink::frequency", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FREQUENCY);
-
-  gtkobject_class->set_arg = gst_audiosink_set_arg;
-  gtkobject_class->get_arg = gst_audiosink_get_arg;
-
-  gst_audiosink_signals[SIGNAL_HANDOFF] =
-    gtk_signal_new("handoff",GTK_RUN_LAST,gtkobject_class->type,
-                   GTK_SIGNAL_OFFSET(GstAudioSinkClass,handoff),
-                   gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0);
-  
-  gtk_object_class_add_signals(gtkobject_class,gst_audiosink_signals,
-                               LAST_SIGNAL);
-
-  gstelement_class->change_state = gst_audiosink_change_state;
-}
-
-static void 
-gst_audiosink_init (GstAudioSink *audiosink) 
-{
-  audiosink->sinkpad = gst_pad_new_from_template (gst_audiosink_sink_template, "sink");
-  gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
-  gst_pad_set_negotiate_function (audiosink->sinkpad, gst_audiosink_negotiate);
-
-  gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
-
-  audiosink->fd = -1;
-  audiosink->clock = gst_clock_get_system();
-  audiosink->format = 16;
-  audiosink->channels = 2;
-  audiosink->frequency = 44100;
-  
-  gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));
-
-  GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
-}
-
-static GstPadNegotiateReturn 
-gst_audiosink_negotiate (GstPad *pad, GstCaps **caps, gint counter) 
-{
-  GstAudioSink *audiosink;
-
-  g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
-  g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_NEGOTIATE_FAIL);
-
-  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
-
-  g_print ("audiosink: negotiate\n");
-  // we decide
-  if (counter == 0) {
-    *caps = NULL;
-    return GST_PAD_NEGOTIATE_TRY;
-  }
-  // have we got caps?
-  else if (*caps) {
-    if (audiosink->fd == -1) return GST_PAD_NEGOTIATE_FAIL;
-
-    audiosink->format = gst_caps_get_int (*caps, "format");
-    audiosink->channels = gst_caps_get_int (*caps, "channels");
-    audiosink->frequency = gst_caps_get_int (*caps, "rate");
-
-    gst_audiosink_sync_parms (audiosink);
-
-    // FIXME check if the qound card was really set to these caps,
-    // else send out another caps..
-
-    return GST_PAD_NEGOTIATE_AGREE;
-  }
-  
-  return GST_PAD_NEGOTIATE_FAIL;
-}
-
-static void 
-gst_audiosink_sync_parms (GstAudioSink *audiosink) 
-{
-  audio_buf_info ospace;
-  int frag;
-
-  g_return_if_fail (audiosink != NULL);
-  g_return_if_fail (GST_IS_AUDIOSINK (audiosink));
-
-  if (audiosink->fd == -1) return;
-
-  ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
-
-  ioctl (audiosink->fd, SNDCTL_DSP_SETFMT, &audiosink->format);
-  ioctl (audiosink->fd, SNDCTL_DSP_CHANNELS, &audiosink->channels);
-  ioctl (audiosink->fd, SNDCTL_DSP_SPEED, &audiosink->frequency);
-  ioctl (audiosink->fd, SNDCTL_DSP_GETBLKSIZE, &frag);
-
-  ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-
-  g_print("audiosink: setting sound card to %dHz %d bit %s (%d bytes buffer, %d fragment)\n",
-          audiosink->frequency, audiosink->format,
-          (audiosink->channels == 2) ? "stereo" : "mono", ospace.bytes, frag);
-
-}
-
-static void 
-gst_audiosink_chain (GstPad *pad, GstBuffer *buf) 
-{
-  GstAudioSink *audiosink;
-  gboolean in_flush;
-  audio_buf_info ospace;
-
-  g_return_if_fail (pad != NULL);
-  g_return_if_fail (GST_IS_PAD (pad));
-  g_return_if_fail (buf != NULL);
-
-
-  /* this has to be an audio buffer */
-//  g_return_if_fail(((GstMeta *)buf->meta)->type !=
-//gst_audiosink_type_audio);
-  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
-//  g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
-
-  if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
-    GST_DEBUG (0,"audiosink: flush\n");
-    ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
-  }
-
-  gtk_signal_emit (GTK_OBJECT (audiosink), gst_audiosink_signals[SIGNAL_HANDOFF],
-                  audiosink);
-
-  if (GST_BUFFER_DATA (buf) != NULL) {
-    gst_trace_add_entry(NULL, 0, buf, "audiosink: writing to soundcard");
-    //g_print("audiosink: writing to soundcard\n");
-    if (audiosink->fd >= 0) {
-      if (!audiosink->mute) {
-        gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
-        ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-        GST_DEBUG (0,"audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, 
-                       audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-        write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-        //write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
-      }
-    }
-  }
-  gst_buffer_unref (buf);
-}
-
-static void 
-gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSink *audiosink;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSINK (object));
-  
-  audiosink = GST_AUDIOSINK (object);
-
-  switch(id) {
-    case ARG_MUTE:
-      audiosink->mute = GTK_VALUE_BOOL (*arg);
-      break;
-    case ARG_FORMAT:
-      audiosink->format = GTK_VALUE_ENUM (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    case ARG_CHANNELS:
-      audiosink->channels = GTK_VALUE_ENUM (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    case ARG_FREQUENCY:
-      audiosink->frequency = GTK_VALUE_INT (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    default:
-      break;
-  }
-}
-
-static void 
-gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSink *audiosink;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSINK (object));
-  
-  audiosink = GST_AUDIOSINK (object);
-
-  switch(id) {
-    case ARG_MUTE:
-      GTK_VALUE_BOOL (*arg) = audiosink->mute;
-      break;
-    case ARG_FORMAT:
-      GTK_VALUE_ENUM (*arg) = audiosink->format;
-      break;
-    case ARG_CHANNELS:
-      GTK_VALUE_ENUM (*arg) = audiosink->channels;
-      break;
-    case ARG_FREQUENCY:
-      GTK_VALUE_INT (*arg) = audiosink->frequency;
-      break;
-    default:
-      break;
-  }
-}
-
-static gboolean
-gst_audiosink_open_audio (GstAudioSink *sink)
-{
-  g_return_val_if_fail (sink->fd == -1, FALSE);
-
-  g_print ("audiosink: attempting to open sound device\n");
-
-  /* first try to open the sound card */
-  sink->fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
-  if (errno == EBUSY) {
-    g_print ("audiosink: unable to open the sound device (in use ?)\n");
-    return FALSE;
-  }
-
-  /* re-open the sound device in blocking mode */
-  close(sink->fd);
-  sink->fd = open("/dev/dsp", O_WRONLY);
-
-  /* if we have it, set the default parameters and go have fun */
-  if (sink->fd >= 0) {
-    /* set card state */
-    ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
-
-    g_print("audiosink: Capabilities\n");
-
-    if (sink->caps & DSP_CAP_DUPLEX)   g_print("audiosink:   Full duplex\n");
-    if (sink->caps & DSP_CAP_REALTIME) g_print("audiosink:   Realtime\n");
-    if (sink->caps & DSP_CAP_BATCH)    g_print("audiosink:   Batch\n");
-    if (sink->caps & DSP_CAP_COPROC)   g_print("audiosink:   Has coprocessor\n");
-    if (sink->caps & DSP_CAP_TRIGGER)  g_print("audiosink:   Trigger\n");
-    if (sink->caps & DSP_CAP_MMAP)     g_print("audiosink:   Direct access\n");
-
-    g_print("audiosink: opened audio with fd=%d\n", sink->fd);
-    GST_FLAG_SET (sink, GST_AUDIOSINK_OPEN);
-
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-static void
-gst_audiosink_close_audio (GstAudioSink *sink)
-{
-  if (sink->fd < 0) return;
-
-  close(sink->fd);
-  sink->fd = -1;
-
-  GST_FLAG_UNSET (sink, GST_AUDIOSINK_OPEN);
-
-  g_print("audiosink: closed sound device\n");
-}
-
-static GstElementStateReturn 
-gst_audiosink_change_state (GstElement *element) 
-{
-  g_return_val_if_fail (GST_IS_AUDIOSINK (element), FALSE);
-
-  /* if going down into NULL state, close the file if it's open */ 
-  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
-    if (GST_FLAG_IS_SET (element, GST_AUDIOSINK_OPEN))
-      gst_audiosink_close_audio (GST_AUDIOSINK (element));
-  /* otherwise (READY or higher) we need to open the sound card */
-  } else {
-    if (!GST_FLAG_IS_SET (element, GST_AUDIOSINK_OPEN)) {
-      if (!gst_audiosink_open_audio (GST_AUDIOSINK (element))) {
-        //return GST_STATE_FAILURE;
-      }
-    }
-  }
-      
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
-  return GST_STATE_SUCCESS;
-}
-
-gboolean 
-gst_audiosink_factory_init (GstElementFactory *factory) 
-{ 
-  gst_audiosink_sink_template = gst_padtemplate_new (&audiosink_sink_factory);
-  gst_elementfactory_add_padtemplate (factory, gst_audiosink_sink_template);
-
-  return TRUE;
-}
-
diff --git a/gst/elements/gstaudiosink.h b/gst/elements/gstaudiosink.h
deleted file mode 100644 (file)
index d523392..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosink.h: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_AUDIOSINK_H__
-#define __GST_AUDIOSINK_H__
-
-
-#include <config.h>
-#include <gst/gst.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-GstElementDetails gst_audiosink_details;
-
-
-#define GST_TYPE_AUDIOSINK \
-  (gst_audiosink_get_type())
-#define GST_AUDIOSINK(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_AUDIOSINK,GstAudioSink))
-#define GST_AUDIOSINK_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOSINK,GstAudioSinkClass))
-#define GST_IS_AUDIOSINK(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSINK))
-#define GST_IS_AUDIOSINK_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSINK))
-
-typedef enum {
-  GST_AUDIOSINK_OPEN           = GST_ELEMENT_FLAG_LAST,
-
-  GST_AUDIOSINK_FLAG_LAST      = GST_ELEMENT_FLAG_LAST+2,
-} GstAudioSinkFlags;
-
-typedef struct _GstAudioSink GstAudioSink;
-typedef struct _GstAudioSinkClass GstAudioSinkClass;
-
-struct _GstAudioSink {
-  GstElement element;
-
-  GstPad *sinkpad;
-
-  //GstClockTime clocktime;
-  GstClock *clock;
-  /* soundcard state */
-  int fd;
-  int caps; /* the capabilities */
-  gint format;
-  gint channels;
-  gint frequency;
-  gboolean mute;
-};
-
-struct _GstAudioSinkClass {
-  GstElementClass parent_class;
-
-  /* signals */
-  void (*handoff) (GstElement *element,GstPad *pad);
-};
-
-GtkType gst_audiosink_get_type(void);
-
-gboolean gst_audiosink_factory_init(GstElementFactory *factory);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_AUDIOSINK_H__ */
diff --git a/gst/elements/gstaudiosrc.c b/gst/elements/gstaudiosrc.c
deleted file mode 100644 (file)
index b4645fd..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosrc.c: 
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include <gstaudiosrc.h>
-
-
-GstElementDetails gst_audiosrc_details = {
-  "Audio (OSS) Source",
-  "Source/Audio",
-  "Read from the sound card",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
-
-
-/* AudioSrc signals and args */
-enum {
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
-enum {
-  ARG_0,
-  ARG_BYTESPERREAD,
-  ARG_CUROFFSET,
-  ARG_FORMAT,
-  ARG_CHANNELS,
-  ARG_FREQUENCY,
-};
-
-
-static void                    gst_audiosrc_class_init         (GstAudioSrcClass *klass);
-static void                    gst_audiosrc_init               (GstAudioSrc *audiosrc);
-
-static void                    gst_audiosrc_set_arg            (GtkObject *object, GtkArg *arg, guint id);
-static void                    gst_audiosrc_get_arg            (GtkObject *object, GtkArg *arg, guint id);
-static GstElementStateReturn   gst_audiosrc_change_state       (GstElement *element);
-
-static void                    gst_audiosrc_close_audio        (GstAudioSrc *src);
-static gboolean                gst_audiosrc_open_audio         (GstAudioSrc *src);
-static void                    gst_audiosrc_sync_parms         (GstAudioSrc *audiosrc);
-
-static GstBuffer *             gst_audiosrc_get                (GstPad *pad);
-
-static GstElementClass *parent_class = NULL;
-//static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
-
-GtkType
-gst_audiosrc_get_type (void) 
-{
-  static GtkType audiosrc_type = 0;
-
-  if (!audiosrc_type) {
-    static const GtkTypeInfo audiosrc_info = {
-      "GstAudioSrc",
-      sizeof(GstAudioSrc),
-      sizeof(GstAudioSrcClass),
-      (GtkClassInitFunc)gst_audiosrc_class_init,
-      (GtkObjectInitFunc)gst_audiosrc_init,
-      (GtkArgSetFunc)gst_audiosrc_set_arg,
-      (GtkArgGetFunc)gst_audiosrc_get_arg,
-      (GtkClassInitFunc)NULL,
-    };
-    audiosrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &audiosrc_info);
-  }
-  return audiosrc_type;
-}
-
-static void
-gst_audiosrc_class_init (GstAudioSrcClass *klass) 
-{
-  GtkObjectClass *gtkobject_class;
-  GstElementClass *gstelement_class;
-
-  gtkobject_class = (GtkObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
-
-  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
-
-  gtk_object_add_arg_type ("GstAudioSrc::bytes_per_read", GTK_TYPE_ULONG,
-                           GTK_ARG_READWRITE, ARG_BYTESPERREAD);
-  gtk_object_add_arg_type ("GstAudioSrc::curoffset", GTK_TYPE_ULONG,
-                           GTK_ARG_READABLE, ARG_CUROFFSET);
-  gtk_object_add_arg_type ("GstAudioSrc::format", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FORMAT);
-  gtk_object_add_arg_type ("GstAudioSrc::channels", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_CHANNELS);
-  gtk_object_add_arg_type ("GstAudioSrc::frequency", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FREQUENCY);
-
-  gtkobject_class->set_arg = gst_audiosrc_set_arg;
-  gtkobject_class->get_arg = gst_audiosrc_get_arg;
-
-  gstelement_class->change_state = gst_audiosrc_change_state;
-}
-
-static void 
-gst_audiosrc_init (GstAudioSrc *audiosrc) 
-{
-  audiosrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
-  gst_pad_set_get_function(audiosrc->srcpad,gst_audiosrc_get);
-  gst_element_add_pad (GST_ELEMENT (audiosrc), audiosrc->srcpad);
-
-  audiosrc->fd = -1;
-
-//  audiosrc->meta = (MetaAudioRaw *)gst_meta_new();
-//  audiosrc->meta->format = AFMT_S16_LE;
-//  audiosrc->meta->channels = 2;
-//  audiosrc->meta->frequency = 44100;
-//  audiosrc->meta->bps = 4;
-
-  audiosrc->bytes_per_read = 4096;
-  audiosrc->curoffset = 0;
-  audiosrc->seq = 0;
-}
-
-static GstBuffer *
-gst_audiosrc_get (GstPad *pad)
-{
-  GstAudioSrc *src;
-  GstBuffer *buf;
-  glong readbytes;
-
-  g_return_val_if_fail (pad != NULL, NULL);
-  src = GST_AUDIOSRC(gst_pad_get_parent (pad));
-
-//  g_print("attempting to read something from soundcard\n");
-
-  buf = gst_buffer_new ();
-  g_return_val_if_fail (buf, NULL);
-  
-  GST_BUFFER_DATA (buf) = (gpointer)g_malloc (src->bytes_per_read);
-
-  readbytes = read (src->fd,GST_BUFFER_DATA (buf),
-                    src->bytes_per_read);
-
-  if (readbytes == 0) {
-    gst_element_signal_eos (GST_ELEMENT (src));
-    return NULL;
-  }
-
-  GST_BUFFER_SIZE (buf) = readbytes;
-  GST_BUFFER_OFFSET (buf) = src->curoffset;
-  
-  src->curoffset += readbytes;
-
-//  gst_buffer_add_meta(buf,GST_META(newmeta));
-
-//  g_print("pushed buffer from soundcard of %d bytes\n",readbytes);
-  return buf;
-}
-
-static void 
-gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSrc *src;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSRC (object));
-  
-  src = GST_AUDIOSRC (object);
-
-  switch (id) {
-    case ARG_BYTESPERREAD:
-      src->bytes_per_read = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_FORMAT:
-      src->format = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_CHANNELS:
-      src->channels = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_FREQUENCY:
-      src->frequency = GTK_VALUE_INT (*arg);
-      break;
-    default:
-      break;
-  }
-}
-
-static void 
-gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSrc *src;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSRC (object));
-  
-  src = GST_AUDIOSRC (object);
-
-  switch (id) {
-    case ARG_BYTESPERREAD:
-      GTK_VALUE_INT (*arg) = src->bytes_per_read;
-      break;
-    case ARG_FORMAT:
-      GTK_VALUE_INT (*arg) = src->format;
-      break;
-    case ARG_CHANNELS:
-      GTK_VALUE_INT (*arg) = src->channels;
-      break;
-    case ARG_FREQUENCY:
-      GTK_VALUE_INT (*arg) = src->frequency;
-      break;
-    default:
-      arg->type = GTK_TYPE_INVALID;
-      break;
-  }
-}
-
-static GstElementStateReturn 
-gst_audiosrc_change_state (GstElement *element) 
-{
-  g_return_val_if_fail (GST_IS_AUDIOSRC (element), FALSE);
-
-  /* if going down into NULL state, close the file if it's open */
-  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
-    if (GST_FLAG_IS_SET (element, GST_AUDIOSRC_OPEN))
-      gst_audiosrc_close_audio (GST_AUDIOSRC (element));
-  /* otherwise (READY or higher) we need to open the sound card */
-  } else {
-    if (!GST_FLAG_IS_SET (element, GST_AUDIOSRC_OPEN)) { 
-      if (!gst_audiosrc_open_audio (GST_AUDIOSRC (element)))
-        return GST_STATE_FAILURE;
-    }
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
-  
-  return GST_STATE_SUCCESS;
-}
-
-static gboolean 
-gst_audiosrc_open_audio (GstAudioSrc *src) 
-{
-  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN), FALSE);
-
-  /* first try to open the sound card */
-  src->fd = open("/dev/dsp", O_RDONLY);
-
-  /* if we have it, set the default parameters and go have fun */ 
-  if (src->fd > 0) {
-    int arg = 0x7fff0006;
-
-    if (ioctl (src->fd, SNDCTL_DSP_SETFRAGMENT, &arg)) perror("uh");
-
-    /* set card state */
-    gst_audiosrc_sync_parms (src);
-    GST_DEBUG (0,"opened audio\n");
-    
-    GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-static void 
-gst_audiosrc_close_audio (GstAudioSrc *src) 
-{
-  g_return_if_fail (GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN));
-
-  close(src->fd);
-  src->fd = -1;
-
-  GST_FLAG_UNSET (src, GST_AUDIOSRC_OPEN);
-}
-
-static void 
-gst_audiosrc_sync_parms (GstAudioSrc *audiosrc) 
-{
-  audio_buf_info ospace;
-  
-  g_return_if_fail (audiosrc != NULL);
-  g_return_if_fail (GST_IS_AUDIOSRC (audiosrc));
-  g_return_if_fail (audiosrc->fd > 0);
-  ioctl(audiosrc->fd, SNDCTL_DSP_RESET, 0);
-  ioctl(audiosrc->fd, SNDCTL_DSP_SETFMT, &audiosrc->format);
-  ioctl(audiosrc->fd, SNDCTL_DSP_CHANNELS, &audiosrc->channels);
-  ioctl(audiosrc->fd, SNDCTL_DSP_SPEED, &audiosrc->frequency);
-  
-  ioctl(audiosrc->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-  g_print("setting sound card to %dKHz %d bit %s (%d bytes buffer)\n",
-          audiosrc->frequency,audiosrc->format,
-          (audiosrc->channels == 2) ? "stereo" : "mono",ospace.bytes);
-
-//  audiosrc->meta.format = audiosrc->format;
-//  audiosrc->meta.channels = audiosrc->channels;
-//  audiosrc->meta.frequency = audiosrc->frequency;
-//  audiosrc->sentmeta = FALSE;
-}
diff --git a/gst/elements/gstaudiosrc.h b/gst/elements/gstaudiosrc.h
deleted file mode 100644 (file)
index b4bbfc0..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosrc.h: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_AUDIOSRC_H__
-#define __GST_AUDIOSRC_H__
-
-
-#include <config.h>
-#include <gst/gst.h>
-#include <gst/meta/audioraw.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-GstElementDetails gst_audiosrc_details;
-
-
-#define GST_TYPE_AUDIOSRC \
-  (gst_audiosrc_get_type())
-#define GST_AUDIOSRC(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_AUDIOSRC,GstAudioSrc))
-#define GST_AUDIOSRC_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOSRC,GstAudioSrcClass))
-#define GST_IS_AUDIOSRC(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSRC))
-#define GST_IS_AUDIOSRC_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC))
-
-typedef enum {
-  GST_AUDIOSRC_OPEN            = GST_ELEMENT_FLAG_LAST,
-
-  GST_AUDIOSRC_FLAG_LAST       = GST_ELEMENT_FLAG_LAST+2,
-} GstAudioSrcFlags;
-
-typedef struct _GstAudioSrc GstAudioSrc;
-typedef struct _GstAudioSrcClass GstAudioSrcClass;
-
-struct _GstAudioSrc {
-  GstElement element;
-
-  /* pads */
-  GstPad *srcpad;
-
-  /* sound card */
-  gint fd;
-
-  /* audio parameters */
-  gint format;
-  gint channels;
-  gint frequency;
-
-  /* blocking */
-  gulong curoffset;
-  gulong bytes_per_read;
-
-  gulong seq;
-
-  MetaAudioRaw *meta;
-};
-
-struct _GstAudioSrcClass {
-  GstElementClass parent_class;
-};
-
-GtkType gst_audiosrc_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_AUDIOSRC_H__ */
index 62b5a92..326d0e3 100644 (file)
 
 #include <gst/gst.h>
 
-#include "gstaudiosink.h"
-#include "gstaudiosrc.h"
 #include "gstdisksrc.h"
 #include "gstidentity.h"
 #include "gstfakesink.h"
 #include "gstfakesrc.h"
 #include "gstfdsink.h"
 #include "gstfdsrc.h"
+#include "gstmultidisksrc.h"
 #include "gstpipefilter.h"
 #include "gstsinesrc.h"
 #include "gsttee.h"
@@ -50,12 +49,11 @@ struct _elements_entry {
 static struct _elements_entry _elements[] = {
   { "fakesrc",             gst_fakesrc_get_type,       &gst_fakesrc_details,           NULL },
   { "fakesink",     gst_fakesink_get_type,     &gst_fakesink_details,          NULL },
-  { "audiosink",    gst_audiosink_get_type,    &gst_audiosink_details,         gst_audiosink_factory_init },
-  { "audiosrc",     gst_audiosrc_get_type,     &gst_audiosrc_details,          NULL },
   { "disksrc",             gst_disksrc_get_type,       &gst_disksrc_details,           NULL },
   { "identity",     gst_identity_get_type,     &gst_identity_details,          NULL },
   { "fdsink",       gst_fdsink_get_type,       &gst_fdsink_details,            NULL },
   { "fdsrc",       gst_fdsrc_get_type,         &gst_fdsrc_details,             NULL },
+  { "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details,      NULL },
   { "pipefilter",   gst_pipefilter_get_type,   &gst_pipefilter_details,        NULL },
   { "sinesrc",             gst_sinesrc_get_type,       &gst_sinesrc_details,           NULL },
   { "tee",                 gst_tee_get_type,           &gst_tee_details,               gst_tee_factory_init },
diff --git a/gst/elements/gstmultidisksrc.c b/gst/elements/gstmultidisksrc.c
new file mode 100644 (file)
index 0000000..726aed9
--- /dev/null
@@ -0,0 +1,305 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.c:
+ *
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+//#define GST_DEBUG_ENABLED
+
+#include "gstmultidisksrc.h"
+
+GstElementDetails gst_multidisksrc_details = {
+  "Multi Disk Source",
+  "Source/File",
+  "Read from multiple files in order",
+  VERSION,
+  "Dominic Ludlam <dom@openfx.org>",
+  "(C) 2001",
+};
+
+/* DiskSrc signals and args */
+enum {
+  NEW_FILE,
+  LAST_SIGNAL
+};
+
+enum {
+  ARG_0,
+  ARG_LOCATIONS,
+};
+
+static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
+static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
+
+static void            gst_multidisksrc_set_arg        (GtkObject *object, GtkArg *arg, guint id);
+static void            gst_multidisksrc_get_arg        (GtkObject *object, GtkArg *arg, guint id);
+
+static GstBuffer *     gst_multidisksrc_get            (GstPad *pad);
+//static GstBuffer *   gst_multidisksrc_get_region     (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
+
+static GstElementStateReturn   gst_multidisksrc_change_state   (GstElement *element);
+
+static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
+static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
+
+static GstElementClass *parent_class = NULL;
+static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
+
+GtkType
+gst_multidisksrc_get_type(void)
+{
+  static GtkType multidisksrc_type = 0;
+
+  if (!multidisksrc_type) {
+    static const GtkTypeInfo multidisksrc_info = {
+      "GstMultiDiskSrc",
+      sizeof(GstMultiDiskSrc),
+      sizeof(GstMultiDiskSrcClass),
+      (GtkClassInitFunc)gst_multidisksrc_class_init,
+      (GtkObjectInitFunc)gst_multidisksrc_init,
+      (GtkArgSetFunc)gst_multidisksrc_set_arg,
+      (GtkArgGetFunc)gst_multidisksrc_get_arg,
+      (GtkClassInitFunc)NULL,
+    };
+    multidisksrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &multidisksrc_info);
+  }
+  return multidisksrc_type;
+}
+
+static void
+gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
+{
+  GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
+
+  gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
+
+  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
+
+  gst_multidisksrc_signals[NEW_FILE] =
+    gtk_signal_new ("new_file", GTK_RUN_LAST, gtkobject_class->type,
+                    GTK_SIGNAL_OFFSET (GstMultiDiskSrcClass, new_file),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GTK_TYPE_POINTER);
+  gtk_object_class_add_signals (gtkobject_class, gst_multidisksrc_signals, LAST_SIGNAL);
+
+  gtk_object_add_arg_type ("GstMultiDiskSrc::locations", GTK_TYPE_POINTER,
+                           GTK_ARG_READWRITE, ARG_LOCATIONS);
+
+  gtkobject_class->set_arg = gst_multidisksrc_set_arg;
+  gtkobject_class->get_arg = gst_multidisksrc_get_arg;
+
+  gstelement_class->change_state = gst_multidisksrc_change_state;
+}
+
+static void
+gst_multidisksrc_init (GstMultiDiskSrc *multidisksrc)
+{
+//  GST_FLAG_SET (disksrc, GST_SRC_);
+
+  multidisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+  gst_pad_set_get_function (multidisksrc->srcpad,gst_multidisksrc_get);
+//  gst_pad_set_getregion_function (multidisksrc->srcpad,gst_multidisksrc_get_region);
+  gst_element_add_pad (GST_ELEMENT (multidisksrc), multidisksrc->srcpad);
+
+  multidisksrc->listptr = NULL;
+  multidisksrc->currentfilename = NULL;
+  multidisksrc->fd = 0;
+  multidisksrc->size = 0;
+  multidisksrc->map = NULL;
+  multidisksrc->new_seek = FALSE;
+}
+
+static void
+gst_multidisksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch(id) {
+    case ARG_LOCATIONS:
+      /* the element must be stopped in order to do this */
+      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
+
+      /* clear the filename if we get a NULL */
+      if (GTK_VALUE_POINTER (*arg) == NULL) {
+        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
+        src->listptr = NULL;
+      /* otherwise set the new filenames */
+      } else {
+        src->listptr = GTK_VALUE_POINTER(*arg);
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+static void
+gst_multidisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch (id) {
+    case ARG_LOCATIONS:
+      GTK_VALUE_POINTER (*arg) = src->listptr;
+      break;
+    default:
+      arg->type = GTK_TYPE_INVALID;
+      break;
+  }
+}
+
+/**
+ * gst_disksrc_get:
+ * @pad: #GstPad to push a buffer from
+ *
+ * Push a new buffer from the disksrc at the current offset.
+ */
+static GstBuffer *
+gst_multidisksrc_get (GstPad *pad)
+{
+  GstMultiDiskSrc *src;
+  GstBuffer *buf;
+  GSList *list;
+
+  g_return_val_if_fail (pad != NULL, NULL);
+  src = GST_MULTIDISKSRC (gst_pad_get_parent (pad));
+
+  if (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN))
+    gst_multidisksrc_close_file(src);
+
+  if (!src->listptr) {
+      gst_pad_set_eos(pad);
+      return FALSE;
+  }
+
+  list = src->listptr;
+  src->currentfilename = (gchar *) list->data;
+  src->listptr = src->listptr->next;
+
+  if (!gst_multidisksrc_open_file(src, pad))
+      return NULL;
+
+  // emitted after the open, as the user may free the list and string from here
+  gtk_signal_emit(GTK_OBJECT(src), gst_multidisksrc_signals[NEW_FILE], list);
+
+  /* create the buffer */
+  // FIXME: should eventually use a bufferpool for this
+  buf = gst_buffer_new ();
+
+  g_return_val_if_fail (buf != NULL, NULL);
+
+  /* simply set the buffer to point to the correct region of the file */
+  GST_BUFFER_DATA (buf) = src->map;
+  GST_BUFFER_OFFSET (buf) = 0;
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
+
+  if (src->new_seek) {
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+    src->new_seek = FALSE;
+  }
+
+  /* we're done, return the buffer */
+  return buf;
+}
+
+/* open the file and mmap it, necessary to go to READY state */
+static
+gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN), FALSE);
+
+  /* open the file */
+  src->fd = open ((const char *) src->currentfilename, O_RDONLY);
+
+  if (src->fd < 0) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
+    return FALSE;
+  } else {
+    /* find the file length */
+    src->size = lseek (src->fd, 0, SEEK_END);
+    lseek (src->fd, 0, SEEK_SET);
+    /* map the file into memory */
+    src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
+    madvise (src->map,src->size, 2);
+    /* collapse state if that failed */
+    if (src->map == NULL) {
+      close (src->fd);
+      gst_element_error (GST_ELEMENT (src),"mmapping file");
+      return FALSE;
+    }
+    GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
+    src->new_seek = TRUE;
+  }
+  return TRUE;
+}
+
+/* unmap and close the file */
+static void
+gst_multidisksrc_close_file (GstMultiDiskSrc *src)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN));
+
+  /* unmap the file from memory and close the file */
+  munmap (src->map, src->size);
+  close (src->fd);
+
+  /* zero out a lot of our state */
+  src->fd = 0;
+  src->size = 0;
+  src->map = NULL;
+  src->new_seek = FALSE;
+
+  GST_FLAG_UNSET (src, GST_MULTIDISKSRC_OPEN);
+}
+
+static GstElementStateReturn
+gst_multidisksrc_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_MULTIDISKSRC (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_MULTIDISKSRC_OPEN))
+      gst_multidisksrc_close_file (GST_MULTIDISKSRC (element));
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
diff --git a/gst/elements/gstmultidisksrc.h b/gst/elements/gstmultidisksrc.h
new file mode 100644 (file)
index 0000000..ed4a94c
--- /dev/null
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.h: 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MULTIDISKSRC_H__
+#define __GST_MULTIDISKSRC_H__
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+GstElementDetails gst_multidisksrc_details;
+
+#define GST_TYPE_MULTIDISKSRC \
+  (gst_multidisksrc_get_type())
+#define GST_MULTIDISKSRC(obj) \
+  (GTK_CHECK_CAST((obj),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrc))
+#define GST_MULTIDISKSRC_CLASS(klass) \
+  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrcClass))
+#define GST_IS_MULTIDISKSRC(obj) \
+  (GTK_CHECK_TYPE((obj),GST_TYPE_MULTIDISKSRC))
+#define GST_IS_MULTIDISKSRC_CLASS(obj) \
+  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIDISKSRC))
+
+typedef enum {
+  GST_MULTIDISKSRC_OPEN                = GST_ELEMENT_FLAG_LAST,
+
+  GST_MULTIDISKSRC_FLAG_LAST   = GST_ELEMENT_FLAG_LAST + 2,
+} GstMultiDiskSrcFlags;
+
+typedef struct _GstMultiDiskSrc GstMultiDiskSrc;
+typedef struct _GstMultiDiskSrcClass GstMultiDiskSrcClass;
+
+struct _GstMultiDiskSrc {
+  GstElement element;
+  /* pads */
+  GstPad *srcpad;
+
+  /* current file details */
+  gchar  *currentfilename;
+  GSList *listptr;
+
+  /* mapping parameters */
+  gint fd;
+  gulong size;    /* how long is the file? */
+  guchar *map;    /* where the file is mapped to */
+
+  gboolean new_seek;
+};
+
+struct _GstMultiDiskSrcClass {
+  GstElementClass parent_class;
+
+  void (*new_file)  (GstMultiDiskSrc *multidisksrc, gchar *newfilename);
+};
+
+GtkType gst_multidisksrc_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_MULTIDISKSRC_H__ */
diff --git a/gst/elements/gstmultifilesrc.c b/gst/elements/gstmultifilesrc.c
new file mode 100644 (file)
index 0000000..726aed9
--- /dev/null
@@ -0,0 +1,305 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.c:
+ *
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+//#define GST_DEBUG_ENABLED
+
+#include "gstmultidisksrc.h"
+
+GstElementDetails gst_multidisksrc_details = {
+  "Multi Disk Source",
+  "Source/File",
+  "Read from multiple files in order",
+  VERSION,
+  "Dominic Ludlam <dom@openfx.org>",
+  "(C) 2001",
+};
+
+/* DiskSrc signals and args */
+enum {
+  NEW_FILE,
+  LAST_SIGNAL
+};
+
+enum {
+  ARG_0,
+  ARG_LOCATIONS,
+};
+
+static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
+static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
+
+static void            gst_multidisksrc_set_arg        (GtkObject *object, GtkArg *arg, guint id);
+static void            gst_multidisksrc_get_arg        (GtkObject *object, GtkArg *arg, guint id);
+
+static GstBuffer *     gst_multidisksrc_get            (GstPad *pad);
+//static GstBuffer *   gst_multidisksrc_get_region     (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
+
+static GstElementStateReturn   gst_multidisksrc_change_state   (GstElement *element);
+
+static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
+static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
+
+static GstElementClass *parent_class = NULL;
+static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
+
+GtkType
+gst_multidisksrc_get_type(void)
+{
+  static GtkType multidisksrc_type = 0;
+
+  if (!multidisksrc_type) {
+    static const GtkTypeInfo multidisksrc_info = {
+      "GstMultiDiskSrc",
+      sizeof(GstMultiDiskSrc),
+      sizeof(GstMultiDiskSrcClass),
+      (GtkClassInitFunc)gst_multidisksrc_class_init,
+      (GtkObjectInitFunc)gst_multidisksrc_init,
+      (GtkArgSetFunc)gst_multidisksrc_set_arg,
+      (GtkArgGetFunc)gst_multidisksrc_get_arg,
+      (GtkClassInitFunc)NULL,
+    };
+    multidisksrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &multidisksrc_info);
+  }
+  return multidisksrc_type;
+}
+
+static void
+gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
+{
+  GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
+
+  gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
+
+  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
+
+  gst_multidisksrc_signals[NEW_FILE] =
+    gtk_signal_new ("new_file", GTK_RUN_LAST, gtkobject_class->type,
+                    GTK_SIGNAL_OFFSET (GstMultiDiskSrcClass, new_file),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GTK_TYPE_POINTER);
+  gtk_object_class_add_signals (gtkobject_class, gst_multidisksrc_signals, LAST_SIGNAL);
+
+  gtk_object_add_arg_type ("GstMultiDiskSrc::locations", GTK_TYPE_POINTER,
+                           GTK_ARG_READWRITE, ARG_LOCATIONS);
+
+  gtkobject_class->set_arg = gst_multidisksrc_set_arg;
+  gtkobject_class->get_arg = gst_multidisksrc_get_arg;
+
+  gstelement_class->change_state = gst_multidisksrc_change_state;
+}
+
+static void
+gst_multidisksrc_init (GstMultiDiskSrc *multidisksrc)
+{
+//  GST_FLAG_SET (disksrc, GST_SRC_);
+
+  multidisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+  gst_pad_set_get_function (multidisksrc->srcpad,gst_multidisksrc_get);
+//  gst_pad_set_getregion_function (multidisksrc->srcpad,gst_multidisksrc_get_region);
+  gst_element_add_pad (GST_ELEMENT (multidisksrc), multidisksrc->srcpad);
+
+  multidisksrc->listptr = NULL;
+  multidisksrc->currentfilename = NULL;
+  multidisksrc->fd = 0;
+  multidisksrc->size = 0;
+  multidisksrc->map = NULL;
+  multidisksrc->new_seek = FALSE;
+}
+
+static void
+gst_multidisksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch(id) {
+    case ARG_LOCATIONS:
+      /* the element must be stopped in order to do this */
+      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
+
+      /* clear the filename if we get a NULL */
+      if (GTK_VALUE_POINTER (*arg) == NULL) {
+        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
+        src->listptr = NULL;
+      /* otherwise set the new filenames */
+      } else {
+        src->listptr = GTK_VALUE_POINTER(*arg);
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+static void
+gst_multidisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch (id) {
+    case ARG_LOCATIONS:
+      GTK_VALUE_POINTER (*arg) = src->listptr;
+      break;
+    default:
+      arg->type = GTK_TYPE_INVALID;
+      break;
+  }
+}
+
+/**
+ * gst_disksrc_get:
+ * @pad: #GstPad to push a buffer from
+ *
+ * Push a new buffer from the disksrc at the current offset.
+ */
+static GstBuffer *
+gst_multidisksrc_get (GstPad *pad)
+{
+  GstMultiDiskSrc *src;
+  GstBuffer *buf;
+  GSList *list;
+
+  g_return_val_if_fail (pad != NULL, NULL);
+  src = GST_MULTIDISKSRC (gst_pad_get_parent (pad));
+
+  if (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN))
+    gst_multidisksrc_close_file(src);
+
+  if (!src->listptr) {
+      gst_pad_set_eos(pad);
+      return FALSE;
+  }
+
+  list = src->listptr;
+  src->currentfilename = (gchar *) list->data;
+  src->listptr = src->listptr->next;
+
+  if (!gst_multidisksrc_open_file(src, pad))
+      return NULL;
+
+  // emitted after the open, as the user may free the list and string from here
+  gtk_signal_emit(GTK_OBJECT(src), gst_multidisksrc_signals[NEW_FILE], list);
+
+  /* create the buffer */
+  // FIXME: should eventually use a bufferpool for this
+  buf = gst_buffer_new ();
+
+  g_return_val_if_fail (buf != NULL, NULL);
+
+  /* simply set the buffer to point to the correct region of the file */
+  GST_BUFFER_DATA (buf) = src->map;
+  GST_BUFFER_OFFSET (buf) = 0;
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
+
+  if (src->new_seek) {
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+    src->new_seek = FALSE;
+  }
+
+  /* we're done, return the buffer */
+  return buf;
+}
+
+/* open the file and mmap it, necessary to go to READY state */
+static
+gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN), FALSE);
+
+  /* open the file */
+  src->fd = open ((const char *) src->currentfilename, O_RDONLY);
+
+  if (src->fd < 0) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
+    return FALSE;
+  } else {
+    /* find the file length */
+    src->size = lseek (src->fd, 0, SEEK_END);
+    lseek (src->fd, 0, SEEK_SET);
+    /* map the file into memory */
+    src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
+    madvise (src->map,src->size, 2);
+    /* collapse state if that failed */
+    if (src->map == NULL) {
+      close (src->fd);
+      gst_element_error (GST_ELEMENT (src),"mmapping file");
+      return FALSE;
+    }
+    GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
+    src->new_seek = TRUE;
+  }
+  return TRUE;
+}
+
+/* unmap and close the file */
+static void
+gst_multidisksrc_close_file (GstMultiDiskSrc *src)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN));
+
+  /* unmap the file from memory and close the file */
+  munmap (src->map, src->size);
+  close (src->fd);
+
+  /* zero out a lot of our state */
+  src->fd = 0;
+  src->size = 0;
+  src->map = NULL;
+  src->new_seek = FALSE;
+
+  GST_FLAG_UNSET (src, GST_MULTIDISKSRC_OPEN);
+}
+
+static GstElementStateReturn
+gst_multidisksrc_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_MULTIDISKSRC (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_MULTIDISKSRC_OPEN))
+      gst_multidisksrc_close_file (GST_MULTIDISKSRC (element));
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
diff --git a/gst/elements/gstmultifilesrc.h b/gst/elements/gstmultifilesrc.h
new file mode 100644 (file)
index 0000000..ed4a94c
--- /dev/null
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.h: 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MULTIDISKSRC_H__
+#define __GST_MULTIDISKSRC_H__
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+GstElementDetails gst_multidisksrc_details;
+
+#define GST_TYPE_MULTIDISKSRC \
+  (gst_multidisksrc_get_type())
+#define GST_MULTIDISKSRC(obj) \
+  (GTK_CHECK_CAST((obj),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrc))
+#define GST_MULTIDISKSRC_CLASS(klass) \
+  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrcClass))
+#define GST_IS_MULTIDISKSRC(obj) \
+  (GTK_CHECK_TYPE((obj),GST_TYPE_MULTIDISKSRC))
+#define GST_IS_MULTIDISKSRC_CLASS(obj) \
+  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIDISKSRC))
+
+typedef enum {
+  GST_MULTIDISKSRC_OPEN                = GST_ELEMENT_FLAG_LAST,
+
+  GST_MULTIDISKSRC_FLAG_LAST   = GST_ELEMENT_FLAG_LAST + 2,
+} GstMultiDiskSrcFlags;
+
+typedef struct _GstMultiDiskSrc GstMultiDiskSrc;
+typedef struct _GstMultiDiskSrcClass GstMultiDiskSrcClass;
+
+struct _GstMultiDiskSrc {
+  GstElement element;
+  /* pads */
+  GstPad *srcpad;
+
+  /* current file details */
+  gchar  *currentfilename;
+  GSList *listptr;
+
+  /* mapping parameters */
+  gint fd;
+  gulong size;    /* how long is the file? */
+  guchar *map;    /* where the file is mapped to */
+
+  gboolean new_seek;
+};
+
+struct _GstMultiDiskSrcClass {
+  GstElementClass parent_class;
+
+  void (*new_file)  (GstMultiDiskSrc *multidisksrc, gchar *newfilename);
+};
+
+GtkType gst_multidisksrc_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_MULTIDISKSRC_H__ */
index 9d46555..5a4e4ab 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
@@ -135,9 +131,10 @@ static void gst_sinesrc_init(GstSineSrc *src) {
   src->volume = 1.0;
   gst_sinesrc_update_vol_scale(src);
 
-  src->format = AFMT_S16_LE;
+  src->format = 16;
   src->samplerate = 44100;
   src->freq = 100.0;
+  src->newcaps = FALSE;
   
   src->table_pos = 0.0;
   src->table_size = 1024;
@@ -148,7 +145,6 @@ static void gst_sinesrc_init(GstSineSrc *src) {
   
   src->seq = 0;
 
-  src->sentmeta = FALSE;
 }
 
 static GstBuffer *
@@ -197,11 +193,8 @@ gst_sinesrc_get(GstPad *pad)
                  )* src->vol_scale;
   }
 
-  if (!src->sentmeta) {
-    MetaAudioRaw *newmeta = g_new(MetaAudioRaw,1);
-    memcpy(newmeta,&src->meta,sizeof(MetaAudioRaw));
-    gst_buffer_add_meta(buf,GST_META(newmeta));
-    src->sentmeta = TRUE;
+  if (src->newcaps) {
+    src->newcaps = FALSE;
   }
 
   //g_print(">");
@@ -316,7 +309,7 @@ static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
     table[i] = (gfloat)sin(i * pi2scaled);
   }
   
-       g_free(src->table_data);
+  g_free(src->table_data);
   src->table_data = table;
 }
 
@@ -331,8 +324,5 @@ static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src)
 }
 
 void gst_sinesrc_sync_parms(GstSineSrc *src) {
-  src->meta.format = src->format;
-  src->meta.channels = 1;
-  src->meta.frequency = src->samplerate;
-  src->sentmeta = FALSE;
+  src->newcaps = TRUE;
 }
index 82803f7..167a1ad 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <config.h>
 #include <gst/gst.h>
-#include <gst/meta/audioraw.h>
-
 
 #ifdef __cplusplus
 extern "C" {
@@ -79,8 +77,8 @@ struct _GstSineSrc {
   gint buffer_size;
   gulong seq;
 
-  MetaAudioRaw meta;
-  gboolean sentmeta;
+  gboolean newcaps;
+
 };
 
 struct _GstSineSrcClass {
index 84e255d..81191dc 100644 (file)
@@ -83,6 +83,7 @@ gst_caps_new (const gchar *name, const gchar *mime)
   caps->properties = NULL;
   caps->next = NULL;
   caps->refcount = 1;
+  caps->lock = g_mutex_new ();
 
   return caps;
 }
@@ -169,13 +170,18 @@ gst_caps_register_count (GstCapsFactory *factory, guint *counter)
 void
 gst_caps_destroy (GstCaps *caps)
 {
-  g_return_if_fail (caps != NULL);
+  GstCaps *next;
 
-  if (caps->next) 
-    gst_caps_unref (caps->next);
+  g_return_if_fail (caps != NULL);
 
+  GST_CAPS_LOCK (caps);
+  next = caps->next;
   g_free (caps->name);
   g_free (caps);
+  GST_CAPS_UNLOCK (caps);
+
+  if (next) 
+    gst_caps_unref (next);
 }
 
 /**
@@ -188,14 +194,21 @@ gst_caps_destroy (GstCaps *caps)
 void
 gst_caps_unref (GstCaps *caps)
 {
+  gboolean zero;
+  GstCaps *next;
+
   g_return_if_fail (caps != NULL);
 
+  GST_CAPS_LOCK (caps);
   caps->refcount--;
+  zero = (caps->refcount == 0);
+  next = caps->next;
+  GST_CAPS_UNLOCK (caps);
 
-  if (caps->next)
-    gst_caps_unref (caps->next);
+  if (next)
+    gst_caps_unref (next);
 
-  if (caps->refcount == 0)
+  if (zero)
     gst_caps_destroy (caps);
 }
 
@@ -210,7 +223,9 @@ gst_caps_ref (GstCaps *caps)
 {
   g_return_if_fail (caps != NULL);
 
+  GST_CAPS_LOCK (caps);
   caps->refcount++;
+  GST_CAPS_UNLOCK (caps);
 }
 
 /**
@@ -228,10 +243,12 @@ gst_caps_copy (GstCaps *caps)
 
   g_return_val_if_fail (caps != NULL, NULL);
 
+  GST_CAPS_LOCK (caps);
   new = gst_caps_new_with_props (
                  caps->name,
                  (gst_type_find_by_id (caps->id))->mime,
                  gst_props_copy (caps->properties));
+  GST_CAPS_UNLOCK (caps);
 
   return new;
 }
@@ -248,11 +265,16 @@ gst_caps_copy (GstCaps *caps)
 GstCaps*
 gst_caps_copy_on_write (GstCaps *caps)
 {
-  GstCaps *new = caps;;
+  GstCaps *new = caps;
+  gboolean needcopy;
 
   g_return_val_if_fail (caps != NULL, NULL);
 
-  if (caps->refcount > 1) {
+  GST_CAPS_LOCK (caps);
+  needcopy = (caps->refcount > 1);
+  GST_CAPS_UNLOCK (caps);
+
+  if (needcopy) {
     new = gst_caps_copy (caps);
     gst_caps_unref (caps);
   }
@@ -602,6 +624,7 @@ gst_caps_load_thyself (xmlNodePtr parent)
       g_mutex_unlock (_gst_caps_chunk_lock);
 
       caps->refcount = 1;
+      caps->lock = g_mutex_new ();
        
       while (subfield) {
         if (!strcmp (subfield->name, "name")) {
index 2521e7a..71b8213 100644 (file)
@@ -43,11 +43,19 @@ typedef GstCapsFactoryEntry * GstCapsFactory;
 typedef GstCapsFactoryEntry GstCapsFactory[];
 #endif
 
+#define GST_CAPS(caps) \
+  ((GstCaps *)(caps))
+
+#define GST_CAPS_LOCK(caps)    (g_mutex_lock(GST_CAPS(caps)->lock))
+#define GST_CAPS_TRYLOCK(caps) (g_mutex_trylock(GST_CAPS(caps)->lock))
+#define GST_CAPS_UNLOCK(caps)  (g_mutex_unlock(GST_CAPS(caps)->lock))
+
 struct _GstCaps {
   gchar *name;                 /* the name of this caps */
   guint16 id;                  /* type id (major type) */
 
-  guint refcount;
+  guint refcount;              
+  GMutex *lock;                        /* global lock for this capability */
 
   GstProps *properties;                /* properties for this capability */
 
index 0db7710..a56a314 100644 (file)
@@ -41,6 +41,7 @@ static guint _arg_len[] = {
   2,  // GST_PROPS_INT_RANGE_ID_NUM,
   1,  // GST_PROPS_FOURCC_ID_NUM,
   1,  // GST_PROPS_BOOL_ID_NUM,
+  1,  // GST_PROPS_STRING_ID_NUM,
 };
 
 void 
@@ -90,6 +91,10 @@ gst_props_create_entry (GstPropsFactory factory, gint *skipped)
       entry->propstype = GST_PROPS_BOOL_ID_NUM;
       entry->data.bool_data = GPOINTER_TO_INT (factory[i++]);
       break;
+    case GST_PROPS_STRING_ID_NUM:
+      entry->propstype = GST_PROPS_STRING_ID_NUM;
+      entry->data.string_data.string = g_strdup (factory[i++]);
+      break;
     default:
       g_warning ("gstprops: unknown props id found\n");
       g_mutex_lock (_gst_props_entries_chunk_lock);
@@ -355,6 +360,11 @@ gst_props_set (GstProps *props, const gchar *name, GstPropsFactoryEntry entry, .
         value = va_arg (var_args, GstPropsFactoryEntry);
         thisentry->data.bool_data = GPOINTER_TO_INT (value);
         break;
+      case GST_PROPS_STRING_ID_NUM:
+        thisentry->propstype = GST_PROPS_STRING_ID_NUM;
+        value = va_arg (var_args, GstPropsFactoryEntry);
+        thisentry->data.string_data.string = g_strdup (value);
+        break;
       default:
         g_print("gstprops: type not allowed\n");
        break;
@@ -588,6 +598,36 @@ gst_props_get_boolean (GstProps *props, const gchar *name)
 }
 
 /**
+ * gst_props_get_string:
+ * @props: the props to get the fourcc value from
+ * @name: the name of the props entry to get.
+ *
+ * Get the named entry as a string value.
+ *
+ * Returns: the string value of the named entry, NULL if not found.
+ */
+const gchar*
+gst_props_get_string (GstProps *props, const gchar *name)
+{
+  GList *lentry;
+  GQuark quark;
+  
+  quark = g_quark_from_string (name);
+
+  lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
+
+  if (lentry) {
+    GstPropsEntry *thisentry;
+
+    thisentry = (GstPropsEntry *)lentry->data;
+
+    return thisentry->data.string_data.string;
+  }
+  
+  return NULL;
+}
+
+/**
  * gst_props_merge:
  * @props: the property to merge into
  * @tomerge: the property to merge 
@@ -708,6 +748,16 @@ gst_props_entry_check_compatibility (GstPropsEntry *entry1, GstPropsEntry *entry
         default:
           return FALSE;
       }
+    case GST_PROPS_STRING_ID_NUM:
+      switch (entry2->propstype) {
+       // t   <--->   t
+        case GST_PROPS_STRING_ID_NUM:
+          return (!strcmp (entry2->data.string_data.string, entry1->data.string_data.string));
+        case GST_PROPS_LIST_ID_NUM:
+         return gst_props_entry_check_list_compatibility (entry1, entry2);
+        default:
+          return FALSE;
+      }
     default:
       break;
   }
@@ -824,6 +874,11 @@ gst_props_save_thyself_func (GstPropsEntry *entry, xmlNodePtr parent)
       xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
       xmlNewProp (subtree, "value", (entry->data.bool_data ?  "true" : "false"));
       break;
+    case GST_PROPS_STRING_ID_NUM: 
+      subtree = xmlNewChild (parent, NULL, "string", NULL);
+      xmlNewProp (subtree, "name", g_quark_to_string (entry->propid));
+      xmlNewProp (subtree, "value", entry->data.string_data.string);
+      break;
     default:
       break;
   }
@@ -918,6 +973,13 @@ gst_props_load_thyself_func (xmlNodePtr field)
     sscanf (prop, "%08x", &entry->data.fourcc_data);
     g_free (prop);
   }
+  else if (!strcmp(field->name, "string")) {
+    entry->propstype = GST_PROPS_STRING_ID_NUM;
+    prop = xmlGetProp(field, "name");
+    entry->propid = g_quark_from_string (prop);
+    g_free (prop);
+    entry->data.string_data.string = xmlGetProp (field, "value");
+  }
   else {
     g_mutex_lock (_gst_props_entries_chunk_lock);
     g_mem_chunk_free (_gst_props_entries_chunk, entry);
index 5da0492..0c0ec6b 100644 (file)
@@ -47,6 +47,7 @@ typedef enum {
    GST_PROPS_INT_RANGE_ID_NUM,
    GST_PROPS_FOURCC_ID_NUM,
    GST_PROPS_BOOL_ID_NUM,
+   GST_PROPS_STRING_ID_NUM,
    GST_PROPS_LAST_ID_NUM = GST_PROPS_END_ID_NUM + 16,
 } GstPropsId;
 
@@ -56,6 +57,7 @@ typedef enum {
 #define GST_PROPS_INT_RANGE_ID         GINT_TO_POINTER(GST_PROPS_INT_RANGE_ID_NUM)
 #define GST_PROPS_FOURCC_ID    GINT_TO_POINTER(GST_PROPS_FOURCC_ID_NUM)
 #define GST_PROPS_BOOL_ID      GINT_TO_POINTER(GST_PROPS_BOOL_ID_NUM)
+#define GST_PROPS_STRING_ID    GINT_TO_POINTER(GST_PROPS_STRING_ID_NUM)
 #define GST_PROPS_LAST_ID      GINT_TO_POINTER(GST_PROPS_LAST_ID_NUM)
 
 #define GST_PROPS_LIST(a...)           GST_PROPS_LIST_ID,##a,NULL
@@ -64,10 +66,12 @@ typedef enum {
 #define GST_PROPS_FOURCC(a,b,c,d)      GST_PROPS_FOURCC_ID,(GINT_TO_POINTER((a)|(b)<<8|(c)<<16|(d)<<24))
 #define GST_PROPS_FOURCC_INT(a)        GST_PROPS_FOURCC_ID,(GINT_TO_POINTER(a))
 #define GST_PROPS_BOOLEAN(a)           GST_PROPS_BOOL_ID,(GINT_TO_POINTER(a))
+#define GST_PROPS_STRING(a)            GST_PROPS_STRING_ID,(a)
 
 
 struct _GstProps {
   gint refcount;
+  GMutex *lock;
 
   GList *properties;           /* real properties for this property */
 };
@@ -96,6 +100,7 @@ GstProps*    gst_props_set                   (GstProps *props, const gchar *name, GstPropsFactoryEn
 gint           gst_props_get_int               (GstProps *props, const gchar *name);
 gulong         gst_props_get_fourcc_int        (GstProps *props, const gchar *name);
 gboolean       gst_props_get_boolean           (GstProps *props, const gchar *name);
+const gchar*   gst_props_get_string            (GstProps *props, const gchar *name);
 
 xmlNodePtr     gst_props_save_thyself          (GstProps *props, xmlNodePtr parent);
 GstProps*      gst_props_load_thyself          (xmlNodePtr parent);
index 8a5fb05..4f8eec2 100644 (file)
@@ -43,6 +43,9 @@ struct _GstPropsEntry {
       GList *entries;
     } list_data;
     struct {
+      gchar *string;
+    } string_data;
+    struct {
       gint min;
       gint max;
     } int_range_data;
index 59107c0..1ddd911 100644 (file)
@@ -1,4 +1,3 @@
 metaincludedir = $(includedir)/gst/meta
 metainclude_HEADERS =  \
-       audioraw.h \
        videoraw.h
diff --git a/gst/meta/audioraw.h b/gst/meta/audioraw.h
deleted file mode 100644 (file)
index 7c8d52d..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Gnome-Streamer
- * 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.
- */
-
-
-#ifndef __GST_META_AUDIORAW_H__
-#define __GST_META_AUDIORAW_H__
-
-#include <gst/gstmeta.h>
-#include <sys/soundcard.h>
-
-typedef struct _MetaAudioRaw MetaAudioRaw;
-
-struct _MetaAudioRaw {
-  GstMeta meta;
-
-  /* formatting information */
-  gint format;
-  gint channels;
-  gint frequency;
-  gint bps;
-};
-
-#endif /* __GST_META_AUDIORAW_H__ */
-
index 1310588..6f0b651 100644 (file)
@@ -125,7 +125,7 @@ gst_play_init (GstPlay *play)
   priv->bin = gst_bin_new ("main_bin");
   g_assert (priv->bin != NULL);
 
-  priv->audio_element = gst_elementfactory_make ("audiosink", "play_audio");
+  priv->audio_element = gst_elementfactory_make ("osssink", "play_audio");
   g_return_if_fail (priv->audio_element != NULL);
   gtk_signal_connect (GTK_OBJECT (priv->audio_element), "handoff",
                  GTK_SIGNAL_FUNC (gst_play_audio_handoff), play);
index 0c5b9e6..e41a972 100644 (file)
@@ -16,9 +16,8 @@ libgstelements_la_SOURCES =   \
        gstfakesink.c           \
        gstdisksrc.c            \
        gstfdsrc.c              \
-       gstaudiosink.c          \
-       gstaudiosrc.c           \
        gstfdsink.c             \
+       gstmultidisksrc.c       \
        gstpipefilter.c         \
        gsttee.c                \
        gstsinesrc.c            \
@@ -30,9 +29,8 @@ noinst_HEADERS =              \
        gstfakesink.h           \
        gstdisksrc.h            \
        gstfdsrc.h              \
+       gstmultidisksrc.h       \
        gsthttpsrc.h            \
-       gstaudiosink.h          \
-       gstaudiosrc.h           \
        gstfdsink.h             \
        gstpipefilter.h         \
        gsttee.h                \
diff --git a/plugins/elements/gstaudiosink.c b/plugins/elements/gstaudiosink.c
deleted file mode 100644 (file)
index 41a2b6c..0000000
+++ /dev/null
@@ -1,456 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosink.c: 
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
-#include <unistd.h>
-#include <errno.h>
-
-//#define DEBUG_ENABLED
-
-#include <gstaudiosink.h>
-#include <gst/meta/audioraw.h>
-
-
-GstElementDetails gst_audiosink_details = {  
-  "Audio Sink (OSS)",
-  "Sink/Audio",
-  "Output to a sound card via OSS",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
-
-static void                    gst_audiosink_class_init        (GstAudioSinkClass *klass);
-static void                    gst_audiosink_init              (GstAudioSink *audiosink);
-
-static gboolean                gst_audiosink_open_audio        (GstAudioSink *sink);
-static void                    gst_audiosink_close_audio       (GstAudioSink *sink);
-static void                    gst_audiosink_sync_parms        (GstAudioSink *audiosink);
-static GstElementStateReturn   gst_audiosink_change_state      (GstElement *element);
-static GstPadNegotiateReturn   gst_audiosink_negotiate         (GstPad *pad, GstCaps **caps, gint counter);
-
-static void                    gst_audiosink_set_arg           (GtkObject *object, GtkArg *arg, guint id);
-static void                    gst_audiosink_get_arg           (GtkObject *object, GtkArg *arg, guint id);
-
-static void                    gst_audiosink_chain             (GstPad *pad,GstBuffer *buf);
-
-/* AudioSink signals and args */
-enum {
-  SIGNAL_HANDOFF,
-  LAST_SIGNAL
-};
-
-enum {
-  ARG_0,
-  ARG_MUTE,
-  ARG_FORMAT,
-  ARG_CHANNELS,
-  ARG_FREQUENCY,
-  /* FILL ME */
-};
-
-static GstPadFactory audiosink_sink_factory = {
-  "sink",
-  GST_PAD_FACTORY_SINK,
-  GST_PAD_FACTORY_ALWAYS,
-  GST_PAD_FACTORY_CAPS (
-  "audiosink_sink",
-    "audio/raw",
-    "format",   GST_PROPS_INT (AFMT_S16_LE),
-    "depth",    GST_PROPS_LIST (
-                 GST_PROPS_INT (8),
-                 GST_PROPS_INT (16)
-               ),
-    "rate",     GST_PROPS_INT_RANGE (8000, 48000),
-    "channels", GST_PROPS_INT_RANGE (1, 2)
-  ),
-  NULL
-};
-
-#define GST_TYPE_AUDIOSINK_FORMATS (gst_audiosink_formats_get_type())
-
-static GtkType 
-gst_audiosink_formats_get_type(void) {
-  static GtkType audiosink_formats_type = 0;
-  static GtkEnumValue audiosink_formats[] = {
-    {8, "8", "8 Bits"},
-    {16, "16", "16 Bits"},
-    {0, NULL, NULL},
-  };
-  if (!audiosink_formats_type) {
-    audiosink_formats_type = gtk_type_register_enum("GstAudiosinkFormats", audiosink_formats);
-  }
-  return audiosink_formats_type;
-}
-
-#define GST_TYPE_AUDIOSINK_CHANNELS (gst_audiosink_channels_get_type())
-
-static GtkType 
-gst_audiosink_channels_get_type(void) {
-  static GtkType audiosink_channels_type = 0;
-  static GtkEnumValue audiosink_channels[] = {
-    {1, "1", "Mono"},
-    {2, "2", "Stereo"},
-    {0, NULL, NULL},
-  };
-  if (!audiosink_channels_type) {
-    audiosink_channels_type = gtk_type_register_enum("GstAudiosinkChannels", audiosink_channels);
-  }
-  return audiosink_channels_type;
-}
-
-
-static GstElementClass *parent_class = NULL;
-static guint gst_audiosink_signals[LAST_SIGNAL] = { 0 };
-
-static GstPadTemplate *gst_audiosink_sink_template;
-
-GtkType
-gst_audiosink_get_type (void) 
-{
-  static GtkType audiosink_type = 0;
-
-  if (!audiosink_type) {
-    static const GtkTypeInfo audiosink_info = {
-      "GstAudioSink",
-      sizeof(GstAudioSink),
-      sizeof(GstAudioSinkClass),
-      (GtkClassInitFunc)gst_audiosink_class_init,
-      (GtkObjectInitFunc)gst_audiosink_init,
-      (GtkArgSetFunc)NULL,
-      (GtkArgGetFunc)NULL,
-      (GtkClassInitFunc)NULL,
-    };
-    audiosink_type = gtk_type_unique (GST_TYPE_ELEMENT, &audiosink_info);
-  }
-
-  return audiosink_type;
-}
-
-static void
-gst_audiosink_class_init (GstAudioSinkClass *klass) 
-{
-  GtkObjectClass *gtkobject_class;
-  GstElementClass *gstelement_class;
-
-  gtkobject_class = (GtkObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
-
-  parent_class = gtk_type_class(GST_TYPE_ELEMENT);
-
-  gtk_object_add_arg_type ("GstAudioSink::mute", GTK_TYPE_BOOL,
-                           GTK_ARG_READWRITE, ARG_MUTE);
-  gtk_object_add_arg_type ("GstAudioSink::format", GST_TYPE_AUDIOSINK_FORMATS,
-                           GTK_ARG_READWRITE, ARG_FORMAT);
-  gtk_object_add_arg_type ("GstAudioSink::channels", GST_TYPE_AUDIOSINK_CHANNELS,
-                           GTK_ARG_READWRITE, ARG_CHANNELS);
-  gtk_object_add_arg_type ("GstAudioSink::frequency", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FREQUENCY);
-
-  gtkobject_class->set_arg = gst_audiosink_set_arg;
-  gtkobject_class->get_arg = gst_audiosink_get_arg;
-
-  gst_audiosink_signals[SIGNAL_HANDOFF] =
-    gtk_signal_new("handoff",GTK_RUN_LAST,gtkobject_class->type,
-                   GTK_SIGNAL_OFFSET(GstAudioSinkClass,handoff),
-                   gtk_marshal_NONE__NONE,GTK_TYPE_NONE,0);
-  
-  gtk_object_class_add_signals(gtkobject_class,gst_audiosink_signals,
-                               LAST_SIGNAL);
-
-  gstelement_class->change_state = gst_audiosink_change_state;
-}
-
-static void 
-gst_audiosink_init (GstAudioSink *audiosink) 
-{
-  audiosink->sinkpad = gst_pad_new_from_template (gst_audiosink_sink_template, "sink");
-  gst_element_add_pad (GST_ELEMENT (audiosink), audiosink->sinkpad);
-  gst_pad_set_negotiate_function (audiosink->sinkpad, gst_audiosink_negotiate);
-
-  gst_pad_set_chain_function (audiosink->sinkpad, gst_audiosink_chain);
-
-  audiosink->fd = -1;
-  audiosink->clock = gst_clock_get_system();
-  audiosink->format = 16;
-  audiosink->channels = 2;
-  audiosink->frequency = 44100;
-  
-  gst_clock_register (audiosink->clock, GST_OBJECT (audiosink));
-
-  GST_FLAG_SET (audiosink, GST_ELEMENT_THREAD_SUGGESTED);
-}
-
-static GstPadNegotiateReturn 
-gst_audiosink_negotiate (GstPad *pad, GstCaps **caps, gint counter) 
-{
-  GstAudioSink *audiosink;
-
-  g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
-  g_return_val_if_fail (GST_IS_PAD (pad), GST_PAD_NEGOTIATE_FAIL);
-
-  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
-
-  g_print ("audiosink: negotiate\n");
-  // we decide
-  if (counter == 0) {
-    *caps = NULL;
-    return GST_PAD_NEGOTIATE_TRY;
-  }
-  // have we got caps?
-  else if (*caps) {
-    if (audiosink->fd == -1) return GST_PAD_NEGOTIATE_FAIL;
-
-    audiosink->format = gst_caps_get_int (*caps, "format");
-    audiosink->channels = gst_caps_get_int (*caps, "channels");
-    audiosink->frequency = gst_caps_get_int (*caps, "rate");
-
-    gst_audiosink_sync_parms (audiosink);
-
-    // FIXME check if the qound card was really set to these caps,
-    // else send out another caps..
-
-    return GST_PAD_NEGOTIATE_AGREE;
-  }
-  
-  return GST_PAD_NEGOTIATE_FAIL;
-}
-
-static void 
-gst_audiosink_sync_parms (GstAudioSink *audiosink) 
-{
-  audio_buf_info ospace;
-  int frag;
-
-  g_return_if_fail (audiosink != NULL);
-  g_return_if_fail (GST_IS_AUDIOSINK (audiosink));
-
-  if (audiosink->fd == -1) return;
-
-  ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
-
-  ioctl (audiosink->fd, SNDCTL_DSP_SETFMT, &audiosink->format);
-  ioctl (audiosink->fd, SNDCTL_DSP_CHANNELS, &audiosink->channels);
-  ioctl (audiosink->fd, SNDCTL_DSP_SPEED, &audiosink->frequency);
-  ioctl (audiosink->fd, SNDCTL_DSP_GETBLKSIZE, &frag);
-
-  ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-
-  g_print("audiosink: setting sound card to %dHz %d bit %s (%d bytes buffer, %d fragment)\n",
-          audiosink->frequency, audiosink->format,
-          (audiosink->channels == 2) ? "stereo" : "mono", ospace.bytes, frag);
-
-}
-
-static void 
-gst_audiosink_chain (GstPad *pad, GstBuffer *buf) 
-{
-  GstAudioSink *audiosink;
-  gboolean in_flush;
-  audio_buf_info ospace;
-
-  g_return_if_fail (pad != NULL);
-  g_return_if_fail (GST_IS_PAD (pad));
-  g_return_if_fail (buf != NULL);
-
-
-  /* this has to be an audio buffer */
-//  g_return_if_fail(((GstMeta *)buf->meta)->type !=
-//gst_audiosink_type_audio);
-  audiosink = GST_AUDIOSINK (gst_pad_get_parent (pad));
-//  g_return_if_fail(GST_FLAG_IS_SET(audiosink,GST_STATE_RUNNING));
-
-  if ((in_flush = GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLUSH))) {
-    GST_DEBUG (0,"audiosink: flush\n");
-    ioctl (audiosink->fd, SNDCTL_DSP_RESET, 0);
-  }
-
-  gtk_signal_emit (GTK_OBJECT (audiosink), gst_audiosink_signals[SIGNAL_HANDOFF],
-                  audiosink);
-
-  if (GST_BUFFER_DATA (buf) != NULL) {
-    gst_trace_add_entry(NULL, 0, buf, "audiosink: writing to soundcard");
-    //g_print("audiosink: writing to soundcard\n");
-    if (audiosink->fd >= 0) {
-      if (!audiosink->mute) {
-        gst_clock_wait (audiosink->clock, GST_BUFFER_TIMESTAMP (buf), GST_OBJECT (audiosink));
-        ioctl (audiosink->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-        GST_DEBUG (0,"audiosink: (%d bytes buffer) %d %p %d\n", ospace.bytes, 
-                       audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-        write (audiosink->fd, GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
-        //write(STDOUT_FILENO,GST_BUFFER_DATA(buf),GST_BUFFER_SIZE(buf));
-      }
-    }
-  }
-  gst_buffer_unref (buf);
-}
-
-static void 
-gst_audiosink_set_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSink *audiosink;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSINK (object));
-  
-  audiosink = GST_AUDIOSINK (object);
-
-  switch(id) {
-    case ARG_MUTE:
-      audiosink->mute = GTK_VALUE_BOOL (*arg);
-      break;
-    case ARG_FORMAT:
-      audiosink->format = GTK_VALUE_ENUM (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    case ARG_CHANNELS:
-      audiosink->channels = GTK_VALUE_ENUM (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    case ARG_FREQUENCY:
-      audiosink->frequency = GTK_VALUE_INT (*arg);
-      gst_audiosink_sync_parms (audiosink);
-      break;
-    default:
-      break;
-  }
-}
-
-static void 
-gst_audiosink_get_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSink *audiosink;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSINK (object));
-  
-  audiosink = GST_AUDIOSINK (object);
-
-  switch(id) {
-    case ARG_MUTE:
-      GTK_VALUE_BOOL (*arg) = audiosink->mute;
-      break;
-    case ARG_FORMAT:
-      GTK_VALUE_ENUM (*arg) = audiosink->format;
-      break;
-    case ARG_CHANNELS:
-      GTK_VALUE_ENUM (*arg) = audiosink->channels;
-      break;
-    case ARG_FREQUENCY:
-      GTK_VALUE_INT (*arg) = audiosink->frequency;
-      break;
-    default:
-      break;
-  }
-}
-
-static gboolean
-gst_audiosink_open_audio (GstAudioSink *sink)
-{
-  g_return_val_if_fail (sink->fd == -1, FALSE);
-
-  g_print ("audiosink: attempting to open sound device\n");
-
-  /* first try to open the sound card */
-  sink->fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
-  if (errno == EBUSY) {
-    g_print ("audiosink: unable to open the sound device (in use ?)\n");
-    return FALSE;
-  }
-
-  /* re-open the sound device in blocking mode */
-  close(sink->fd);
-  sink->fd = open("/dev/dsp", O_WRONLY);
-
-  /* if we have it, set the default parameters and go have fun */
-  if (sink->fd >= 0) {
-    /* set card state */
-    ioctl(sink->fd, SNDCTL_DSP_GETCAPS, &sink->caps);
-
-    g_print("audiosink: Capabilities\n");
-
-    if (sink->caps & DSP_CAP_DUPLEX)   g_print("audiosink:   Full duplex\n");
-    if (sink->caps & DSP_CAP_REALTIME) g_print("audiosink:   Realtime\n");
-    if (sink->caps & DSP_CAP_BATCH)    g_print("audiosink:   Batch\n");
-    if (sink->caps & DSP_CAP_COPROC)   g_print("audiosink:   Has coprocessor\n");
-    if (sink->caps & DSP_CAP_TRIGGER)  g_print("audiosink:   Trigger\n");
-    if (sink->caps & DSP_CAP_MMAP)     g_print("audiosink:   Direct access\n");
-
-    g_print("audiosink: opened audio with fd=%d\n", sink->fd);
-    GST_FLAG_SET (sink, GST_AUDIOSINK_OPEN);
-
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-static void
-gst_audiosink_close_audio (GstAudioSink *sink)
-{
-  if (sink->fd < 0) return;
-
-  close(sink->fd);
-  sink->fd = -1;
-
-  GST_FLAG_UNSET (sink, GST_AUDIOSINK_OPEN);
-
-  g_print("audiosink: closed sound device\n");
-}
-
-static GstElementStateReturn 
-gst_audiosink_change_state (GstElement *element) 
-{
-  g_return_val_if_fail (GST_IS_AUDIOSINK (element), FALSE);
-
-  /* if going down into NULL state, close the file if it's open */ 
-  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
-    if (GST_FLAG_IS_SET (element, GST_AUDIOSINK_OPEN))
-      gst_audiosink_close_audio (GST_AUDIOSINK (element));
-  /* otherwise (READY or higher) we need to open the sound card */
-  } else {
-    if (!GST_FLAG_IS_SET (element, GST_AUDIOSINK_OPEN)) {
-      if (!gst_audiosink_open_audio (GST_AUDIOSINK (element))) {
-        //return GST_STATE_FAILURE;
-      }
-    }
-  }
-      
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
-  return GST_STATE_SUCCESS;
-}
-
-gboolean 
-gst_audiosink_factory_init (GstElementFactory *factory) 
-{ 
-  gst_audiosink_sink_template = gst_padtemplate_new (&audiosink_sink_factory);
-  gst_elementfactory_add_padtemplate (factory, gst_audiosink_sink_template);
-
-  return TRUE;
-}
-
diff --git a/plugins/elements/gstaudiosink.h b/plugins/elements/gstaudiosink.h
deleted file mode 100644 (file)
index d523392..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosink.h: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_AUDIOSINK_H__
-#define __GST_AUDIOSINK_H__
-
-
-#include <config.h>
-#include <gst/gst.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-GstElementDetails gst_audiosink_details;
-
-
-#define GST_TYPE_AUDIOSINK \
-  (gst_audiosink_get_type())
-#define GST_AUDIOSINK(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_AUDIOSINK,GstAudioSink))
-#define GST_AUDIOSINK_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOSINK,GstAudioSinkClass))
-#define GST_IS_AUDIOSINK(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSINK))
-#define GST_IS_AUDIOSINK_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSINK))
-
-typedef enum {
-  GST_AUDIOSINK_OPEN           = GST_ELEMENT_FLAG_LAST,
-
-  GST_AUDIOSINK_FLAG_LAST      = GST_ELEMENT_FLAG_LAST+2,
-} GstAudioSinkFlags;
-
-typedef struct _GstAudioSink GstAudioSink;
-typedef struct _GstAudioSinkClass GstAudioSinkClass;
-
-struct _GstAudioSink {
-  GstElement element;
-
-  GstPad *sinkpad;
-
-  //GstClockTime clocktime;
-  GstClock *clock;
-  /* soundcard state */
-  int fd;
-  int caps; /* the capabilities */
-  gint format;
-  gint channels;
-  gint frequency;
-  gboolean mute;
-};
-
-struct _GstAudioSinkClass {
-  GstElementClass parent_class;
-
-  /* signals */
-  void (*handoff) (GstElement *element,GstPad *pad);
-};
-
-GtkType gst_audiosink_get_type(void);
-
-gboolean gst_audiosink_factory_init(GstElementFactory *factory);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_AUDIOSINK_H__ */
diff --git a/plugins/elements/gstaudiosrc.c b/plugins/elements/gstaudiosrc.c
deleted file mode 100644 (file)
index b4645fd..0000000
+++ /dev/null
@@ -1,321 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosrc.c: 
- *
- * 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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
-#include <sys/ioctl.h>
-#include <unistd.h>
-
-#include <gstaudiosrc.h>
-
-
-GstElementDetails gst_audiosrc_details = {
-  "Audio (OSS) Source",
-  "Source/Audio",
-  "Read from the sound card",
-  VERSION,
-  "Erik Walthinsen <omega@cse.ogi.edu>",
-  "(C) 1999",
-};
-
-
-/* AudioSrc signals and args */
-enum {
-  /* FILL ME */
-  LAST_SIGNAL
-};
-
-enum {
-  ARG_0,
-  ARG_BYTESPERREAD,
-  ARG_CUROFFSET,
-  ARG_FORMAT,
-  ARG_CHANNELS,
-  ARG_FREQUENCY,
-};
-
-
-static void                    gst_audiosrc_class_init         (GstAudioSrcClass *klass);
-static void                    gst_audiosrc_init               (GstAudioSrc *audiosrc);
-
-static void                    gst_audiosrc_set_arg            (GtkObject *object, GtkArg *arg, guint id);
-static void                    gst_audiosrc_get_arg            (GtkObject *object, GtkArg *arg, guint id);
-static GstElementStateReturn   gst_audiosrc_change_state       (GstElement *element);
-
-static void                    gst_audiosrc_close_audio        (GstAudioSrc *src);
-static gboolean                gst_audiosrc_open_audio         (GstAudioSrc *src);
-static void                    gst_audiosrc_sync_parms         (GstAudioSrc *audiosrc);
-
-static GstBuffer *             gst_audiosrc_get                (GstPad *pad);
-
-static GstElementClass *parent_class = NULL;
-//static guint gst_audiosrc_signals[LAST_SIGNAL] = { 0 };
-
-GtkType
-gst_audiosrc_get_type (void) 
-{
-  static GtkType audiosrc_type = 0;
-
-  if (!audiosrc_type) {
-    static const GtkTypeInfo audiosrc_info = {
-      "GstAudioSrc",
-      sizeof(GstAudioSrc),
-      sizeof(GstAudioSrcClass),
-      (GtkClassInitFunc)gst_audiosrc_class_init,
-      (GtkObjectInitFunc)gst_audiosrc_init,
-      (GtkArgSetFunc)gst_audiosrc_set_arg,
-      (GtkArgGetFunc)gst_audiosrc_get_arg,
-      (GtkClassInitFunc)NULL,
-    };
-    audiosrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &audiosrc_info);
-  }
-  return audiosrc_type;
-}
-
-static void
-gst_audiosrc_class_init (GstAudioSrcClass *klass) 
-{
-  GtkObjectClass *gtkobject_class;
-  GstElementClass *gstelement_class;
-
-  gtkobject_class = (GtkObjectClass*)klass;
-  gstelement_class = (GstElementClass*)klass;
-
-  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
-
-  gtk_object_add_arg_type ("GstAudioSrc::bytes_per_read", GTK_TYPE_ULONG,
-                           GTK_ARG_READWRITE, ARG_BYTESPERREAD);
-  gtk_object_add_arg_type ("GstAudioSrc::curoffset", GTK_TYPE_ULONG,
-                           GTK_ARG_READABLE, ARG_CUROFFSET);
-  gtk_object_add_arg_type ("GstAudioSrc::format", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FORMAT);
-  gtk_object_add_arg_type ("GstAudioSrc::channels", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_CHANNELS);
-  gtk_object_add_arg_type ("GstAudioSrc::frequency", GTK_TYPE_INT,
-                           GTK_ARG_READWRITE, ARG_FREQUENCY);
-
-  gtkobject_class->set_arg = gst_audiosrc_set_arg;
-  gtkobject_class->get_arg = gst_audiosrc_get_arg;
-
-  gstelement_class->change_state = gst_audiosrc_change_state;
-}
-
-static void 
-gst_audiosrc_init (GstAudioSrc *audiosrc) 
-{
-  audiosrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
-  gst_pad_set_get_function(audiosrc->srcpad,gst_audiosrc_get);
-  gst_element_add_pad (GST_ELEMENT (audiosrc), audiosrc->srcpad);
-
-  audiosrc->fd = -1;
-
-//  audiosrc->meta = (MetaAudioRaw *)gst_meta_new();
-//  audiosrc->meta->format = AFMT_S16_LE;
-//  audiosrc->meta->channels = 2;
-//  audiosrc->meta->frequency = 44100;
-//  audiosrc->meta->bps = 4;
-
-  audiosrc->bytes_per_read = 4096;
-  audiosrc->curoffset = 0;
-  audiosrc->seq = 0;
-}
-
-static GstBuffer *
-gst_audiosrc_get (GstPad *pad)
-{
-  GstAudioSrc *src;
-  GstBuffer *buf;
-  glong readbytes;
-
-  g_return_val_if_fail (pad != NULL, NULL);
-  src = GST_AUDIOSRC(gst_pad_get_parent (pad));
-
-//  g_print("attempting to read something from soundcard\n");
-
-  buf = gst_buffer_new ();
-  g_return_val_if_fail (buf, NULL);
-  
-  GST_BUFFER_DATA (buf) = (gpointer)g_malloc (src->bytes_per_read);
-
-  readbytes = read (src->fd,GST_BUFFER_DATA (buf),
-                    src->bytes_per_read);
-
-  if (readbytes == 0) {
-    gst_element_signal_eos (GST_ELEMENT (src));
-    return NULL;
-  }
-
-  GST_BUFFER_SIZE (buf) = readbytes;
-  GST_BUFFER_OFFSET (buf) = src->curoffset;
-  
-  src->curoffset += readbytes;
-
-//  gst_buffer_add_meta(buf,GST_META(newmeta));
-
-//  g_print("pushed buffer from soundcard of %d bytes\n",readbytes);
-  return buf;
-}
-
-static void 
-gst_audiosrc_set_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSrc *src;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSRC (object));
-  
-  src = GST_AUDIOSRC (object);
-
-  switch (id) {
-    case ARG_BYTESPERREAD:
-      src->bytes_per_read = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_FORMAT:
-      src->format = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_CHANNELS:
-      src->channels = GTK_VALUE_INT (*arg);
-      break;
-    case ARG_FREQUENCY:
-      src->frequency = GTK_VALUE_INT (*arg);
-      break;
-    default:
-      break;
-  }
-}
-
-static void 
-gst_audiosrc_get_arg (GtkObject *object, GtkArg *arg, guint id) 
-{
-  GstAudioSrc *src;
-
-  /* it's not null if we got it, but it might not be ours */
-  g_return_if_fail (GST_IS_AUDIOSRC (object));
-  
-  src = GST_AUDIOSRC (object);
-
-  switch (id) {
-    case ARG_BYTESPERREAD:
-      GTK_VALUE_INT (*arg) = src->bytes_per_read;
-      break;
-    case ARG_FORMAT:
-      GTK_VALUE_INT (*arg) = src->format;
-      break;
-    case ARG_CHANNELS:
-      GTK_VALUE_INT (*arg) = src->channels;
-      break;
-    case ARG_FREQUENCY:
-      GTK_VALUE_INT (*arg) = src->frequency;
-      break;
-    default:
-      arg->type = GTK_TYPE_INVALID;
-      break;
-  }
-}
-
-static GstElementStateReturn 
-gst_audiosrc_change_state (GstElement *element) 
-{
-  g_return_val_if_fail (GST_IS_AUDIOSRC (element), FALSE);
-
-  /* if going down into NULL state, close the file if it's open */
-  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
-    if (GST_FLAG_IS_SET (element, GST_AUDIOSRC_OPEN))
-      gst_audiosrc_close_audio (GST_AUDIOSRC (element));
-  /* otherwise (READY or higher) we need to open the sound card */
-  } else {
-    if (!GST_FLAG_IS_SET (element, GST_AUDIOSRC_OPEN)) { 
-      if (!gst_audiosrc_open_audio (GST_AUDIOSRC (element)))
-        return GST_STATE_FAILURE;
-    }
-  }
-
-  if (GST_ELEMENT_CLASS (parent_class)->change_state)
-    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
-  
-  return GST_STATE_SUCCESS;
-}
-
-static gboolean 
-gst_audiosrc_open_audio (GstAudioSrc *src) 
-{
-  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN), FALSE);
-
-  /* first try to open the sound card */
-  src->fd = open("/dev/dsp", O_RDONLY);
-
-  /* if we have it, set the default parameters and go have fun */ 
-  if (src->fd > 0) {
-    int arg = 0x7fff0006;
-
-    if (ioctl (src->fd, SNDCTL_DSP_SETFRAGMENT, &arg)) perror("uh");
-
-    /* set card state */
-    gst_audiosrc_sync_parms (src);
-    GST_DEBUG (0,"opened audio\n");
-    
-    GST_FLAG_SET (src, GST_AUDIOSRC_OPEN);
-    return TRUE;
-  }
-
-  return FALSE;
-}
-
-static void 
-gst_audiosrc_close_audio (GstAudioSrc *src) 
-{
-  g_return_if_fail (GST_FLAG_IS_SET (src, GST_AUDIOSRC_OPEN));
-
-  close(src->fd);
-  src->fd = -1;
-
-  GST_FLAG_UNSET (src, GST_AUDIOSRC_OPEN);
-}
-
-static void 
-gst_audiosrc_sync_parms (GstAudioSrc *audiosrc) 
-{
-  audio_buf_info ospace;
-  
-  g_return_if_fail (audiosrc != NULL);
-  g_return_if_fail (GST_IS_AUDIOSRC (audiosrc));
-  g_return_if_fail (audiosrc->fd > 0);
-  ioctl(audiosrc->fd, SNDCTL_DSP_RESET, 0);
-  ioctl(audiosrc->fd, SNDCTL_DSP_SETFMT, &audiosrc->format);
-  ioctl(audiosrc->fd, SNDCTL_DSP_CHANNELS, &audiosrc->channels);
-  ioctl(audiosrc->fd, SNDCTL_DSP_SPEED, &audiosrc->frequency);
-  
-  ioctl(audiosrc->fd, SNDCTL_DSP_GETOSPACE, &ospace);
-  g_print("setting sound card to %dKHz %d bit %s (%d bytes buffer)\n",
-          audiosrc->frequency,audiosrc->format,
-          (audiosrc->channels == 2) ? "stereo" : "mono",ospace.bytes);
-
-//  audiosrc->meta.format = audiosrc->format;
-//  audiosrc->meta.channels = audiosrc->channels;
-//  audiosrc->meta.frequency = audiosrc->frequency;
-//  audiosrc->sentmeta = FALSE;
-}
diff --git a/plugins/elements/gstaudiosrc.h b/plugins/elements/gstaudiosrc.h
deleted file mode 100644 (file)
index b4bbfc0..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/* GStreamer
- * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
- *                    2000 Wim Taymans <wtay@chello.be>
- *
- * gstaudiosrc.h: 
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-
-#ifndef __GST_AUDIOSRC_H__
-#define __GST_AUDIOSRC_H__
-
-
-#include <config.h>
-#include <gst/gst.h>
-#include <gst/meta/audioraw.h>
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-GstElementDetails gst_audiosrc_details;
-
-
-#define GST_TYPE_AUDIOSRC \
-  (gst_audiosrc_get_type())
-#define GST_AUDIOSRC(obj) \
-  (GTK_CHECK_CAST((obj),GST_TYPE_AUDIOSRC,GstAudioSrc))
-#define GST_AUDIOSRC_CLASS(klass) \
-  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIOSRC,GstAudioSrcClass))
-#define GST_IS_AUDIOSRC(obj) \
-  (GTK_CHECK_TYPE((obj),GST_TYPE_AUDIOSRC))
-#define GST_IS_AUDIOSRC_CLASS(obj) \
-  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIOSRC))
-
-typedef enum {
-  GST_AUDIOSRC_OPEN            = GST_ELEMENT_FLAG_LAST,
-
-  GST_AUDIOSRC_FLAG_LAST       = GST_ELEMENT_FLAG_LAST+2,
-} GstAudioSrcFlags;
-
-typedef struct _GstAudioSrc GstAudioSrc;
-typedef struct _GstAudioSrcClass GstAudioSrcClass;
-
-struct _GstAudioSrc {
-  GstElement element;
-
-  /* pads */
-  GstPad *srcpad;
-
-  /* sound card */
-  gint fd;
-
-  /* audio parameters */
-  gint format;
-  gint channels;
-  gint frequency;
-
-  /* blocking */
-  gulong curoffset;
-  gulong bytes_per_read;
-
-  gulong seq;
-
-  MetaAudioRaw *meta;
-};
-
-struct _GstAudioSrcClass {
-  GstElementClass parent_class;
-};
-
-GtkType gst_audiosrc_get_type(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GST_AUDIOSRC_H__ */
index 62b5a92..326d0e3 100644 (file)
 
 #include <gst/gst.h>
 
-#include "gstaudiosink.h"
-#include "gstaudiosrc.h"
 #include "gstdisksrc.h"
 #include "gstidentity.h"
 #include "gstfakesink.h"
 #include "gstfakesrc.h"
 #include "gstfdsink.h"
 #include "gstfdsrc.h"
+#include "gstmultidisksrc.h"
 #include "gstpipefilter.h"
 #include "gstsinesrc.h"
 #include "gsttee.h"
@@ -50,12 +49,11 @@ struct _elements_entry {
 static struct _elements_entry _elements[] = {
   { "fakesrc",             gst_fakesrc_get_type,       &gst_fakesrc_details,           NULL },
   { "fakesink",     gst_fakesink_get_type,     &gst_fakesink_details,          NULL },
-  { "audiosink",    gst_audiosink_get_type,    &gst_audiosink_details,         gst_audiosink_factory_init },
-  { "audiosrc",     gst_audiosrc_get_type,     &gst_audiosrc_details,          NULL },
   { "disksrc",             gst_disksrc_get_type,       &gst_disksrc_details,           NULL },
   { "identity",     gst_identity_get_type,     &gst_identity_details,          NULL },
   { "fdsink",       gst_fdsink_get_type,       &gst_fdsink_details,            NULL },
   { "fdsrc",       gst_fdsrc_get_type,         &gst_fdsrc_details,             NULL },
+  { "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details,      NULL },
   { "pipefilter",   gst_pipefilter_get_type,   &gst_pipefilter_details,        NULL },
   { "sinesrc",             gst_sinesrc_get_type,       &gst_sinesrc_details,           NULL },
   { "tee",                 gst_tee_get_type,           &gst_tee_details,               gst_tee_factory_init },
diff --git a/plugins/elements/gstmultidisksrc.c b/plugins/elements/gstmultidisksrc.c
new file mode 100644 (file)
index 0000000..726aed9
--- /dev/null
@@ -0,0 +1,305 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.c:
+ *
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+//#define GST_DEBUG_ENABLED
+
+#include "gstmultidisksrc.h"
+
+GstElementDetails gst_multidisksrc_details = {
+  "Multi Disk Source",
+  "Source/File",
+  "Read from multiple files in order",
+  VERSION,
+  "Dominic Ludlam <dom@openfx.org>",
+  "(C) 2001",
+};
+
+/* DiskSrc signals and args */
+enum {
+  NEW_FILE,
+  LAST_SIGNAL
+};
+
+enum {
+  ARG_0,
+  ARG_LOCATIONS,
+};
+
+static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
+static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
+
+static void            gst_multidisksrc_set_arg        (GtkObject *object, GtkArg *arg, guint id);
+static void            gst_multidisksrc_get_arg        (GtkObject *object, GtkArg *arg, guint id);
+
+static GstBuffer *     gst_multidisksrc_get            (GstPad *pad);
+//static GstBuffer *   gst_multidisksrc_get_region     (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
+
+static GstElementStateReturn   gst_multidisksrc_change_state   (GstElement *element);
+
+static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
+static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
+
+static GstElementClass *parent_class = NULL;
+static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
+
+GtkType
+gst_multidisksrc_get_type(void)
+{
+  static GtkType multidisksrc_type = 0;
+
+  if (!multidisksrc_type) {
+    static const GtkTypeInfo multidisksrc_info = {
+      "GstMultiDiskSrc",
+      sizeof(GstMultiDiskSrc),
+      sizeof(GstMultiDiskSrcClass),
+      (GtkClassInitFunc)gst_multidisksrc_class_init,
+      (GtkObjectInitFunc)gst_multidisksrc_init,
+      (GtkArgSetFunc)gst_multidisksrc_set_arg,
+      (GtkArgGetFunc)gst_multidisksrc_get_arg,
+      (GtkClassInitFunc)NULL,
+    };
+    multidisksrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &multidisksrc_info);
+  }
+  return multidisksrc_type;
+}
+
+static void
+gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
+{
+  GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
+
+  gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
+
+  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
+
+  gst_multidisksrc_signals[NEW_FILE] =
+    gtk_signal_new ("new_file", GTK_RUN_LAST, gtkobject_class->type,
+                    GTK_SIGNAL_OFFSET (GstMultiDiskSrcClass, new_file),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GTK_TYPE_POINTER);
+  gtk_object_class_add_signals (gtkobject_class, gst_multidisksrc_signals, LAST_SIGNAL);
+
+  gtk_object_add_arg_type ("GstMultiDiskSrc::locations", GTK_TYPE_POINTER,
+                           GTK_ARG_READWRITE, ARG_LOCATIONS);
+
+  gtkobject_class->set_arg = gst_multidisksrc_set_arg;
+  gtkobject_class->get_arg = gst_multidisksrc_get_arg;
+
+  gstelement_class->change_state = gst_multidisksrc_change_state;
+}
+
+static void
+gst_multidisksrc_init (GstMultiDiskSrc *multidisksrc)
+{
+//  GST_FLAG_SET (disksrc, GST_SRC_);
+
+  multidisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+  gst_pad_set_get_function (multidisksrc->srcpad,gst_multidisksrc_get);
+//  gst_pad_set_getregion_function (multidisksrc->srcpad,gst_multidisksrc_get_region);
+  gst_element_add_pad (GST_ELEMENT (multidisksrc), multidisksrc->srcpad);
+
+  multidisksrc->listptr = NULL;
+  multidisksrc->currentfilename = NULL;
+  multidisksrc->fd = 0;
+  multidisksrc->size = 0;
+  multidisksrc->map = NULL;
+  multidisksrc->new_seek = FALSE;
+}
+
+static void
+gst_multidisksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch(id) {
+    case ARG_LOCATIONS:
+      /* the element must be stopped in order to do this */
+      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
+
+      /* clear the filename if we get a NULL */
+      if (GTK_VALUE_POINTER (*arg) == NULL) {
+        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
+        src->listptr = NULL;
+      /* otherwise set the new filenames */
+      } else {
+        src->listptr = GTK_VALUE_POINTER(*arg);
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+static void
+gst_multidisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch (id) {
+    case ARG_LOCATIONS:
+      GTK_VALUE_POINTER (*arg) = src->listptr;
+      break;
+    default:
+      arg->type = GTK_TYPE_INVALID;
+      break;
+  }
+}
+
+/**
+ * gst_disksrc_get:
+ * @pad: #GstPad to push a buffer from
+ *
+ * Push a new buffer from the disksrc at the current offset.
+ */
+static GstBuffer *
+gst_multidisksrc_get (GstPad *pad)
+{
+  GstMultiDiskSrc *src;
+  GstBuffer *buf;
+  GSList *list;
+
+  g_return_val_if_fail (pad != NULL, NULL);
+  src = GST_MULTIDISKSRC (gst_pad_get_parent (pad));
+
+  if (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN))
+    gst_multidisksrc_close_file(src);
+
+  if (!src->listptr) {
+      gst_pad_set_eos(pad);
+      return FALSE;
+  }
+
+  list = src->listptr;
+  src->currentfilename = (gchar *) list->data;
+  src->listptr = src->listptr->next;
+
+  if (!gst_multidisksrc_open_file(src, pad))
+      return NULL;
+
+  // emitted after the open, as the user may free the list and string from here
+  gtk_signal_emit(GTK_OBJECT(src), gst_multidisksrc_signals[NEW_FILE], list);
+
+  /* create the buffer */
+  // FIXME: should eventually use a bufferpool for this
+  buf = gst_buffer_new ();
+
+  g_return_val_if_fail (buf != NULL, NULL);
+
+  /* simply set the buffer to point to the correct region of the file */
+  GST_BUFFER_DATA (buf) = src->map;
+  GST_BUFFER_OFFSET (buf) = 0;
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
+
+  if (src->new_seek) {
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+    src->new_seek = FALSE;
+  }
+
+  /* we're done, return the buffer */
+  return buf;
+}
+
+/* open the file and mmap it, necessary to go to READY state */
+static
+gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN), FALSE);
+
+  /* open the file */
+  src->fd = open ((const char *) src->currentfilename, O_RDONLY);
+
+  if (src->fd < 0) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
+    return FALSE;
+  } else {
+    /* find the file length */
+    src->size = lseek (src->fd, 0, SEEK_END);
+    lseek (src->fd, 0, SEEK_SET);
+    /* map the file into memory */
+    src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
+    madvise (src->map,src->size, 2);
+    /* collapse state if that failed */
+    if (src->map == NULL) {
+      close (src->fd);
+      gst_element_error (GST_ELEMENT (src),"mmapping file");
+      return FALSE;
+    }
+    GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
+    src->new_seek = TRUE;
+  }
+  return TRUE;
+}
+
+/* unmap and close the file */
+static void
+gst_multidisksrc_close_file (GstMultiDiskSrc *src)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN));
+
+  /* unmap the file from memory and close the file */
+  munmap (src->map, src->size);
+  close (src->fd);
+
+  /* zero out a lot of our state */
+  src->fd = 0;
+  src->size = 0;
+  src->map = NULL;
+  src->new_seek = FALSE;
+
+  GST_FLAG_UNSET (src, GST_MULTIDISKSRC_OPEN);
+}
+
+static GstElementStateReturn
+gst_multidisksrc_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_MULTIDISKSRC (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_MULTIDISKSRC_OPEN))
+      gst_multidisksrc_close_file (GST_MULTIDISKSRC (element));
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
diff --git a/plugins/elements/gstmultidisksrc.h b/plugins/elements/gstmultidisksrc.h
new file mode 100644 (file)
index 0000000..ed4a94c
--- /dev/null
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.h: 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MULTIDISKSRC_H__
+#define __GST_MULTIDISKSRC_H__
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+GstElementDetails gst_multidisksrc_details;
+
+#define GST_TYPE_MULTIDISKSRC \
+  (gst_multidisksrc_get_type())
+#define GST_MULTIDISKSRC(obj) \
+  (GTK_CHECK_CAST((obj),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrc))
+#define GST_MULTIDISKSRC_CLASS(klass) \
+  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrcClass))
+#define GST_IS_MULTIDISKSRC(obj) \
+  (GTK_CHECK_TYPE((obj),GST_TYPE_MULTIDISKSRC))
+#define GST_IS_MULTIDISKSRC_CLASS(obj) \
+  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIDISKSRC))
+
+typedef enum {
+  GST_MULTIDISKSRC_OPEN                = GST_ELEMENT_FLAG_LAST,
+
+  GST_MULTIDISKSRC_FLAG_LAST   = GST_ELEMENT_FLAG_LAST + 2,
+} GstMultiDiskSrcFlags;
+
+typedef struct _GstMultiDiskSrc GstMultiDiskSrc;
+typedef struct _GstMultiDiskSrcClass GstMultiDiskSrcClass;
+
+struct _GstMultiDiskSrc {
+  GstElement element;
+  /* pads */
+  GstPad *srcpad;
+
+  /* current file details */
+  gchar  *currentfilename;
+  GSList *listptr;
+
+  /* mapping parameters */
+  gint fd;
+  gulong size;    /* how long is the file? */
+  guchar *map;    /* where the file is mapped to */
+
+  gboolean new_seek;
+};
+
+struct _GstMultiDiskSrcClass {
+  GstElementClass parent_class;
+
+  void (*new_file)  (GstMultiDiskSrc *multidisksrc, gchar *newfilename);
+};
+
+GtkType gst_multidisksrc_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_MULTIDISKSRC_H__ */
diff --git a/plugins/elements/gstmultifilesrc.c b/plugins/elements/gstmultifilesrc.c
new file mode 100644 (file)
index 0000000..726aed9
--- /dev/null
@@ -0,0 +1,305 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.c:
+ *
+ * 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 <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/mman.h>
+
+//#define GST_DEBUG_ENABLED
+
+#include "gstmultidisksrc.h"
+
+GstElementDetails gst_multidisksrc_details = {
+  "Multi Disk Source",
+  "Source/File",
+  "Read from multiple files in order",
+  VERSION,
+  "Dominic Ludlam <dom@openfx.org>",
+  "(C) 2001",
+};
+
+/* DiskSrc signals and args */
+enum {
+  NEW_FILE,
+  LAST_SIGNAL
+};
+
+enum {
+  ARG_0,
+  ARG_LOCATIONS,
+};
+
+static void            gst_multidisksrc_class_init     (GstMultiDiskSrcClass *klass);
+static void            gst_multidisksrc_init           (GstMultiDiskSrc *disksrc);
+
+static void            gst_multidisksrc_set_arg        (GtkObject *object, GtkArg *arg, guint id);
+static void            gst_multidisksrc_get_arg        (GtkObject *object, GtkArg *arg, guint id);
+
+static GstBuffer *     gst_multidisksrc_get            (GstPad *pad);
+//static GstBuffer *   gst_multidisksrc_get_region     (GstPad *pad,GstRegionType type,guint64 offset,guint64 len);
+
+static GstElementStateReturn   gst_multidisksrc_change_state   (GstElement *element);
+
+static gboolean                gst_multidisksrc_open_file      (GstMultiDiskSrc *src, GstPad *srcpad);
+static void            gst_multidisksrc_close_file     (GstMultiDiskSrc *src);
+
+static GstElementClass *parent_class = NULL;
+static guint gst_multidisksrc_signals[LAST_SIGNAL] = { 0 };
+
+GtkType
+gst_multidisksrc_get_type(void)
+{
+  static GtkType multidisksrc_type = 0;
+
+  if (!multidisksrc_type) {
+    static const GtkTypeInfo multidisksrc_info = {
+      "GstMultiDiskSrc",
+      sizeof(GstMultiDiskSrc),
+      sizeof(GstMultiDiskSrcClass),
+      (GtkClassInitFunc)gst_multidisksrc_class_init,
+      (GtkObjectInitFunc)gst_multidisksrc_init,
+      (GtkArgSetFunc)gst_multidisksrc_set_arg,
+      (GtkArgGetFunc)gst_multidisksrc_get_arg,
+      (GtkClassInitFunc)NULL,
+    };
+    multidisksrc_type = gtk_type_unique (GST_TYPE_ELEMENT, &multidisksrc_info);
+  }
+  return multidisksrc_type;
+}
+
+static void
+gst_multidisksrc_class_init (GstMultiDiskSrcClass *klass)
+{
+  GtkObjectClass *gtkobject_class;
+  GstElementClass *gstelement_class;
+
+  gtkobject_class = (GtkObjectClass*)klass;
+  gstelement_class = (GstElementClass*)klass;
+
+  parent_class = gtk_type_class (GST_TYPE_ELEMENT);
+
+  gst_multidisksrc_signals[NEW_FILE] =
+    gtk_signal_new ("new_file", GTK_RUN_LAST, gtkobject_class->type,
+                    GTK_SIGNAL_OFFSET (GstMultiDiskSrcClass, new_file),
+                    gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
+                    GTK_TYPE_POINTER);
+  gtk_object_class_add_signals (gtkobject_class, gst_multidisksrc_signals, LAST_SIGNAL);
+
+  gtk_object_add_arg_type ("GstMultiDiskSrc::locations", GTK_TYPE_POINTER,
+                           GTK_ARG_READWRITE, ARG_LOCATIONS);
+
+  gtkobject_class->set_arg = gst_multidisksrc_set_arg;
+  gtkobject_class->get_arg = gst_multidisksrc_get_arg;
+
+  gstelement_class->change_state = gst_multidisksrc_change_state;
+}
+
+static void
+gst_multidisksrc_init (GstMultiDiskSrc *multidisksrc)
+{
+//  GST_FLAG_SET (disksrc, GST_SRC_);
+
+  multidisksrc->srcpad = gst_pad_new ("src", GST_PAD_SRC);
+  gst_pad_set_get_function (multidisksrc->srcpad,gst_multidisksrc_get);
+//  gst_pad_set_getregion_function (multidisksrc->srcpad,gst_multidisksrc_get_region);
+  gst_element_add_pad (GST_ELEMENT (multidisksrc), multidisksrc->srcpad);
+
+  multidisksrc->listptr = NULL;
+  multidisksrc->currentfilename = NULL;
+  multidisksrc->fd = 0;
+  multidisksrc->size = 0;
+  multidisksrc->map = NULL;
+  multidisksrc->new_seek = FALSE;
+}
+
+static void
+gst_multidisksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch(id) {
+    case ARG_LOCATIONS:
+      /* the element must be stopped in order to do this */
+      g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
+
+      /* clear the filename if we get a NULL */
+      if (GTK_VALUE_POINTER (*arg) == NULL) {
+        gst_element_set_state (GST_ELEMENT (object), GST_STATE_NULL);
+        src->listptr = NULL;
+      /* otherwise set the new filenames */
+      } else {
+        src->listptr = GTK_VALUE_POINTER(*arg);
+      }
+      break;
+    default:
+      break;
+  }
+}
+
+static void
+gst_multidisksrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
+{
+  GstMultiDiskSrc *src;
+
+  /* it's not null if we got it, but it might not be ours */
+  g_return_if_fail (GST_IS_MULTIDISKSRC (object));
+
+  src = GST_MULTIDISKSRC (object);
+
+  switch (id) {
+    case ARG_LOCATIONS:
+      GTK_VALUE_POINTER (*arg) = src->listptr;
+      break;
+    default:
+      arg->type = GTK_TYPE_INVALID;
+      break;
+  }
+}
+
+/**
+ * gst_disksrc_get:
+ * @pad: #GstPad to push a buffer from
+ *
+ * Push a new buffer from the disksrc at the current offset.
+ */
+static GstBuffer *
+gst_multidisksrc_get (GstPad *pad)
+{
+  GstMultiDiskSrc *src;
+  GstBuffer *buf;
+  GSList *list;
+
+  g_return_val_if_fail (pad != NULL, NULL);
+  src = GST_MULTIDISKSRC (gst_pad_get_parent (pad));
+
+  if (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN))
+    gst_multidisksrc_close_file(src);
+
+  if (!src->listptr) {
+      gst_pad_set_eos(pad);
+      return FALSE;
+  }
+
+  list = src->listptr;
+  src->currentfilename = (gchar *) list->data;
+  src->listptr = src->listptr->next;
+
+  if (!gst_multidisksrc_open_file(src, pad))
+      return NULL;
+
+  // emitted after the open, as the user may free the list and string from here
+  gtk_signal_emit(GTK_OBJECT(src), gst_multidisksrc_signals[NEW_FILE], list);
+
+  /* create the buffer */
+  // FIXME: should eventually use a bufferpool for this
+  buf = gst_buffer_new ();
+
+  g_return_val_if_fail (buf != NULL, NULL);
+
+  /* simply set the buffer to point to the correct region of the file */
+  GST_BUFFER_DATA (buf) = src->map;
+  GST_BUFFER_OFFSET (buf) = 0;
+  GST_BUFFER_FLAG_SET (buf, GST_BUFFER_DONTFREE);
+
+  if (src->new_seek) {
+    GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLUSH);
+    src->new_seek = FALSE;
+  }
+
+  /* we're done, return the buffer */
+  return buf;
+}
+
+/* open the file and mmap it, necessary to go to READY state */
+static
+gboolean gst_multidisksrc_open_file (GstMultiDiskSrc *src, GstPad *srcpad)
+{
+  g_return_val_if_fail (!GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN), FALSE);
+
+  /* open the file */
+  src->fd = open ((const char *) src->currentfilename, O_RDONLY);
+
+  if (src->fd < 0) {
+    perror ("open");
+    gst_element_error (GST_ELEMENT (src), g_strconcat("opening file \"", src->currentfilename, "\"", NULL));
+    return FALSE;
+  } else {
+    /* find the file length */
+    src->size = lseek (src->fd, 0, SEEK_END);
+    lseek (src->fd, 0, SEEK_SET);
+    /* map the file into memory */
+    src->map = mmap (NULL, src->size, PROT_READ, MAP_SHARED, src->fd, 0);
+    madvise (src->map,src->size, 2);
+    /* collapse state if that failed */
+    if (src->map == NULL) {
+      close (src->fd);
+      gst_element_error (GST_ELEMENT (src),"mmapping file");
+      return FALSE;
+    }
+    GST_FLAG_SET (src, GST_MULTIDISKSRC_OPEN);
+    src->new_seek = TRUE;
+  }
+  return TRUE;
+}
+
+/* unmap and close the file */
+static void
+gst_multidisksrc_close_file (GstMultiDiskSrc *src)
+{
+  g_return_if_fail (GST_FLAG_IS_SET (src, GST_MULTIDISKSRC_OPEN));
+
+  /* unmap the file from memory and close the file */
+  munmap (src->map, src->size);
+  close (src->fd);
+
+  /* zero out a lot of our state */
+  src->fd = 0;
+  src->size = 0;
+  src->map = NULL;
+  src->new_seek = FALSE;
+
+  GST_FLAG_UNSET (src, GST_MULTIDISKSRC_OPEN);
+}
+
+static GstElementStateReturn
+gst_multidisksrc_change_state (GstElement *element)
+{
+  g_return_val_if_fail (GST_IS_MULTIDISKSRC (element), GST_STATE_FAILURE);
+
+  if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
+    if (GST_FLAG_IS_SET (element, GST_MULTIDISKSRC_OPEN))
+      gst_multidisksrc_close_file (GST_MULTIDISKSRC (element));
+  }
+
+  if (GST_ELEMENT_CLASS (parent_class)->change_state)
+    return GST_ELEMENT_CLASS (parent_class)->change_state (element);
+
+  return GST_STATE_SUCCESS;
+}
diff --git a/plugins/elements/gstmultifilesrc.h b/plugins/elements/gstmultifilesrc.h
new file mode 100644 (file)
index 0000000..ed4a94c
--- /dev/null
@@ -0,0 +1,84 @@
+/* GStreamer
+ * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
+ *                    2000 Wim Taymans <wtay@chello.be>
+ *                    2001 Dominic Ludlam <dom@recoil.org>
+ *
+ * gstmultidisksrc.h: 
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_MULTIDISKSRC_H__
+#define __GST_MULTIDISKSRC_H__
+
+#include <gst/gst.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+GstElementDetails gst_multidisksrc_details;
+
+#define GST_TYPE_MULTIDISKSRC \
+  (gst_multidisksrc_get_type())
+#define GST_MULTIDISKSRC(obj) \
+  (GTK_CHECK_CAST((obj),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrc))
+#define GST_MULTIDISKSRC_CLASS(klass) \
+  (GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MULTIDISKSRC,GstMultiDiskSrcClass))
+#define GST_IS_MULTIDISKSRC(obj) \
+  (GTK_CHECK_TYPE((obj),GST_TYPE_MULTIDISKSRC))
+#define GST_IS_MULTIDISKSRC_CLASS(obj) \
+  (GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MULTIDISKSRC))
+
+typedef enum {
+  GST_MULTIDISKSRC_OPEN                = GST_ELEMENT_FLAG_LAST,
+
+  GST_MULTIDISKSRC_FLAG_LAST   = GST_ELEMENT_FLAG_LAST + 2,
+} GstMultiDiskSrcFlags;
+
+typedef struct _GstMultiDiskSrc GstMultiDiskSrc;
+typedef struct _GstMultiDiskSrcClass GstMultiDiskSrcClass;
+
+struct _GstMultiDiskSrc {
+  GstElement element;
+  /* pads */
+  GstPad *srcpad;
+
+  /* current file details */
+  gchar  *currentfilename;
+  GSList *listptr;
+
+  /* mapping parameters */
+  gint fd;
+  gulong size;    /* how long is the file? */
+  guchar *map;    /* where the file is mapped to */
+
+  gboolean new_seek;
+};
+
+struct _GstMultiDiskSrcClass {
+  GstElementClass parent_class;
+
+  void (*new_file)  (GstMultiDiskSrc *multidisksrc, gchar *newfilename);
+};
+
+GtkType gst_multidisksrc_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_MULTIDISKSRC_H__ */
index 9d46555..5a4e4ab 100644 (file)
  * Boston, MA 02111-1307, USA.
  */
 
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/soundcard.h>
 #include <math.h>
 #include <stdlib.h>
 #include <string.h>
@@ -135,9 +131,10 @@ static void gst_sinesrc_init(GstSineSrc *src) {
   src->volume = 1.0;
   gst_sinesrc_update_vol_scale(src);
 
-  src->format = AFMT_S16_LE;
+  src->format = 16;
   src->samplerate = 44100;
   src->freq = 100.0;
+  src->newcaps = FALSE;
   
   src->table_pos = 0.0;
   src->table_size = 1024;
@@ -148,7 +145,6 @@ static void gst_sinesrc_init(GstSineSrc *src) {
   
   src->seq = 0;
 
-  src->sentmeta = FALSE;
 }
 
 static GstBuffer *
@@ -197,11 +193,8 @@ gst_sinesrc_get(GstPad *pad)
                  )* src->vol_scale;
   }
 
-  if (!src->sentmeta) {
-    MetaAudioRaw *newmeta = g_new(MetaAudioRaw,1);
-    memcpy(newmeta,&src->meta,sizeof(MetaAudioRaw));
-    gst_buffer_add_meta(buf,GST_META(newmeta));
-    src->sentmeta = TRUE;
+  if (src->newcaps) {
+    src->newcaps = FALSE;
   }
 
   //g_print(">");
@@ -316,7 +309,7 @@ static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
     table[i] = (gfloat)sin(i * pi2scaled);
   }
   
-       g_free(src->table_data);
+  g_free(src->table_data);
   src->table_data = table;
 }
 
@@ -331,8 +324,5 @@ static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src)
 }
 
 void gst_sinesrc_sync_parms(GstSineSrc *src) {
-  src->meta.format = src->format;
-  src->meta.channels = 1;
-  src->meta.frequency = src->samplerate;
-  src->sentmeta = FALSE;
+  src->newcaps = TRUE;
 }
index 82803f7..167a1ad 100644 (file)
@@ -27,8 +27,6 @@
 
 #include <config.h>
 #include <gst/gst.h>
-#include <gst/meta/audioraw.h>
-
 
 #ifdef __cplusplus
 extern "C" {
@@ -79,8 +77,8 @@ struct _GstSineSrc {
   gint buffer_size;
   gulong seq;
 
-  MetaAudioRaw meta;
-  gboolean sentmeta;
+  gboolean newcaps;
+
 };
 
 struct _GstSineSrcClass {
index 6efa57d..03dd680 100644 (file)
--- a/test/a.c
+++ b/test/a.c
@@ -9,7 +9,7 @@ int main(int argc,char *argv[]) {
   GstType *autype;
   GList *factories;
   GstElementFactory *parsefactory;
-  GstElement *bin, *disksrc, *parse, *audiosink;
+  GstElement *bin, *disksrc, *parse, *osssink;
   GList *padlist;
 
   gst_init(&argc,&argv);
@@ -42,7 +42,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eos",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -50,18 +50,18 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(parse,"sink"));
   gst_pad_connect(gst_element_get_pad(parse,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   while(1)
     gst_disksrc_push(GST_SRC(disksrc));
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
index 9967a1a..9154793 100644 (file)
@@ -30,7 +30,7 @@ int main(int argc,char *argv[]) {
   g_return_if_fail(parse != NULL);
   decode = gst_elementfactory_make("ac3dec","decode");
   g_return_if_fail(decode != NULL);
-  play = gst_elementfactory_make("audiosink","play");
+  play = gst_elementfactory_make("osssink","play");
   g_return_if_fail(play != NULL);
 
   // construct the decode thread
index 1721930..7e3882e 100644 (file)
@@ -23,7 +23,7 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
   //if (0) {
   if (strncmp(gst_pad_get_name(pad), "audio_", 6) == 0) {
     // construct internal pipeline elements
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index f210e06..6b3607a 100644 (file)
--- a/test/m.c
+++ b/test/m.c
@@ -47,7 +47,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  sink = gst_audiosink_new("audiosink");
+  sink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(src),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
index 95f1969..a75d109 100644 (file)
@@ -48,7 +48,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  sink = gst_audiosink_new("audiosink");
+  sink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(src),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
index 641f4b4..4db677d 100644 (file)
@@ -31,7 +31,7 @@ void new_pad_created(GstElement *parse,GstPad *pad,GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("mpg123","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index f047886..ebe298e 100644 (file)
@@ -33,7 +33,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("ac3dec","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
@@ -75,7 +75,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("mpg123","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index 4dd7e3c..fd5a7b7 100644 (file)
@@ -104,7 +104,7 @@ void mp2tomp1(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("mpg123","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index 9265930..78d9550 100644 (file)
@@ -110,7 +110,7 @@ mp2tomp1 (GstElement *parser, GstPad *pad, GstElement *pipeline)
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("mpg123","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index 88b8a7a..5f4ff6f 100644 (file)
@@ -31,7 +31,7 @@ int main(int argc,char *argv[]) {
     mp3factory = gst_elementfactory_find(argv[2]);
   else
     mp3factory = gst_elementfactory_find("xa");
-  sinkfactory = gst_elementfactory_find("audiosink");
+  sinkfactory = gst_elementfactory_find("osssink");
 
   src = gst_elementfactory_create(srcfactory,"src");
   g_return_val_if_fail(src != NULL, -1);
index 8401798..0f57fcf 100644 (file)
@@ -24,7 +24,7 @@ int main(int argc,char *argv[]) {
   g_return_if_fail(parsefactory != NULL);
   decodefactory = gst_elementfactory_find("mpg123");
   g_return_if_fail(decodefactory != NULL);
-  playfactory = gst_elementfactory_find("audiosink");
+  playfactory = gst_elementfactory_find("osssink");
   g_return_if_fail(playfactory != NULL);
 
   src = gst_elementfactory_create(srcfactory,"src");
index bdae3ca..50aeb01 100644 (file)
@@ -34,7 +34,7 @@ void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("ac3dec","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
@@ -78,7 +78,7 @@ void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) {
     g_return_if_fail(parse_audio != NULL);
     decode = gst_elementfactory_make("mpg123","decode_audio");
     g_return_if_fail(decode != NULL);
-    play = gst_elementfactory_make("audiosink","play_audio");
+    play = gst_elementfactory_make("osssink","play_audio");
     g_return_if_fail(play != NULL);
 
     // create the thread and pack stuff into it
index e242b9c..6c3d17d 100644 (file)
@@ -8,7 +8,7 @@ void eof(GstSrc *src) {
 int main(int argc,char *argv[]) {
   GList *factories;
   GstElementFactory *parsefactory;
-  GstElement *bin, *disksrc, *parse, *audiosink;
+  GstElement *bin, *disksrc, *parse, *osssink;
   GList *padlist;
   guchar *filename;
   int i;
@@ -38,7 +38,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -46,20 +46,20 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(parse,"sink"));
   gst_pad_connect(gst_element_get_pad(parse,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   for (i=0;i<4;i++) {
     g_print("\n");
     gst_disksrc_push(GST_SRC(disksrc));
   }
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
index 457e4b3..6ec6982 100644 (file)
--- a/test/p.c
+++ b/test/p.c
@@ -7,7 +7,7 @@ void eof(GstSrc *src) {
 }
 
 int main(int argc,char *argv[]) {
-  GstElement *bin, *disksrc, *p, *audiosink;
+  GstElement *bin, *disksrc, *p, *osssink;
   GList *padlist;
 
   gst_init(&argc,&argv);
@@ -24,7 +24,7 @@ int main(int argc,char *argv[]) {
   g_print("loaded file '%s'\n",gst_disksrc_get_filename(disksrc));
 
   p = gst_plugin_find_elementfactory("pipe");
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -32,23 +32,23 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(p));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(p,"sink"));
   gst_pad_connect(gst_element_get_pad(p,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* set soundcard properties */
-  gst_audiosink_set_format(GST_AUDIOSINK(audiosink),AFMT_S16_BE);
-  gst_audiosink_set_channels(GST_AUDIOSINK(audiosink),2);
-  gst_audiosink_set_frequency(GST_AUDIOSINK(audiosink),44100);
+  gst_osssink_set_format(GST_AUDIOSINK(osssink),AFMT_S16_BE);
+  gst_osssink_set_channels(GST_AUDIOSINK(osssink),2);
+  gst_osssink_set_frequency(GST_AUDIOSINK(osssink),44100);
 
   while(1)
     gst_disksrc_push(GST_SRC(disksrc));
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
 }
index cc32715..262f049 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc,char *argv[]) {
   /* then the play thread and sink */
   playthread = gst_thread_new("playthread");
 
-  sinkfactory = gst_elementfactory_find("audiosink");
+  sinkfactory = gst_elementfactory_find("osssink");
   sink = gst_elementfactory_create(sinkfactory,"sink");
   gst_bin_add(GST_BIN(playthread),GST_ELEMENT(sink));
   gst_element_add_ghost_pad(GST_ELEMENT(playthread),
index 5acc622..a389f68 100644 (file)
--- a/test/r.c
+++ b/test/r.c
@@ -7,7 +7,7 @@ void eof(GstSrc *src) {
 }
 
 int main(int argc,char *argv[]) {
-  GstElement *bin, *disksrc, *audiosink;
+  GstElement *bin, *disksrc, *osssink;
   GList *padlist;
 
   gst_init(&argc,&argv);
@@ -23,28 +23,28 @@ int main(int argc,char *argv[]) {
   gtk_object_set(GTK_OBJECT(disksrc),"bytesperread",32768,NULL);
   g_print("loaded file '%s'\n",gst_disksrc_get_filename(disksrc));
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
 
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* set soundcard properties */
-  gst_audiosink_set_format(GST_AUDIOSINK(audiosink),AFMT_S16_BE);
-  gst_audiosink_set_channels(GST_AUDIOSINK(audiosink),2);
-  gst_audiosink_set_frequency(GST_AUDIOSINK(audiosink),44100);
+  gst_osssink_set_format(GST_AUDIOSINK(osssink),AFMT_S16_BE);
+  gst_osssink_set_channels(GST_AUDIOSINK(osssink),2);
+  gst_osssink_set_frequency(GST_AUDIOSINK(osssink),44100);
 
   while(1)
     gst_disksrc_push(GST_SRC(disksrc));
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
 }
index b297969..12b3a27 100644 (file)
@@ -6,16 +6,16 @@
 
 int main(int argc,char *argv[]) {
   int fd;
-  GstElement *pipeline, *audiosrc, *fdsink;
-  GstElementFactory *audiosrcfactory, *fdsinkfactory;
+  GstElement *pipeline, *osssrc, *fdsink;
+  GstElementFactory *osssrcfactory, *fdsinkfactory;
   GList *padlist;
 
   gst_init(&argc,&argv);
 
   pipeline = GST_ELEMENT(gst_pipeline_new("pipeline"));
 
-  audiosrcfactory = gst_elementfactory_find("audiosrc");
-  audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
+  osssrcfactory = gst_elementfactory_find("osssrc");
+  osssrc = gst_elementfactory_create(osssrcfactory,"osssrc");
 
   fd = open(argv[1],O_CREAT|O_RDWR);
 
@@ -24,11 +24,11 @@ int main(int argc,char *argv[]) {
   gtk_object_set(GTK_OBJECT(fdsink),"fd",fd,NULL);
 
   /* add objects to the main pipeline */
-  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(audiosrc));
+  gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(osssrc));
   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(fdsink));
 
   /* connect src to sink */
-  gst_pad_connect(gst_element_get_pad(audiosrc,"src"),
+  gst_pad_connect(gst_element_get_pad(osssrc,"src"),
                   gst_element_get_pad(fdsink,"sink"));
 
   g_print("\nok, runnable, hitting 'play'...\n");
index cefab58..1d2f6b6 100644 (file)
--- a/test/s.c
+++ b/test/s.c
@@ -11,7 +11,7 @@ int main(int argc,char *argv[]) {
   guint16 mp3type;
   GList *factories;
   GstElementFactory *parsefactory;
-  GstElement *bin, *src, *parse, *audiosink;
+  GstElement *bin, *src, *parse, *osssink;
   GList *padlist;
   ghttp_request *pls;
   guchar *plsbuf;
@@ -85,7 +85,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(src),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -93,13 +93,13 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(src));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(src,"src"),
                   gst_element_get_pad(parse,"sink"));
   gst_pad_connect(gst_element_get_pad(parse,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
 
   sleep(5); /* to let the network buffer fill a bit */
@@ -108,7 +108,7 @@ int main(int argc,char *argv[]) {
     gst_httpsrc_push(GST_SRC(src));
   }
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(src));
   gst_object_destroy(GST_OBJECT(bin));
index 767deab..826613e 100644 (file)
@@ -26,7 +26,7 @@ int main(int argc,char *argv[]) {
 
   bin = gst_bin_new("bin");
 
-  srcfactory = gst_elementfactory_find("audiosrc");
+  srcfactory = gst_elementfactory_find("osssrc");
   spectrumfactory = gst_elementfactory_find("gstspectrum");
 
   src = gst_elementfactory_create(srcfactory,"src");
index a9867c6..639aa14 100644 (file)
@@ -36,7 +36,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -44,18 +44,18 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(parse,"sink"));
   gst_pad_connect(gst_element_get_pad(parse,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   while(1)
     gst_disksrc_push(GST_SRC(disksrc));
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
index 136d627..6d3bd2b 100644 (file)
@@ -7,8 +7,8 @@
 int main(int argc,char *argv[]) {
   int fd;
   GstPipeline *pipeline;
-  GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
-  GstElementFactory *audiosrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
+  GstElement *osssrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
+  GstElementFactory *osssrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
   GstElementFactory *videosrcfactory;
   GList *padlist;
 
@@ -20,8 +20,8 @@ int main(int argc,char *argv[]) {
 
   pipeline = gst_pipeline_new("pipeline");
 
-  audiosrcfactory = gst_elementfactory_find("audiosrc");
-  audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
+  osssrcfactory = gst_elementfactory_find("osssrc");
+  osssrc = gst_elementfactory_create(osssrcfactory,"osssrc");
 
   videosrcfactory = gst_elementfactory_find("v4lsrc");
   videosrc = gst_elementfactory_create(videosrcfactory,"videosrc");
index d3d2475..af4ad41 100644 (file)
@@ -7,8 +7,8 @@
 int main(int argc,char *argv[]) {
   int fd;
   GstPipeline *pipeline;
-  GstElement *audiosrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
-  GstElementFactory *audiosrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
+  GstElement *osssrc, *videosrc, *fdsink, *encoder, *compress, *video_queue, *video_thread;
+  GstElementFactory *osssrcfactory, *fdsinkfactory, *encoderfactory, *compressfactory;
   GstElementFactory *videosrcfactory;
   GList *padlist;
 
@@ -20,8 +20,8 @@ int main(int argc,char *argv[]) {
 
   pipeline = gst_pipeline_new("pipeline");
 
-  audiosrcfactory = gst_elementfactory_find("audiosrc");
-  audiosrc = gst_elementfactory_create(audiosrcfactory,"audiosrc");
+  osssrcfactory = gst_elementfactory_find("osssrc");
+  osssrc = gst_elementfactory_create(osssrcfactory,"osssrc");
 
   videosrcfactory = gst_elementfactory_find("v4lsrc");
   videosrc = gst_elementfactory_create(videosrcfactory,"videosrc");
index 1173e9e..b65171b 100644 (file)
--- a/test/w.c
+++ b/test/w.c
@@ -9,7 +9,7 @@ int main(int argc,char *argv[]) {
   GstType *autype;
   GList *factories;
   GstElementFactory *parsefactory;
-  GstElement *bin, *disksrc, *parse, *audiosink;
+  GstElement *bin, *disksrc, *parse, *osssink;
   GList *padlist;
 
   gst_init(&argc,&argv);
@@ -43,7 +43,7 @@ int main(int argc,char *argv[]) {
   }
 
 
-  audiosink = gst_audiosink_new("audiosink");
+  osssink = gst_osssink_new("osssink");
 
   gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
                      GTK_SIGNAL_FUNC(eof),NULL);
@@ -51,20 +51,20 @@ int main(int argc,char *argv[]) {
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
   gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
-  gst_bin_add(GST_BIN(bin),GST_OBJECT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(parse,"sink"));
   gst_pad_connect(gst_element_get_pad(parse,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   while(1) {
     g_print("\n");
     gst_disksrc_push(GST_SRC(disksrc));
   }
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(disksrc));
   gst_object_destroy(GST_OBJECT(bin));
index 3402d28..eaeff2d 100644 (file)
@@ -12,7 +12,7 @@ main (int argc,char *argv[])
 {
   GstElement *bin;
   GstElement *effect;
-  GstElement *audiosink;
+  GstElement *osssink;
 
   gst_init(&argc,&argv);
 
@@ -37,17 +37,17 @@ main (int argc,char *argv[])
   //gtk_object_set (GTK_OBJECT (src), "configure", TRUE, NULL);
   //gtk_object_set (GTK_OBJECT (src), "show_file_info", TRUE, NULL);
 
-  audiosink = gst_elementfactory_make("audiosink", "audiosink");
-  g_return_val_if_fail(audiosink != NULL, -1);
+  osssink = gst_elementfactory_make("osssink", "osssink");
+  g_return_val_if_fail(osssink != NULL, -1);
 
   gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
   gst_bin_add(GST_BIN(bin),GST_ELEMENT(effect));
-  gst_bin_add(GST_BIN(bin),GST_ELEMENT(audiosink));
+  gst_bin_add(GST_BIN(bin),GST_ELEMENT(osssink));
 
   gst_pad_connect(gst_element_get_pad(src,"src"),
                   gst_element_get_pad(effect,"sink"));
   gst_pad_connect(gst_element_get_pad(effect,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_element_set_state(GST_ELEMENT(bin),GST_STATE_PLAYING);
 
index 4c1a05c..70de69b 100644 (file)
@@ -10,14 +10,14 @@ int
 main (int argc, char *argv[])
 {
   GstElement *element;
-  GstElement *videosink, *audiosink;
+  GstElement *videosink, *osssink;
   GstAutoplug *autoplugger;
   GList *testcaps;
 
   gst_init(&argc,&argv);
 
-  audiosink = gst_elementfactory_make ("audiosink", "audiosink");
-  g_assert (audiosink != NULL);
+  osssink = gst_elementfactory_make ("osssink", "osssink");
+  g_assert (osssink != NULL);
   videosink = gst_elementfactory_make ("videosink", "videosink");
   g_assert (videosink != NULL);
 
@@ -34,7 +34,7 @@ main (int argc, char *argv[])
   gtk_signal_connect (GTK_OBJECT (autoplugger), "new_object", new_object_added, NULL);
 
   element = gst_autoplug_to_caps (autoplugger, testcaps,
-                 gst_pad_get_caps (gst_element_get_pad (audiosink, "sink")),
+                 gst_pad_get_caps (gst_element_get_pad (osssink, "sink")),
                  gst_pad_get_caps (gst_element_get_pad (videosink, "sink")),
                  NULL);
   g_assert (element != NULL);
index d63726d..9f6a150 100644 (file)
@@ -11,7 +11,7 @@ main (int argc, char *argv[])
   gst_init(&argc,&argv);
 
   sink1 = gst_elementfactory_make ("videosink", "videosink");
-  sink2 = gst_elementfactory_make ("audiosink", "audiosink");
+  sink2 = gst_elementfactory_make ("osssink", "osssink");
 
   autoplug = gst_autoplugfactory_make ("staticrender");
   autoplug2 = gst_autoplugfactory_make ("static");
@@ -81,7 +81,7 @@ main (int argc, char *argv[])
   }
 
   sink1 = gst_elementfactory_make ("videosink", "videosink");
-  sink2 = gst_elementfactory_make ("audiosink", "audiosink");
+  sink2 = gst_elementfactory_make ("osssink", "osssink");
   
   element = gst_autoplug_to_renderers (autoplug,
                  g_list_append (NULL, gst_caps_new_with_props(
index dbd47c6..a408c9d 100644 (file)
@@ -53,7 +53,7 @@ gst_play_typefind (GstBin *bin, GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *videosink;
+  GstElement *disksrc, *osssink, *videosink;
   GstElement *bin;
   GtkWidget *appwindow;
   GstCaps *srccaps;
@@ -88,8 +88,8 @@ int main(int argc,char *argv[])
   }
   
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* and an video sink */
   videosink = gst_elementfactory_make("videosink", "play_video");
@@ -102,7 +102,7 @@ int main(int argc,char *argv[])
   new_element = gst_autoplug_to_renderers (autoplug,
            srccaps,
            videosink,
-           audiosink,
+           osssink,
            NULL);
 
   if (!new_element) {
index 3d7c7d8..566a2fb 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *bin, *disksrc, *parse, *decoder, *audiosink;
+  GstElement *bin, *disksrc, *parse, *decoder, *osssink;
 
   gst_init(&argc,&argv);
 
@@ -35,13 +35,13 @@ int main(int argc,char *argv[])
   parse = gst_elementfactory_make("mp3parse","parse");
   decoder = gst_elementfactory_make("mpg123","decoder");
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
+  osssink = gst_elementfactory_make("osssink", "play_audio");
 
   /* add objects to the main pipeline */
   gst_bin_add(GST_BIN(bin), disksrc);
   gst_bin_add(GST_BIN(bin), parse);
   gst_bin_add(GST_BIN(bin), decoder);
-  gst_bin_add(GST_BIN(bin), audiosink);
+  gst_bin_add(GST_BIN(bin), osssink);
 
   /* connect src to sink */
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
@@ -49,7 +49,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(parse,"src"),
                   gst_element_get_pad(decoder,"sink"));
   gst_pad_connect(gst_element_get_pad(decoder,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* start playing */
   gst_element_set_state(bin, GST_STATE_PLAYING);
@@ -63,7 +63,7 @@ int main(int argc,char *argv[])
   /* stop the bin */
   gst_element_set_state(bin, GST_STATE_NULL);
 
-  gst_object_destroy(GST_OBJECT(audiosink));
+  gst_object_destroy(GST_OBJECT(osssink));
   gst_object_destroy(GST_OBJECT(parse));
   gst_object_destroy(GST_OBJECT(decoder));
   gst_object_destroy(GST_OBJECT(disksrc));
index 8b70518..19e0b1e 100644 (file)
@@ -11,7 +11,7 @@ void eos(GstElement *element)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink;
+  GstElement *disksrc, *osssink;
   GstElement *pipeline, *thread;
 
   gst_init(&argc,&argv);
@@ -37,13 +37,13 @@ int main(int argc,char *argv[])
                      GTK_SIGNAL_FUNC(eos),NULL);
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
-  gst_pipeline_add_sink(GST_PIPELINE(pipeline), audiosink);
+  gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink);
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("unable to handle stream\n");
index 0208e13..b09ccd3 100755 (executable)
@@ -1,4 +1,4 @@
 #! /bin/sh
 for loc in "$@"; do
-../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! audiosink
+../../tools/gstreamer-launch disksrc \""location=$loc"\" ! mp3parse ! mpg123 ! osssink
 done
index e2caf58..0d34a4b 100644 (file)
@@ -3,7 +3,7 @@
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *parse, *decode, *queue;
+  GstElement *disksrc, *osssink, *parse, *decode, *queue;
   GstElement *bin;
   GstElement *thread;
 
@@ -33,8 +33,8 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   gst_bin_use_cothreads (GST_BIN (bin), TRUE);
 
@@ -44,7 +44,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(bin), decode);
   gst_bin_add(GST_BIN(bin), queue);
 
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
 
   gst_bin_add(GST_BIN(bin), thread);
   
@@ -55,7 +55,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(decode,"src"),
                   gst_element_get_pad(queue,"sink"));
   gst_pad_connect(gst_element_get_pad(queue,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   /* start playing */
   gst_element_set_state(GST_ELEMENT(bin), GST_STATE_PLAYING);
index 706acc0..837732e 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue;
+  GstElement *disksrc, *osssink, *queue;
   GstElement *pipeline;
   GstElement *thread;
 
@@ -42,18 +42,18 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
   gst_pipeline_add_sink(GST_PIPELINE(pipeline), queue);
 
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
 
   gst_pad_connect(gst_element_get_pad(queue,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("cannot autoplug pipeline\n");
index 237b967..152cd1e 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *parse, *decode;
   GstElement *bin;
   GstElement *thread;
 
@@ -42,8 +42,8 @@ int main(int argc,char *argv[])
   queue = gst_elementfactory_make("queue", "queue");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -54,7 +54,7 @@ int main(int argc,char *argv[])
 
   gst_bin_add(GST_BIN(thread), parse);
   gst_bin_add(GST_BIN(thread), decode);
-  gst_bin_add(GST_BIN(thread), audiosink);
+  gst_bin_add(GST_BIN(thread), osssink);
   
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -64,7 +64,7 @@ int main(int argc,char *argv[])
   gst_pad_connect(gst_element_get_pad(parse,"src"),
                   gst_element_get_pad(decode,"sink"));
   gst_pad_connect(gst_element_get_pad(decode,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
 
index a7e9d6d..cb984cc 100644 (file)
@@ -13,7 +13,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *queue2, *parse, *decode;
   GstElement *bin;
   GstElement *thread, *thread2;
 
@@ -45,8 +45,8 @@ int main(int argc,char *argv[])
   queue2 = gst_elementfactory_make("queue", "queue2");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -59,7 +59,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(thread), decode);
   gst_bin_add(GST_BIN(thread), queue2);
 
-  gst_bin_add(GST_BIN(thread2), audiosink);
+  gst_bin_add(GST_BIN(thread2), osssink);
   
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -72,7 +72,7 @@ int main(int argc,char *argv[])
                   gst_element_get_pad(queue2,"sink"));
 
   gst_pad_connect(gst_element_get_pad(queue2,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
   gst_bin_add(GST_BIN(bin), thread2);
index b8bc00e..5c691a0 100644 (file)
@@ -14,7 +14,7 @@ void eos(GstElement *element, gpointer data)
 
 int main(int argc,char *argv[]) 
 {
-  GstElement *disksrc, *audiosink;
+  GstElement *disksrc, *osssink;
   GstElement *pipeline;
   GstElement *thread;
 
@@ -41,13 +41,13 @@ int main(int argc,char *argv[])
                      GTK_SIGNAL_FUNC(eos), thread);
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   /* add objects to the main pipeline */
   /*
   gst_pipeline_add_src(GST_PIPELINE(pipeline), disksrc);
-  gst_pipeline_add_sink(GST_PIPELINE(pipeline), audiosink);
+  gst_pipeline_add_sink(GST_PIPELINE(pipeline), osssink);
 
   if (!gst_pipeline_autoplug(GST_PIPELINE(pipeline))) {
     g_print("unable to handle stream\n");
index 154f943..ce8b395 100644 (file)
@@ -15,7 +15,7 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
 
 int main(int argc,char *argv[])
 {
-  GstElement *disksrc, *audiosink, *queue, *queue2, *parse, *decode;
+  GstElement *disksrc, *osssink, *queue, *queue2, *parse, *decode;
   GstElement *bin;
   GstElement *thread, *thread2;
 
@@ -52,8 +52,8 @@ int main(int argc,char *argv[])
   queue2 = gst_elementfactory_make("queue", "queue2");
 
   /* and an audio sink */
-  audiosink = gst_elementfactory_make("audiosink", "play_audio");
-  g_assert(audiosink != NULL);
+  osssink = gst_elementfactory_make("osssink", "play_audio");
+  g_assert(osssink != NULL);
 
   parse = gst_elementfactory_make("mp3parse", "parse");
   decode = gst_elementfactory_make("mpg123", "decode");
@@ -66,7 +66,7 @@ int main(int argc,char *argv[])
   gst_bin_add(GST_BIN(thread), decode);
   gst_bin_add(GST_BIN(thread), queue2);
 
-  gst_bin_add(GST_BIN(thread2), audiosink);
+  gst_bin_add(GST_BIN(thread2), osssink);
 
   gst_pad_connect(gst_element_get_pad(disksrc,"src"),
                   gst_element_get_pad(queue,"sink"));
@@ -79,7 +79,7 @@ int main(int argc,char *argv[])
                   gst_element_get_pad(queue2,"sink"));
 
   gst_pad_connect(gst_element_get_pad(queue2,"src"),
-                  gst_element_get_pad(audiosink,"sink"));
+                  gst_element_get_pad(osssink,"sink"));
 
   gst_bin_add(GST_BIN(bin), thread);
   gst_bin_add(GST_BIN(bin), thread2);
index 418bfeb..94f86c9 100644 (file)
@@ -7,7 +7,7 @@ void paranoia_eos(GstPad *pad) {
 
 int main(int argc,char *argv[]) {
   GstPipeline *pipeline;
-  GstElement *paranoia,*queue,*audio_thread,*audiosink;
+  GstElement *paranoia,*queue,*audio_thread,*osssink;
   int i;
   int track = (argc == 2) ? atoi(argv[1]) : 1;
 
@@ -29,14 +29,14 @@ int main(int argc,char *argv[]) {
   gtk_object_set(GTK_OBJECT(queue),"max_level",750,NULL);
   g_return_val_if_fail(queue != NULL,4);
 
-  audiosink = gst_elementfactory_make("fakesink","audiosink");
-  g_return_val_if_fail(audiosink != NULL,4);
+  osssink = gst_elementfactory_make("fakesink","osssink");
+  g_return_val_if_fail(osssink != NULL,4);
 
   gst_bin_add(GST_BIN(pipeline),paranoia);
   gst_bin_add(GST_BIN(pipeline),queue);
-  gst_bin_add(GST_BIN(audio_thread),audiosink);
+  gst_bin_add(GST_BIN(audio_thread),osssink);
   gst_bin_add(GST_BIN(pipeline),audio_thread);
-  gst_element_add_ghost_pad(GST_ELEMENT(audio_thread),gst_element_get_pad(audiosink,"sink"),"sink");
+  gst_element_add_ghost_pad(GST_ELEMENT(audio_thread),gst_element_get_pad(osssink,"sink"),"sink");
 
   gst_element_connect(paranoia,"src",queue,"sink");
   gst_element_connect(queue,"src",audio_thread,"sink");
index 71d730c..29f7f44 100644 (file)
@@ -8,7 +8,7 @@ feedback pipelines are the most complex.
 
 A simple commandline looks like:
 
-./launch disksrc demo.mp3 | mp3parse | mpg123 | audiosink-oss
+./launch disksrc demo.mp3 | mp3parse | mpg123 | osssink
 
 A more complex pipeline looks like:
 
index 3517ac8..86e4f07 100644 (file)
@@ -25,6 +25,9 @@ void print_prop(GstPropsEntry *prop,gboolean showname,gchar *pfx) {
     case GST_PROPS_BOOL_ID_NUM:
       printf("Boolean: %s\n",prop->data.bool_data ? "TRUE" : "FALSE");
       break;
+    case GST_PROPS_STRING_ID_NUM:
+      printf("String: %s\n",prop->data.string_data.string);
+      break;
     case GST_PROPS_FOURCC_ID_NUM:
       printf("FourCC: %c%c%c%c\n",
              prop->data.fourcc_data & 0xff,prop->data.fourcc_data>>8 & 0xff,