summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.in1
-rw-r--r--examples/autoplug/autoplug.c8
-rw-r--r--examples/helloworld/helloworld.c10
-rw-r--r--examples/helloworld2/helloworld2.c8
-rwxr-xr-xexamples/launch/mp3play2
-rw-r--r--examples/queue/queue.c10
-rw-r--r--examples/queue2/queue2.c10
-rw-r--r--examples/queue3/queue3.c10
-rw-r--r--examples/queue4/queue4.c10
-rw-r--r--examples/thread/thread.c8
-rw-r--r--examples/xml/createxml.c10
-rw-r--r--gst/Makefile.am2
-rw-r--r--gst/elements/Makefile.am6
-rw-r--r--gst/elements/gstaudiosink.c456
-rw-r--r--gst/elements/gstaudiosink.h92
-rw-r--r--gst/elements/gstaudiosrc.c321
-rw-r--r--gst/elements/gstaudiosrc.h95
-rw-r--r--gst/elements/gstelements.c6
-rw-r--r--gst/elements/gstmultidisksrc.c305
-rw-r--r--gst/elements/gstmultidisksrc.h84
-rw-r--r--gst/elements/gstmultifilesrc.c305
-rw-r--r--gst/elements/gstmultifilesrc.h84
-rw-r--r--gst/elements/gstsinesrc.c22
-rw-r--r--gst/elements/gstsinesrc.h6
-rw-r--r--gst/gstcaps.c39
-rw-r--r--gst/gstcaps.h10
-rw-r--r--gst/gstprops.c62
-rw-r--r--gst/gstprops.h5
-rw-r--r--gst/gstpropsprivate.h3
-rw-r--r--gst/meta/Makefile.am1
-rw-r--r--gst/meta/audioraw.h40
-rw-r--r--gstplay/gstplay.c2
-rw-r--r--plugins/elements/Makefile.am6
-rw-r--r--plugins/elements/gstaudiosink.c456
-rw-r--r--plugins/elements/gstaudiosink.h92
-rw-r--r--plugins/elements/gstaudiosrc.c321
-rw-r--r--plugins/elements/gstaudiosrc.h95
-rw-r--r--plugins/elements/gstelements.c6
-rw-r--r--plugins/elements/gstmultidisksrc.c305
-rw-r--r--plugins/elements/gstmultidisksrc.h84
-rw-r--r--plugins/elements/gstmultifilesrc.c305
-rw-r--r--plugins/elements/gstmultifilesrc.h84
-rw-r--r--plugins/elements/gstsinesrc.c22
-rw-r--r--plugins/elements/gstsinesrc.h6
-rw-r--r--test/a.c10
-rw-r--r--test/ac3play.c2
-rw-r--r--test/aviparse.c2
-rw-r--r--test/m.c2
-rw-r--r--test/mcut.c2
-rw-r--r--test/mp1parse.c2
-rw-r--r--test/mp1tomp1.c4
-rw-r--r--test/mp2toavi.c2
-rw-r--r--test/mp2tomp1.c2
-rw-r--r--test/mp3.c2
-rw-r--r--test/mp3play.c2
-rw-r--r--test/mpeg2parse.c4
-rw-r--r--test/mpg123.c10
-rw-r--r--test/p.c16
-rw-r--r--test/qtest.c2
-rw-r--r--test/r.c16
-rw-r--r--test/record.c12
-rw-r--r--test/s.c10
-rw-r--r--test/spectrum.c2
-rw-r--r--test/typefind.c8
-rw-r--r--test/vidcapture.c8
-rw-r--r--test/vidcapture2.c8
-rw-r--r--test/w.c10
-rw-r--r--test/xmmstest.c10
-rw-r--r--tests/autoplug.c8
-rw-r--r--tests/autoplug3.c4
-rw-r--r--tests/old/examples/autoplug/autoplug.c8
-rw-r--r--tests/old/examples/helloworld/helloworld.c10
-rw-r--r--tests/old/examples/helloworld2/helloworld2.c8
-rwxr-xr-xtests/old/examples/launch/mp3play2
-rw-r--r--tests/old/examples/queue/queue.c10
-rw-r--r--tests/old/examples/queue2/queue2.c10
-rw-r--r--tests/old/examples/queue3/queue3.c10
-rw-r--r--tests/old/examples/queue4/queue4.c10
-rw-r--r--tests/old/examples/thread/thread.c8
-rw-r--r--tests/old/examples/xml/createxml.c10
-rw-r--r--tests/paranoia.c10
-rw-r--r--tools/README2
-rw-r--r--tools/gstreamer-inspect.c3
83 files changed, 1868 insertions, 2208 deletions
diff --git a/configure.in b/configure.in
index 137fce665..45e588ff3 100644
--- a/configure.in
+++ b/configure.in
@@ -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
diff --git a/examples/autoplug/autoplug.c b/examples/autoplug/autoplug.c
index dbd47c6af..a408c9d05 100644
--- a/examples/autoplug/autoplug.c
+++ b/examples/autoplug/autoplug.c
@@ -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) {
diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c
index 3d7c7d872..566a2fb20 100644
--- a/examples/helloworld/helloworld.c
+++ b/examples/helloworld/helloworld.c
@@ -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));
diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c
index 8b70518ed..19e0b1e44 100644
--- a/examples/helloworld2/helloworld2.c
+++ b/examples/helloworld2/helloworld2.c
@@ -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");
diff --git a/examples/launch/mp3play b/examples/launch/mp3play
index 0208e1326..b09ccd304 100755
--- a/examples/launch/mp3play
+++ b/examples/launch/mp3play
@@ -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
diff --git a/examples/queue/queue.c b/examples/queue/queue.c
index e2caf58e3..0d34a4bf9 100644
--- a/examples/queue/queue.c
+++ b/examples/queue/queue.c
@@ -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);
diff --git a/examples/queue2/queue2.c b/examples/queue2/queue2.c
index 706acc073..837732e4c 100644
--- a/examples/queue2/queue2.c
+++ b/examples/queue2/queue2.c
@@ -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");
diff --git a/examples/queue3/queue3.c b/examples/queue3/queue3.c
index 237b967db..152cd1e30 100644
--- a/examples/queue3/queue3.c
+++ b/examples/queue3/queue3.c
@@ -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);
diff --git a/examples/queue4/queue4.c b/examples/queue4/queue4.c
index a7e9d6d10..cb984cc7b 100644
--- a/examples/queue4/queue4.c
+++ b/examples/queue4/queue4.c
@@ -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);
diff --git a/examples/thread/thread.c b/examples/thread/thread.c
index b8bc00e1d..5c691a0fa 100644
--- a/examples/thread/thread.c
+++ b/examples/thread/thread.c
@@ -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");
diff --git a/examples/xml/createxml.c b/examples/xml/createxml.c
index 154f943b9..ce8b39549 100644
--- a/examples/xml/createxml.c
+++ b/examples/xml/createxml.c
@@ -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);
diff --git a/gst/Makefile.am b/gst/Makefile.am
index c5f4e9310..0ccec0b03 100644
--- a/gst/Makefile.am
+++ b/gst/Makefile.am
@@ -1,5 +1,5 @@
# cheap trick to build . first...
-SUBDIRS = . types meta elements autoplug
+SUBDIRS = . types elements autoplug
lib_LTLIBRARIES = libgst.la
diff --git a/gst/elements/Makefile.am b/gst/elements/Makefile.am
index 0c5b9e681..e41a972f4 100644
--- a/gst/elements/Makefile.am
+++ b/gst/elements/Makefile.am
@@ -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
index 41a2b6c82..000000000
--- a/gst/elements/gstaudiosink.c
+++ /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
index d5233922f..000000000
--- a/gst/elements/gstaudiosink.h
+++ /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
index b4645fdb9..000000000
--- a/gst/elements/gstaudiosrc.c
+++ /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
index b4bbfc09e..000000000
--- a/gst/elements/gstaudiosrc.h
+++ /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__ */
diff --git a/gst/elements/gstelements.c b/gst/elements/gstelements.c
index 62b5a9288..326d0e3aa 100644
--- a/gst/elements/gstelements.c
+++ b/gst/elements/gstelements.c
@@ -23,14 +23,13 @@
#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
index 000000000..726aed976
--- /dev/null
+++ b/gst/elements/gstmultidisksrc.c
@@ -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
index 000000000..ed4a94c96
--- /dev/null
+++ b/gst/elements/gstmultidisksrc.h
@@ -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
index 000000000..726aed976
--- /dev/null
+++ b/gst/elements/gstmultifilesrc.c
@@ -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
index 000000000..ed4a94c96
--- /dev/null
+++ b/gst/elements/gstmultifilesrc.h
@@ -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/gstsinesrc.c b/gst/elements/gstsinesrc.c
index 9d46555ee..5a4e4abe5 100644
--- a/gst/elements/gstsinesrc.c
+++ b/gst/elements/gstsinesrc.c
@@ -21,10 +21,6 @@
* 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;
}
diff --git a/gst/elements/gstsinesrc.h b/gst/elements/gstsinesrc.h
index 82803f71d..167a1ad09 100644
--- a/gst/elements/gstsinesrc.h
+++ b/gst/elements/gstsinesrc.h
@@ -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 {
diff --git a/gst/gstcaps.c b/gst/gstcaps.c
index 84e255dda..81191dc30 100644
--- a/gst/gstcaps.c
+++ b/gst/gstcaps.c
@@ -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")) {
diff --git a/gst/gstcaps.h b/gst/gstcaps.h
index 2521e7a70..71b8213ad 100644
--- a/gst/gstcaps.h
+++ b/gst/gstcaps.h
@@ -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 */
diff --git a/gst/gstprops.c b/gst/gstprops.c
index 0db771045..a56a31440 100644
--- a/gst/gstprops.c
+++ b/gst/gstprops.c
@@ -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);
diff --git a/gst/gstprops.h b/gst/gstprops.h
index 5da0492a7..0c0ec6bb3 100644
--- a/gst/gstprops.h
+++ b/gst/gstprops.h
@@ -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);
diff --git a/gst/gstpropsprivate.h b/gst/gstpropsprivate.h
index 8a5fb057f..4f8eec219 100644
--- a/gst/gstpropsprivate.h
+++ b/gst/gstpropsprivate.h
@@ -43,6 +43,9 @@ struct _GstPropsEntry {
GList *entries;
} list_data;
struct {
+ gchar *string;
+ } string_data;
+ struct {
gint min;
gint max;
} int_range_data;
diff --git a/gst/meta/Makefile.am b/gst/meta/Makefile.am
index 59107c0de..1ddd91110 100644
--- a/gst/meta/Makefile.am
+++ b/gst/meta/Makefile.am
@@ -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
index 7c8d52d23..000000000
--- a/gst/meta/audioraw.h
+++ /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__ */
-
diff --git a/gstplay/gstplay.c b/gstplay/gstplay.c
index 13105888e..6f0b65126 100644
--- a/gstplay/gstplay.c
+++ b/gstplay/gstplay.c
@@ -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);
diff --git a/plugins/elements/Makefile.am b/plugins/elements/Makefile.am
index 0c5b9e681..e41a972f4 100644
--- a/plugins/elements/Makefile.am
+++ b/plugins/elements/Makefile.am
@@ -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
index 41a2b6c82..000000000
--- a/plugins/elements/gstaudiosink.c
+++ /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
index d5233922f..000000000
--- a/plugins/elements/gstaudiosink.h
+++ /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
index b4645fdb9..000000000
--- a/plugins/elements/gstaudiosrc.c
+++ /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
index b4bbfc09e..000000000
--- a/plugins/elements/gstaudiosrc.h
+++ /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__ */
diff --git a/plugins/elements/gstelements.c b/plugins/elements/gstelements.c
index 62b5a9288..326d0e3aa 100644
--- a/plugins/elements/gstelements.c
+++ b/plugins/elements/gstelements.c
@@ -23,14 +23,13 @@
#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
index 000000000..726aed976
--- /dev/null
+++ b/plugins/elements/gstmultidisksrc.c
@@ -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
index 000000000..ed4a94c96
--- /dev/null
+++ b/plugins/elements/gstmultidisksrc.h
@@ -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
index 000000000..726aed976
--- /dev/null
+++ b/plugins/elements/gstmultifilesrc.c
@@ -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
index 000000000..ed4a94c96
--- /dev/null
+++ b/plugins/elements/gstmultifilesrc.h
@@ -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/gstsinesrc.c b/plugins/elements/gstsinesrc.c
index 9d46555ee..5a4e4abe5 100644
--- a/plugins/elements/gstsinesrc.c
+++ b/plugins/elements/gstsinesrc.c
@@ -21,10 +21,6 @@
* 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;
}
diff --git a/plugins/elements/gstsinesrc.h b/plugins/elements/gstsinesrc.h
index 82803f71d..167a1ad09 100644
--- a/plugins/elements/gstsinesrc.h
+++ b/plugins/elements/gstsinesrc.h
@@ -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 {
diff --git a/test/a.c b/test/a.c
index 6efa57dae..03dd68015 100644
--- 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));
diff --git a/test/ac3play.c b/test/ac3play.c
index 9967a1aad..915479386 100644
--- a/test/ac3play.c
+++ b/test/ac3play.c
@@ -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
diff --git a/test/aviparse.c b/test/aviparse.c
index 172193079..7e3882e59 100644
--- a/test/aviparse.c
+++ b/test/aviparse.c
@@ -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
diff --git a/test/m.c b/test/m.c
index f210e068e..6b3607ad8 100644
--- 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);
diff --git a/test/mcut.c b/test/mcut.c
index 95f1969e4..a75d109c7 100644
--- a/test/mcut.c
+++ b/test/mcut.c
@@ -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);
diff --git a/test/mp1parse.c b/test/mp1parse.c
index 641f4b425..4db677dab 100644
--- a/test/mp1parse.c
+++ b/test/mp1parse.c
@@ -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
diff --git a/test/mp1tomp1.c b/test/mp1tomp1.c
index f047886b0..ebe298e81 100644
--- a/test/mp1tomp1.c
+++ b/test/mp1tomp1.c
@@ -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
diff --git a/test/mp2toavi.c b/test/mp2toavi.c
index 4dd7e3cae..fd5a7b7e8 100644
--- a/test/mp2toavi.c
+++ b/test/mp2toavi.c
@@ -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
diff --git a/test/mp2tomp1.c b/test/mp2tomp1.c
index 9265930d2..78d9550ec 100644
--- a/test/mp2tomp1.c
+++ b/test/mp2tomp1.c
@@ -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
diff --git a/test/mp3.c b/test/mp3.c
index 88b8a7ad1..5f4ff6fba 100644
--- a/test/mp3.c
+++ b/test/mp3.c
@@ -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);
diff --git a/test/mp3play.c b/test/mp3play.c
index 840179835..0f57fcf5f 100644
--- a/test/mp3play.c
+++ b/test/mp3play.c
@@ -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");
diff --git a/test/mpeg2parse.c b/test/mpeg2parse.c
index bdae3ca37..50aeb0162 100644
--- a/test/mpeg2parse.c
+++ b/test/mpeg2parse.c
@@ -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
diff --git a/test/mpg123.c b/test/mpg123.c
index e242b9c8e..6c3d17dc7 100644
--- a/test/mpg123.c
+++ b/test/mpg123.c
@@ -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));
diff --git a/test/p.c b/test/p.c
index 457e4b374..6ec69825d 100644
--- 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));
}
diff --git a/test/qtest.c b/test/qtest.c
index cc32715f6..262f0499d 100644
--- a/test/qtest.c
+++ b/test/qtest.c
@@ -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),
diff --git a/test/r.c b/test/r.c
index 5acc6225f..a389f6805 100644
--- 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));
}
diff --git a/test/record.c b/test/record.c
index b29796984..12b3a2783 100644
--- a/test/record.c
+++ b/test/record.c
@@ -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");
diff --git a/test/s.c b/test/s.c
index cefab58e4..1d2f6b6b3 100644
--- 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));
diff --git a/test/spectrum.c b/test/spectrum.c
index 767deabf0..826613ed1 100644
--- a/test/spectrum.c
+++ b/test/spectrum.c
@@ -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");
diff --git a/test/typefind.c b/test/typefind.c
index a9867c6b0..639aa14c1 100644
--- a/test/typefind.c
+++ b/test/typefind.c
@@ -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));
diff --git a/test/vidcapture.c b/test/vidcapture.c
index 136d62725..6d3bd2bdc 100644
--- a/test/vidcapture.c
+++ b/test/vidcapture.c
@@ -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");
diff --git a/test/vidcapture2.c b/test/vidcapture2.c
index d3d247528..af4ad4145 100644
--- a/test/vidcapture2.c
+++ b/test/vidcapture2.c
@@ -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");
diff --git a/test/w.c b/test/w.c
index 1173e9e95..b65171b38 100644
--- 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));
diff --git a/test/xmmstest.c b/test/xmmstest.c
index 3402d2832..eaeff2d58 100644
--- a/test/xmmstest.c
+++ b/test/xmmstest.c
@@ -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);
diff --git a/tests/autoplug.c b/tests/autoplug.c
index 4c1a05c3f..70de69b63 100644
--- a/tests/autoplug.c
+++ b/tests/autoplug.c
@@ -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);
diff --git a/tests/autoplug3.c b/tests/autoplug3.c
index d63726ddc..9f6a15064 100644
--- a/tests/autoplug3.c
+++ b/tests/autoplug3.c
@@ -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(
diff --git a/tests/old/examples/autoplug/autoplug.c b/tests/old/examples/autoplug/autoplug.c
index dbd47c6af..a408c9d05 100644
--- a/tests/old/examples/autoplug/autoplug.c
+++ b/tests/old/examples/autoplug/autoplug.c
@@ -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) {
diff --git a/tests/old/examples/helloworld/helloworld.c b/tests/old/examples/helloworld/helloworld.c
index 3d7c7d872..566a2fb20 100644
--- a/tests/old/examples/helloworld/helloworld.c
+++ b/tests/old/examples/helloworld/helloworld.c
@@ -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));
diff --git a/tests/old/examples/helloworld2/helloworld2.c b/tests/old/examples/helloworld2/helloworld2.c
index 8b70518ed..19e0b1e44 100644
--- a/tests/old/examples/helloworld2/helloworld2.c
+++ b/tests/old/examples/helloworld2/helloworld2.c
@@ -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");
diff --git a/tests/old/examples/launch/mp3play b/tests/old/examples/launch/mp3play
index 0208e1326..b09ccd304 100755
--- a/tests/old/examples/launch/mp3play
+++ b/tests/old/examples/launch/mp3play
@@ -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
diff --git a/tests/old/examples/queue/queue.c b/tests/old/examples/queue/queue.c
index e2caf58e3..0d34a4bf9 100644
--- a/tests/old/examples/queue/queue.c
+++ b/tests/old/examples/queue/queue.c
@@ -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);
diff --git a/tests/old/examples/queue2/queue2.c b/tests/old/examples/queue2/queue2.c
index 706acc073..837732e4c 100644
--- a/tests/old/examples/queue2/queue2.c
+++ b/tests/old/examples/queue2/queue2.c
@@ -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");
diff --git a/tests/old/examples/queue3/queue3.c b/tests/old/examples/queue3/queue3.c
index 237b967db..152cd1e30 100644
--- a/tests/old/examples/queue3/queue3.c
+++ b/tests/old/examples/queue3/queue3.c
@@ -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);
diff --git a/tests/old/examples/queue4/queue4.c b/tests/old/examples/queue4/queue4.c
index a7e9d6d10..cb984cc7b 100644
--- a/tests/old/examples/queue4/queue4.c
+++ b/tests/old/examples/queue4/queue4.c
@@ -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);
diff --git a/tests/old/examples/thread/thread.c b/tests/old/examples/thread/thread.c
index b8bc00e1d..5c691a0fa 100644
--- a/tests/old/examples/thread/thread.c
+++ b/tests/old/examples/thread/thread.c
@@ -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");
diff --git a/tests/old/examples/xml/createxml.c b/tests/old/examples/xml/createxml.c
index 154f943b9..ce8b39549 100644
--- a/tests/old/examples/xml/createxml.c
+++ b/tests/old/examples/xml/createxml.c
@@ -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);
diff --git a/tests/paranoia.c b/tests/paranoia.c
index 418bfebf5..94f86c9c0 100644
--- a/tests/paranoia.c
+++ b/tests/paranoia.c
@@ -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");
diff --git a/tools/README b/tools/README
index 71d730c53..29f7f4476 100644
--- a/tools/README
+++ b/tools/README
@@ -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:
diff --git a/tools/gstreamer-inspect.c b/tools/gstreamer-inspect.c
index 3517ac8e2..86e4f0796 100644
--- a/tools/gstreamer-inspect.c
+++ b/tools/gstreamer-inspect.c
@@ -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,