summaryrefslogtreecommitdiffstats
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorJulien Moutte <julien@moutte.net>2003-04-13 20:02:34 +0000
committerJulien Moutte <julien@moutte.net>2003-04-13 20:02:34 +0000
commit0b13c0f9ce54ce7b1c3f340d4fb3cde59c85214e (patch)
tree1d68113a6eb85a445a63efbcb3a4418348df1efa /gst-libs/gst
parent058e00e3cb99f11ce8f9f5d1a985e8fa765834df (diff)
downloadgst-plugins-bad-0b13c0f9ce54ce7b1c3f340d4fb3cde59c85214e.tar.gz
gst-plugins-bad-0b13c0f9ce54ce7b1c3f340d4fb3cde59c85214e.tar.bz2
gst-plugins-bad-0b13c0f9ce54ce7b1c3f340d4fb3cde59c85214e.zip
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...
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/play/play.old.c6
-rw-r--r--gst-libs/gst/play/playpipelines.c141
2 files changed, 67 insertions, 80 deletions
diff --git a/gst-libs/gst/play/play.old.c b/gst-libs/gst/play/play.old.c
index dd322896..895c530f 100644
--- a/gst-libs/gst/play/play.old.c
+++ b/gst-libs/gst/play/play.old.c
@@ -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);
diff --git a/gst-libs/gst/play/playpipelines.c b/gst-libs/gst/play/playpipelines.c
index dc977bcf..a357fd56 100644
--- a/gst-libs/gst/play/playpipelines.c
+++ b/gst-libs/gst/play/playpipelines.c
@@ -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);
@@ -757,7 +758,17 @@ gst_play_video_vis_setup ( GstPlay *play,
g_hash_table_insert( play->other_elements,
"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)
{
@@ -782,72 +793,47 @@ gst_play_video_vis_setup ( GstPlay *play,
g_hash_table_insert( play->other_elements,
"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,18 +882,7 @@ 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,
gst_element_get_pad (vis_video_queue, "sink"),
@@ -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,