make Company happy : Changed visualisation pipeline structure.. audio sink is directly connected to tee so no queue b...

Original commit message from CVS:
make Company happy : Changed visualisation pipeline structure.. audio sink is directly connected to tee so no queue between volume and audio sink...
This commit is contained in:
Julien Moutte 2003-04-13 20:02:34 +00:00
parent 8e15349b51
commit 4a74c4dcb6
2 changed files with 67 additions and 80 deletions

View file

@ -214,12 +214,14 @@ gst_play_get_length_callback (GstPlay *play)
gboolean query_worked = FALSE;
g_print("trying to get length\n");
if (play->audio_sink_element != NULL){
if ( (play->audio_sink_element != NULL) &&
(GST_IS_ELEMENT (play->audio_sink_element)) ) {
g_mutex_lock(play->audio_bin_mutex);
query_worked = gst_element_query (play->audio_sink_element, GST_QUERY_TOTAL, &format, &value);
g_mutex_unlock(play->audio_bin_mutex);
}
else if (play->video_sink_element != NULL){
else if ( (play->video_sink_element != NULL) &&
(GST_IS_ELEMENT (play->video_sink_element)) ) {
g_mutex_lock(play->video_bin_mutex);
query_worked = gst_element_query (play->video_sink_element, GST_QUERY_TOTAL, &format, &value);
g_mutex_unlock(play->video_bin_mutex);

View file

@ -715,10 +715,11 @@ gst_play_video_vis_setup ( GstPlay *play,
{
GstElement *work_thread, *tee_element;
GstPad *tee_vis_pad, *tee_audio_pad, *vis_video_thread_pad;
GstElement *vis_audio_thread, *vis_video_thread;
GstElement *vis_audio_queue, *vis_video_queue;
GstElement *vis_colorspace, *vis_audio_sink, *vis_video_sink;
GstPad *tee_vis_pad, *tee_audio_pad;
GstPad *audio_sink_pad, *vis_video_thread_pad;
GstElement *vis_video_thread;
GstElement *audio_queue, *audio_sink;
GstElement *vis_colorspace, *vis_video_queue, *vis_video_sink;
GstElement *video_queue, *video_bin, *colorspace;
g_return_val_if_fail (play != NULL, FALSE);
@ -748,7 +749,7 @@ gst_play_video_vis_setup ( GstPlay *play,
/* Creating here the audio vis bin */
play->audio_sink = gst_element_factory_make ( "bin", "audio_bin");
play->audio_sink = gst_thread_new ("audio_thread");
if (!play->audio_sink)
{
gst_play_error_plugin (GST_PLAY_ERROR_THREAD, error);
@ -758,6 +759,16 @@ gst_play_video_vis_setup ( GstPlay *play,
"audio_bin",
play->audio_sink);
audio_queue = gst_element_factory_make ("queue", "audio_queue");
if (!audio_queue)
{
gst_play_error_plugin (GST_PLAY_ERROR_QUEUE, error);
return FALSE;
}
g_hash_table_insert ( play->other_elements,
"audio_queue",
audio_queue);
play->volume = gst_element_factory_make ("volume", "audio_volume");
if (!play->volume)
{
@ -783,71 +794,46 @@ gst_play_video_vis_setup ( GstPlay *play,
"tee_audio_pad",
tee_audio_pad);
gst_bin_add_many ( GST_BIN (play->audio_sink),
play->volume, tee_element, NULL);
gst_element_link_many (play->volume, tee_element, NULL);
gst_element_add_ghost_pad ( play->audio_sink,
gst_element_get_pad (play->volume, "sink"),
"sink");
/* Creating audio part of the visualisation bin
{ queue ! volume ! (audiosink) }
*/
vis_audio_thread = gst_thread_new ("vis_audio_thread");
if (!vis_audio_thread)
{
gst_play_error_plugin (GST_PLAY_ERROR_THREAD, error);
return FALSE;
}
g_hash_table_insert( play->other_elements,
"vis_audio_thread",
vis_audio_thread);
vis_audio_queue = gst_element_factory_make ("queue", "vis_audio_queue");
if (!vis_audio_queue)
{
gst_play_error_plugin (GST_PLAY_ERROR_QUEUE, error);
return FALSE;
}
g_hash_table_insert ( play->other_elements,
"vis_audio_queue",
vis_audio_queue);
vis_audio_sink = gst_element_factory_make ("fakesink", "vis_audio_sink");
if (!vis_audio_sink)
audio_sink = gst_element_factory_make ("fakesink", "audio_sink");
if (!audio_sink)
{
gst_play_error_plugin (GST_PLAY_ERROR_FAKESINK, error);
return FALSE;
}
g_hash_table_insert ( play->other_elements,
"vis_audio_sink",
vis_audio_sink);
"audio_sink",
audio_sink);
audio_sink_pad = gst_element_get_pad (audio_sink, "sink");
g_hash_table_insert ( play->other_elements,
"audio_sink_pad",
audio_sink_pad);
play->audio_sink_element = NULL;
gst_bin_add_many ( GST_BIN (vis_audio_thread), vis_audio_queue,
vis_audio_sink, NULL);
gst_element_link_many ( vis_audio_queue, vis_audio_sink, NULL);
gst_bin_add_many ( GST_BIN (play->audio_sink),
audio_queue, play->volume,
tee_element, audio_sink, NULL);
gst_element_link_many ( audio_queue, play->volume,
tee_element, NULL);
gst_pad_link ( tee_audio_pad, audio_sink_pad);
gst_element_add_ghost_pad ( play->audio_sink,
gst_element_get_pad (audio_queue, "sink"),
"sink");
/* setting up iterate functions */
gst_bin_set_pre_iterate_function (
GST_BIN (vis_audio_thread),
GST_BIN (play->audio_sink),
(GstBinPrePostIterateFunction) callback_bin_pre_iterate,
play->audio_bin_mutex);
gst_bin_set_post_iterate_function (
GST_BIN (vis_audio_thread),
GST_BIN (play->audio_sink),
(GstBinPrePostIterateFunction) callback_bin_post_iterate,
play->audio_bin_mutex);
gst_bin_add ( GST_BIN(play->audio_sink), vis_audio_thread);
gst_pad_link ( tee_audio_pad,
gst_element_add_ghost_pad (
vis_audio_thread,
gst_element_get_pad (vis_audio_queue, "sink"),
"sink"));
/* Creating video part of the visualisation bin
{ queue ! (visualisation) ! colorspace ! (videosink) }
*/
@ -896,17 +882,6 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_bin_add_many ( GST_BIN (vis_video_thread), vis_video_queue,
vis_colorspace, vis_video_sink, NULL);
/* Not linking now as we miss too much stuff */
/* setting up iterate functions
gst_bin_set_pre_iterate_function (
GST_BIN (vis_video_thread),
(GstBinPrePostIterateFunction) callback_bin_pre_iterate,
play->video_bin_mutex);
gst_bin_set_post_iterate_function (
GST_BIN (vis_video_thread),
(GstBinPrePostIterateFunction) callback_bin_post_iterate,
play->video_bin_mutex);*/
vis_video_thread_pad = gst_element_add_ghost_pad (
vis_video_thread,
@ -963,7 +938,7 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_element_link_many (video_queue, colorspace,
play->video_sink, NULL);
/* setting up iterate functions
/* setting up iterate functions */
gst_bin_set_pre_iterate_function (
GST_BIN (video_bin),
(GstBinPrePostIterateFunction) callback_bin_pre_iterate,
@ -971,7 +946,7 @@ gst_play_video_vis_setup ( GstPlay *play,
gst_bin_set_post_iterate_function (
GST_BIN (video_bin),
(GstBinPrePostIterateFunction) callback_bin_post_iterate,
play->video_bin_mutex);*/
play->video_bin_mutex);
gst_element_add_ghost_pad (
video_bin, gst_element_get_pad (video_queue, "sink"),
@ -986,7 +961,8 @@ static gboolean
gst_play_video_vis_set_audio ( GstPlay *play,
GstElement *audio_sink)
{
GstElement *audio_bin, *vis_audio_sink, *vis_audio_queue;
GstElement *audio_bin, *vis_audio_sink;
GstPad *audio_sink_pad, *tee_audio_pad;
g_return_val_if_fail (play != NULL, FALSE);
g_return_val_if_fail (audio_sink != NULL, FALSE);
@ -994,25 +970,34 @@ gst_play_video_vis_set_audio ( GstPlay *play,
g_return_val_if_fail (GST_IS_ELEMENT (audio_sink), FALSE);
audio_bin = g_hash_table_lookup ( play->other_elements,
"vis_audio_thread");
"audio_bin");
vis_audio_sink = g_hash_table_lookup ( play->other_elements,
"vis_audio_sink");
vis_audio_queue = g_hash_table_lookup ( play->other_elements,
"vis_audio_queue");
"audio_sink");
audio_sink_pad = g_hash_table_lookup ( play->other_elements,
"audio_sink_pad");
tee_audio_pad = g_hash_table_lookup ( play->other_elements,
"tee_audio_pad");
if (vis_audio_sink)
if ( (vis_audio_sink) && GST_IS_ELEMENT(vis_audio_sink) )
{
gst_element_unlink (vis_audio_queue, vis_audio_sink);
gst_pad_unlink (tee_audio_pad, audio_sink_pad);
gst_bin_remove (GST_BIN (audio_bin), vis_audio_sink);
}
gst_bin_add (GST_BIN (audio_bin), audio_sink);
gst_element_link (vis_audio_queue, audio_sink);
audio_sink_pad = gst_element_get_pad (audio_sink,"sink");
gst_pad_link (tee_audio_pad, audio_sink_pad);
g_hash_table_replace( play->other_elements,
"vis_audio_sink",
"audio_sink",
audio_sink);
g_hash_table_replace( play->other_elements,
"audio_sink_pad",
audio_sink_pad);
play->audio_sink_element = gst_play_get_sink_element (
play,
audio_sink,