~timo-jyrinki/ubuntu/utopic/rhythmbox/enable_grilo_rhythmbox

« back to all changes in this revision

Viewing changes to backends/gstreamer/rb-player-gst-xfade.c

Tags: upstream-0.11.99.1
ImportĀ upstreamĀ versionĀ 0.11.99.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
#include "rb-marshal.h"
170
170
#include "rb-player-gst-tee.h"
171
171
#include "rb-player-gst-filter.h"
 
172
#include "rb-player-gst-helper.h"
172
173
 
173
174
static void rb_player_init (RBPlayerIface *iface);
174
175
static void rb_player_gst_tee_init (RBPlayerGstTeeIface *iface);
357
358
        GstElement *sink;
358
359
        GstElement *tee;
359
360
        GstElement *filterbin;
 
361
        GstElement *volume_handler;
360
362
        enum {
361
363
                SINK_NULL,
362
364
                SINK_STOPPED,
742
744
        player->priv->streams = NULL;
743
745
        g_static_rec_mutex_unlock (&player->priv->stream_list_lock);
744
746
 
 
747
        if (player->priv->volume_handler) {
 
748
                g_object_unref (player->priv->volume_handler);
 
749
                player->priv->volume_handler = NULL;
 
750
        }
 
751
 
745
752
        g_static_rec_mutex_lock (&player->priv->sink_lock);
746
753
        stop_sink (player);
747
754
        g_static_rec_mutex_unlock (&player->priv->sink_lock);
866
873
        gint64 output_pos = -1;
867
874
        gint64 stream_pos = -1;
868
875
 
 
876
        g_mutex_lock (stream->lock);
 
877
 
869
878
        if (stream->adder_pad == NULL) {
870
879
                rb_debug ("stream isn't linked, can't adjust base time");
 
880
                g_mutex_unlock (stream->lock);
871
881
                return;
872
882
        }
873
883
 
904
914
                                                          stream);
905
915
                }
906
916
        }
 
917
                
 
918
        g_mutex_unlock (stream->lock);
907
919
}
908
920
 
909
921
/* called on a streaming thread when the volume level for a stream changes. */
2823
2835
                        gst_message_unref (message);
2824
2836
                }
2825
2837
                gst_object_unref (bus);
 
2838
        
 
2839
                /* if the sink provides a 'volume' property, use that to control output volume */
 
2840
                player->priv->volume_handler = rb_player_gst_find_element_with_property (player->priv->sink, "volume");
 
2841
                if (player->priv->volume_handler == NULL) {
 
2842
                        rb_debug ("sink doesn't provide volume control, using volume element");
 
2843
                        player->priv->volume_handler = g_object_ref (player->priv->volume);
 
2844
                }
 
2845
 
 
2846
                g_object_set (player->priv->volume_handler, "volume", player->priv->cur_volume, NULL);
 
2847
 
2826
2848
 
2827
2849
                sr = gst_element_set_state (player->priv->silencebin, GST_STATE_PLAYING);
2828
2850
                if (sr == GST_STATE_CHANGE_FAILURE) {
2927
2949
                        rb_debug ("couldn't set audio sink to NULL state");
2928
2950
                }
2929
2951
 
 
2952
                if (player->priv->volume_handler) {
 
2953
                        g_object_unref (player->priv->volume_handler);
 
2954
                        player->priv->volume_handler = NULL;
 
2955
                }
 
2956
 
2930
2957
                player->priv->sink_state = SINK_STOPPED;
2931
2958
                break;
2932
2959
 
3007
3034
                return FALSE;
3008
3035
        }
3009
3036
 
3010
 
        g_object_set (player->priv->volume, "volume", player->priv->cur_volume, NULL);
3011
 
 
3012
 
        player->priv->sink = gst_element_factory_make ("gconfaudiosink", NULL);
 
3037
        player->priv->sink = rb_player_gst_try_audio_sink ("gconfaudiosink", NULL);
3013
3038
        if (player->priv->sink == NULL) {
3014
 
                player->priv->sink = gst_element_factory_make ("autoaudiosink", NULL);
 
3039
                player->priv->sink = rb_player_gst_try_audio_sink ("autoaudiosink", NULL);
3015
3040
                if (player->priv->sink == NULL) {
3016
3041
                        g_set_error (error,
3017
3042
                                     RB_PLAYER_ERROR,
3019
3044
                                     _("Failed to create audio output element; check your installation"));
3020
3045
                        return FALSE;
3021
3046
                }
3022
 
        } else {
3023
 
                /* set the profile property on the gconfaudiosink to "music and movies" */
3024
 
                if (g_object_class_find_property (G_OBJECT_GET_CLASS (player->priv->sink), "profile"))
3025
 
                        g_object_set (player->priv->sink, "profile", 1, NULL);
3026
3047
        }
3027
3048
 
3028
3049
        g_object_set (player->priv->capsfilter, "caps", caps, NULL);
3666
3687
{
3667
3688
        RBPlayerGstXFade *player = RB_PLAYER_GST_XFADE (iplayer);
3668
3689
 
3669
 
        if (player->priv->volume != NULL) {
 
3690
        if (player->priv->volume_handler != NULL) {
3670
3691
                gdouble v = (gdouble)volume;
3671
3692
 
3672
3693
                /* maybe use a controller here for smoother changes? */
3673
 
                g_object_set (player->priv->volume, "volume", v, NULL);
 
3694
                g_object_set (player->priv->volume_handler, "volume", v, NULL);
3674
3695
        }
3675
3696
        player->priv->cur_volume = volume;
3676
3697
}