mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
adding audio
Original commit message from CVS: adding audio
This commit is contained in:
parent
8d8e94d922
commit
f9c18acc15
2 changed files with 82 additions and 16 deletions
|
@ -322,6 +322,14 @@ gst_play_new (GstPlayPipeType pipe_type, GError **error)
|
||||||
play->set_video_sink = gst_play_videots_set_video;
|
play->set_video_sink = gst_play_videots_set_video;
|
||||||
play->set_audio_sink = gst_play_videots_set_audio;
|
play->set_audio_sink = gst_play_videots_set_audio;
|
||||||
break;
|
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:
|
case GST_PLAY_PIPE_AUDIO_THREADED:
|
||||||
play->setup_pipeline = gst_play_audiot_setup;
|
play->setup_pipeline = gst_play_audiot_setup;
|
||||||
play->teardown_pipeline = NULL;
|
play->teardown_pipeline = NULL;
|
||||||
|
|
|
@ -21,6 +21,69 @@
|
||||||
* Boston, MA 02111-1307, USA.
|
* 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
|
* GST_PLAY_PIPE_AUDIO_THREADED
|
||||||
* { gnomevfssrc ! spider ! volume ! osssink }
|
* { gnomevfssrc ! spider ! volume ! osssink }
|
||||||
|
@ -55,15 +118,13 @@ gst_play_audiot_setup (GstPlay *play, GError **error)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create audiosink.
|
/* creating fake audiosink */
|
||||||
FIXME : Should use gconf to choose the right one */
|
play->audio_sink = gst_element_factory_make ("fakesink", "fake_audio");
|
||||||
play->audio_sink = gst_element_factory_make ("osssink", "play_audio");
|
if (play->audio_sink == NULL)
|
||||||
if (!play->audio_sink)
|
{
|
||||||
g_warning ("You need the osssink element to use this program.");
|
gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
|
||||||
|
return FALSE;
|
||||||
g_object_set (
|
}
|
||||||
G_OBJECT (play->audio_sink),
|
|
||||||
"fragment", 0x00180008, NULL);
|
|
||||||
|
|
||||||
g_signal_connect (
|
g_signal_connect (
|
||||||
G_OBJECT (play->audio_sink), "eos",
|
G_OBJECT (play->audio_sink), "eos",
|
||||||
|
@ -188,13 +249,10 @@ gst_play_audioht_setup (GstPlay *play, GError **error)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create audiosink.
|
/* create audiosink. */
|
||||||
FIXME : Should use gconf to choose the right one */
|
play->audio_sink = gst_element_factory_make ("fakesink", "play_audio");
|
||||||
play->audio_sink = gst_element_factory_make ("osssink", "play_audio");
|
|
||||||
if (!play->audio_sink)
|
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_signal_connect (G_OBJECT (play->audio_sink), "eos",
|
||||||
G_CALLBACK (callback_audio_sink_eos), play);
|
G_CALLBACK (callback_audio_sink_eos), play);
|
||||||
|
|
Loading…
Reference in a new issue