uri-source: when creating the audio element, set the volume to the layr volume when necessary.

This commit is contained in:
Mathieu Duponchelle 2013-05-16 04:22:16 +02:00 committed by Thibault Saunier
parent 86b893e54c
commit 800325db02
2 changed files with 17 additions and 0 deletions

View file

@ -133,12 +133,16 @@ ges_uri_source_create_element (GESTrackElement * trksrc)
GstElement *topbin, *volume;
GstPad *volume_srcpad, *volume_sinkpad;
GstPad *ghost;
GESLayer *layer;
gfloat layer_volume;
self = (GESUriSource *) trksrc;
track = ges_track_element_get_track (trksrc);
switch (track->type) {
case GES_TRACK_TYPE_AUDIO:
GST_DEBUG_OBJECT (trksrc, "Creating a bin uridecodebin ! volume");
topbin = gst_bin_new ("audio-src-bin");
volume = gst_element_factory_make ("volume", NULL);
@ -155,6 +159,18 @@ ges_uri_source_create_element (GESTrackElement * trksrc)
gst_element_no_more_pads (decodebin);
gst_bin_add (GST_BIN (topbin), decodebin);
layer =
ges_clip_get_layer (GES_CLIP (ges_timeline_element_get_parent
(GES_TIMELINE_ELEMENT (trksrc))));
if (layer != NULL) {
ges_meta_container_get_float (GES_META_CONTAINER (layer),
GES_META_VOLUME, &layer_volume);
g_object_set (volume, "volume", layer_volume, NULL);
GST_DEBUG_OBJECT (trksrc, "Setting the volume to %f", layer_volume);
} else
GST_DEBUG_OBJECT (trksrc, "NOT setting the volume");
ret = topbin;
break;
default:

View file

@ -24,6 +24,7 @@
#include <glib-object.h>
#include <ges/ges-types.h>
#include <ges/ges-source.h>
#include <ges/ges-meta-container.h>
G_BEGIN_DECLS