Removed the volume element from the pipeline. Its only purpose was to limit the volume to 80% (which was hardcoded). This limiting should not be required; in fact it reduced the dynamic range and should therefore be avoided.

This commit is contained in:
mark 2006-10-26 15:31:11 +00:00
parent 62c3f1ac29
commit 21ab9f2930
2 changed files with 9 additions and 22 deletions

View File

@ -242,6 +242,9 @@ GstreamerPlayer :: open(const std::string fileUrl)
throw (std::invalid_argument,
std::runtime_error)
{
// GStreamer pipeline overview:
// filesrc -> decoder -> audioconvert -> audioscale -> audiosink
DEBUG_BLOCK
std::string filePath;
@ -302,23 +305,17 @@ GstreamerPlayer :: open(const std::string fileUrl)
// converts between different audio formats (e.g. bitrate)
audioconvert = gst_element_factory_make("audioconvert", NULL);
// reduce the volume to 80%
volume = gst_element_factory_make("volume", NULL);
gst_element_set(volume, "volume", gdouble(0.8), NULL);
// scale the sampling rate, if necessary
audioscale = gst_element_factory_make("audioscale", NULL);
gst_element_link_many(decoder,
audioconvert,
volume,
audioscale,
audiosink,
NULL);
gst_bin_add_many(GST_BIN(pipeline), filesrc,
decoder,
audioconvert,
volume,
audioscale,
audiosink,
NULL);
@ -470,28 +467,24 @@ GstreamerPlayer :: close(void) throw (std::logic_error)
gst_element_set_state(pipeline, GST_STATE_NULL);
// Unlink elements:
if (filesrc && decoder) {
gst_element_unlink(filesrc, decoder);
}
if (decoder && audioconvert) {
gst_element_unlink(decoder, audioconvert);
}
if (audioconvert && volume) {
gst_element_unlink(audioconvert, volume);
}
if (volume && audioscale) {
gst_element_unlink(volume, audioscale);
if (audioconvert && audioscale ) {
gst_element_unlink(audioconvert, audioscale);
}
if (audioscale && audiosink) {
gst_element_unlink(audioscale, audiosink);
}
// Remove elements from pipeline:
if (audioscale) {
gst_bin_remove(GST_BIN(pipeline), audioscale);
}
if (volume) {
gst_bin_remove(GST_BIN(pipeline), volume);
}
if (audioconvert) {
gst_bin_remove(GST_BIN(pipeline), audioconvert);
}
@ -505,7 +498,6 @@ GstreamerPlayer :: close(void) throw (std::logic_error)
filesrc = 0;
decoder = 0;
audioconvert = 0;
volume = 0;
audioscale = 0;
}

View File

@ -117,11 +117,6 @@ class GstreamerPlayer : virtual public Configurable,
*/
GstElement * audioconvert;
/**
* The volume element.
*/
GstElement * volume;
/**
* The audioscale element.
*/
@ -401,7 +396,7 @@ class GstreamerPlayer : virtual public Configurable,
getPosition(void) throw (std::logic_error);
/**
* Get the volume of the player.
* Get the volume of the player. *Unimplemented*
*
* @return the volume, from 1 to 100.
*/
@ -409,7 +404,7 @@ class GstreamerPlayer : virtual public Configurable,
getVolume(void) throw ();
/**
* Set the volume of the player.
* Set the volume of the player. *Unimplemented*
*
* @param volume the new volume, from 1 to 100.
*/