void MediaPlayerPrivateGStreamerBase::setVolume(float volume)
{
    if (!m_volumeElement)
        return;

    gst_stream_volume_set_volume(m_volumeElement.get(), GST_STREAM_VOLUME_FORMAT_CUBIC, static_cast<double>(volume));
}
static void
set_playbin_volume (RBPlayerGst *player, float volume)
{
	/* ignore the deep-notify we get directly from the sink, as it causes deadlock.
	 * we still get another one anyway.
	 */
	g_signal_handlers_block_by_func (player->priv->playbin, volume_notify_cb, player);
	if (gst_element_implements_interface (player->priv->playbin, GST_TYPE_STREAM_VOLUME))
		gst_stream_volume_set_volume (GST_STREAM_VOLUME (player->priv->playbin),
					      GST_STREAM_VOLUME_FORMAT_CUBIC, volume);
	else
		g_object_set (player->priv->playbin, "volume", volume, NULL);
	g_signal_handlers_unblock_by_func (player->priv->playbin, volume_notify_cb, player);
}
Exemplo n.º 3
0
static void
play_set_relative_volume (GstPlay * play, gdouble volume_step)
{
  gdouble volume;

  volume = gst_stream_volume_get_volume (GST_STREAM_VOLUME (play->playbin),
      GST_STREAM_VOLUME_FORMAT_CUBIC);

  volume = round ((volume + volume_step) * VOLUME_STEPS) / VOLUME_STEPS;
  volume = CLAMP (volume, 0.0, 10.0);

  gst_stream_volume_set_volume (GST_STREAM_VOLUME (play->playbin),
      GST_STREAM_VOLUME_FORMAT_CUBIC, volume);

  g_print ("Volume: %.0f%%                  \n", volume * 100);
}
Exemplo n.º 4
0
void
xmr_player_set_volume(XmrPlayer *player,
			float		 volume)
{
	g_return_if_fail( player != NULL);
	g_return_if_fail (volume >= 0.0 && volume <= 1.0);

	if (player->priv->playbin == NULL)
		return ;

	g_signal_handlers_block_by_func(player->priv->playbin, volume_notify_cb, player);

	if (gst_element_implements_interface(player->priv->playbin, GST_TYPE_STREAM_VOLUME))
		gst_stream_volume_set_volume(GST_STREAM_VOLUME(player->priv->playbin),
					      GST_STREAM_VOLUME_FORMAT_CUBIC, volume);
	else
		g_object_set(player->priv->playbin, "volume", volume, NULL);

	g_signal_handlers_unblock_by_func(player->priv->playbin, volume_notify_cb, player);

	player->priv->cur_volume = volume;
}
Exemplo n.º 5
0
void StreamVolume::setVolume(double value, StreamVolumeFormat format)
{
    gst_stream_volume_set_volume(object<GstStreamVolume>(),
                                 static_cast<GstStreamVolumeFormat>(format), value);
}