mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 17:20:36 +00:00
gst-libs/gst/play/play.c: Moving volume in the audio thread for instantaneous volume change. Maybe i will add another...
Original commit message from CVS: 2004-02-02 Julien MOUTTE <julien@moutte.net> * gst-libs/gst/play/play.c: (gst_play_pipeline_setup), (gst_play_set_audio_sink): Moving volume in the audio thread for instantaneous volume change. Maybe i will add another volume in front of visualization later, not sure yet though.
This commit is contained in:
parent
c92e91c821
commit
7fdd21cd9d
2 changed files with 21 additions and 16 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2004-02-02 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
|
* gst-libs/gst/play/play.c: (gst_play_pipeline_setup),
|
||||||
|
(gst_play_set_audio_sink): Moving volume in the audio thread for
|
||||||
|
instantaneous volume change. Maybe i will add another volume in front
|
||||||
|
of visualization later, not sure yet though.
|
||||||
|
|
||||||
2004-02-02 Julien MOUTTE <julien@moutte.net>
|
2004-02-02 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
|
* sys/ximage/ximagesink.c: (gst_ximagesink_renegotiate_size),
|
||||||
|
|
|
@ -160,12 +160,7 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
||||||
|
|
||||||
/* Make sure we convert audio to the needed format */
|
/* Make sure we convert audio to the needed format */
|
||||||
GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert", error);
|
GST_PLAY_MAKE_OR_ERROR (audioconvert, "audioconvert", "audioconvert", error);
|
||||||
/* FIXME: why are volume and audioconvert switched around for the insert ) */
|
g_hash_table_insert (play->priv->elements, "audioconvert", audioconvert);
|
||||||
g_hash_table_insert (play->priv->elements, "volume", audioconvert);
|
|
||||||
|
|
||||||
/* Volume control */
|
|
||||||
GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
|
|
||||||
g_hash_table_insert (play->priv->elements, "audioconvert", volume);
|
|
||||||
|
|
||||||
/* Duplicate audio signal to audio sink and visualization thread */
|
/* Duplicate audio signal to audio sink and visualization thread */
|
||||||
GST_PLAY_MAKE_OR_ERROR (tee, "tee", "tee", error);
|
GST_PLAY_MAKE_OR_ERROR (tee, "tee", "tee", error);
|
||||||
|
@ -175,9 +170,8 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
||||||
g_hash_table_insert (play->priv->elements, "tee_pad2", tee_pad2);
|
g_hash_table_insert (play->priv->elements, "tee_pad2", tee_pad2);
|
||||||
g_hash_table_insert (play->priv->elements, "tee", tee);
|
g_hash_table_insert (play->priv->elements, "tee", tee);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (work_thread), source, autoplugger,/* audioconvert,*/
|
gst_bin_add_many (GST_BIN (work_thread), source, autoplugger, audioconvert, tee, NULL);
|
||||||
volume, tee, NULL);
|
if (!gst_element_link_many (source, autoplugger, audioconvert, tee, NULL))
|
||||||
if (!gst_element_link_many (source, autoplugger,/* audioconvert,*/ volume, tee, NULL))
|
|
||||||
GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
|
GST_PLAY_ERROR_RETURN (error, "Could not link source thread elements");
|
||||||
|
|
||||||
/* identity ! colorspace ! switch */
|
/* identity ! colorspace ! switch */
|
||||||
|
@ -309,12 +303,16 @@ gst_play_pipeline_setup (GstPlay *play, GError **error)
|
||||||
GST_PLAY_MAKE_OR_ERROR (audio_queue, "queue", "audio_queue", error);
|
GST_PLAY_MAKE_OR_ERROR (audio_queue, "queue", "audio_queue", error);
|
||||||
g_hash_table_insert (play->priv->elements, "audio_queue", audio_queue);
|
g_hash_table_insert (play->priv->elements, "audio_queue", audio_queue);
|
||||||
|
|
||||||
|
/* Volume control */
|
||||||
|
GST_PLAY_MAKE_OR_ERROR (volume, "volume", "volume", error);
|
||||||
|
g_hash_table_insert (play->priv->elements, "volume", volume);
|
||||||
|
|
||||||
/* Placeholder for future audio sink bin */
|
/* Placeholder for future audio sink bin */
|
||||||
GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
|
GST_PLAY_MAKE_OR_ERROR (audio_sink, "fakesink", "audio_sink", error);
|
||||||
g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
|
g_hash_table_insert (play->priv->elements, "audio_sink", audio_sink);
|
||||||
|
|
||||||
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, audio_sink, NULL);
|
gst_bin_add_many (GST_BIN (audio_thread), audio_queue, volume, audio_sink, NULL);
|
||||||
if (!gst_element_link (audio_queue, audio_sink))
|
if (!gst_element_link_many (audio_queue, volume, audio_sink, NULL))
|
||||||
GST_PLAY_ERROR_RETURN (error, "Could not link audio output thread elements");
|
GST_PLAY_ERROR_RETURN (error, "Could not link audio output thread elements");
|
||||||
gst_element_add_ghost_pad (audio_thread,
|
gst_element_add_ghost_pad (audio_thread,
|
||||||
gst_element_get_pad (audio_queue, "sink"),
|
gst_element_get_pad (audio_queue, "sink"),
|
||||||
|
@ -829,7 +827,7 @@ gst_play_set_video_sink (GstPlay *play, GstElement *video_sink)
|
||||||
gboolean
|
gboolean
|
||||||
gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
{
|
{
|
||||||
GstElement *old_audio_sink, *audio_thread, *audio_queue, *audio_sink_element;
|
GstElement *old_audio_sink, *audio_thread, *volume, *audio_sink_element;
|
||||||
|
|
||||||
g_return_val_if_fail (play != NULL, FALSE);
|
g_return_val_if_fail (play != NULL, FALSE);
|
||||||
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
g_return_val_if_fail (GST_IS_PLAY (play), FALSE);
|
||||||
|
@ -847,16 +845,16 @@ gst_play_set_audio_sink (GstPlay *play, GstElement *audio_sink)
|
||||||
audio_thread = g_hash_table_lookup (play->priv->elements, "audio_thread");
|
audio_thread = g_hash_table_lookup (play->priv->elements, "audio_thread");
|
||||||
if (!GST_IS_ELEMENT (audio_thread))
|
if (!GST_IS_ELEMENT (audio_thread))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
audio_queue = g_hash_table_lookup (play->priv->elements, "audio_queue");
|
volume = g_hash_table_lookup (play->priv->elements, "volume");
|
||||||
if (!GST_IS_ELEMENT (audio_queue))
|
if (!GST_IS_ELEMENT (volume))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Unlinking old audiosink, removing it from pipeline, putting the new one
|
/* Unlinking old audiosink, removing it from pipeline, putting the new one
|
||||||
and linking it */
|
and linking it */
|
||||||
gst_element_unlink (audio_queue, old_audio_sink);
|
gst_element_unlink (volume, old_audio_sink);
|
||||||
gst_bin_remove (GST_BIN (audio_thread), old_audio_sink);
|
gst_bin_remove (GST_BIN (audio_thread), old_audio_sink);
|
||||||
gst_bin_add (GST_BIN (audio_thread), audio_sink);
|
gst_bin_add (GST_BIN (audio_thread), audio_sink);
|
||||||
gst_element_link (audio_queue, audio_sink);
|
gst_element_link (volume, audio_sink);
|
||||||
|
|
||||||
g_hash_table_replace (play->priv->elements, "audio_sink", audio_sink);
|
g_hash_table_replace (play->priv->elements, "audio_sink", audio_sink);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue