summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Vander Stichele <thomas@apestaart.org>2002-10-29 18:05:28 +0000
committerThomas Vander Stichele <thomas@apestaart.org>2002-10-29 18:05:28 +0000
commit3f56890cf9af23d1a643423e331487e91fbbf2da (patch)
tree47f20996218e3f57cecca433f32b5128e4e91dc6
parent9f2e8e0c1dd821b593c8fc1785956b0e9c992413 (diff)
downloadgstreamer-plugins-bad-3f56890cf9af23d1a643423e331487e91fbbf2da.tar.gz
adding audio
Original commit message from CVS: adding audio
-rw-r--r--gst-libs/gst/play/play.old.c8
-rw-r--r--gst-libs/gst/play/playpipelines.c90
2 files changed, 82 insertions, 16 deletions
diff --git a/gst-libs/gst/play/play.old.c b/gst-libs/gst/play/play.old.c
index 2d77367d5..17913d098 100644
--- a/gst-libs/gst/play/play.old.c
+++ b/gst-libs/gst/play/play.old.c
@@ -322,6 +322,14 @@ gst_play_new (GstPlayPipeType pipe_type, GError **error)
play->set_video_sink = gst_play_videots_set_video;
play->set_audio_sink = gst_play_videots_set_audio;
break;
+ case GST_PLAY_PIPE_AUDIO:
+ /* we can reuse the threaded set functions */
+ play->setup_pipeline = gst_play_audio_setup;
+ play->teardown_pipeline = NULL;
+ play->set_autoplugger = gst_play_audiot_set_auto;
+ play->set_video_sink = NULL;
+ play->set_audio_sink = gst_play_audiot_set_audio;
+ break;
case GST_PLAY_PIPE_AUDIO_THREADED:
play->setup_pipeline = gst_play_audiot_setup;
play->teardown_pipeline = NULL;
diff --git a/gst-libs/gst/play/playpipelines.c b/gst-libs/gst/play/playpipelines.c
index 8cc8c3148..73e54bff3 100644
--- a/gst-libs/gst/play/playpipelines.c
+++ b/gst-libs/gst/play/playpipelines.c
@@ -20,7 +20,70 @@
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+
+/*
+ * GST_PLAY_PIPE_AUDIO
+ * gnomevfssrc ! spider ! volume ! osssink
+ */
+
+static gboolean
+gst_play_audio_setup (GstPlay *play, GError **error)
+{
+
+ /* creating gst_bin */
+ play->pipeline = gst_pipeline_new ("main_pipeline");
+ g_return_val_if_fail (GST_IS_PIPELINE (play->pipeline), FALSE);
+
+ /* create source element */
+ play->source = gst_element_factory_make ("gnomevfssrc", "source");
+ if (!play->source)
+ {
+ gst_play_error_plugin (GST_PLAY_ERROR_GNOMEVFSSRC, error);
+ return FALSE;
+ }
+
+ /* Adding element to bin */
+ gst_bin_add (GST_BIN (play->pipeline), play->source);
+
+ /* create audio elements */
+ play->volume = gst_element_factory_make ("volume", "volume");
+ if (!play->volume)
+ {
+ gst_play_error_plugin (GST_PLAY_ERROR_VOLUME, error);
+ return FALSE;
+ }
+
+ /* creating audio_sink from osssink (?) */
+ play->audio_sink = gst_element_factory_make ("fakesink", "fake_audio");
+ if (play->audio_sink == NULL)
+ {
+ gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
+ return FALSE;
+ }
+
+ g_signal_connect (
+ G_OBJECT (play->audio_sink), "eos",
+ G_CALLBACK (callback_audio_sink_eos), play);
+
+ gst_bin_add_many (
+ GST_BIN (play->pipeline), play->volume,
+ play->audio_sink, NULL);
+
+ gst_element_connect (play->volume, play->audio_sink);
+
+ gst_bin_set_pre_iterate_function(
+ GST_BIN (play->pipeline),
+ (GstBinPrePostIterateFunction) callback_bin_pre_iterate,
+ play->audio_bin_mutex);
+
+ gst_bin_set_post_iterate_function(
+ GST_BIN (play->pipeline),
+ (GstBinPrePostIterateFunction) callback_bin_post_iterate,
+ play->audio_bin_mutex);
+
+ return TRUE;
+}
+
/*
* GST_PLAY_PIPE_AUDIO_THREADED
* { gnomevfssrc ! spider ! volume ! osssink }
@@ -55,15 +118,13 @@ gst_play_audiot_setup (GstPlay *play, GError **error)
return FALSE;
}
- /* create audiosink.
- FIXME : Should use gconf to choose the right one */
- play->audio_sink = gst_element_factory_make ("osssink", "play_audio");
- if (!play->audio_sink)
- g_warning ("You need the osssink element to use this program.");
-
- g_object_set (
- G_OBJECT (play->audio_sink),
- "fragment", 0x00180008, NULL);
+ /* creating fake audiosink */
+ play->audio_sink = gst_element_factory_make ("fakesink", "fake_audio");
+ if (play->audio_sink == NULL)
+ {
+ gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
+ return FALSE;
+ }
g_signal_connect (
G_OBJECT (play->audio_sink), "eos",
@@ -188,14 +249,11 @@ gst_play_audioht_setup (GstPlay *play, GError **error)
return FALSE;
}
- /* create audiosink.
- FIXME : Should use gconf to choose the right one */
- play->audio_sink = gst_element_factory_make ("osssink", "play_audio");
+ /* create audiosink. */
+ play->audio_sink = gst_element_factory_make ("fakesink", "play_audio");
if (!play->audio_sink)
- g_warning ("You need the osssink element to use this program.\n");
+ g_warning ("You need the fakesink element to use this program.\n");
- g_object_set (G_OBJECT (play->audio_sink), "fragment", 0x00180008, NULL);
-
g_signal_connect (G_OBJECT (play->audio_sink), "eos",
G_CALLBACK (callback_audio_sink_eos), play);