~ubuntu-branches/ubuntu/saucy/phonon-backend-gstreamer/saucy-proposed

« back to all changes in this revision

Viewing changes to gstreamer/gsthelper.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2011-04-15 14:43:30 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110415144330-7uif3319lxdu4ltt
Tags: 4:4.7.0really4.5.0-0ubuntu2
* New upstream release
* Add kubuntu_02_install_codec.diff to fix codec install

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
#include <gst/interfaces/propertyprobe.h>
19
19
#include <gst/gst.h>
20
 
#include "common.h"
21
20
#include "gsthelper.h"
22
21
 
23
22
#include <QtCore/QList>
109
108
    return retVal;
110
109
}
111
110
 
112
 
 
113
 
/***
114
 
 * Creates an instance of a playbin with "audio-src" and
115
 
 * "video-src" ghost pads to allow redirected output streams.
116
 
 *
117
 
 * ### This function is probably not required now that MediaObject is based
118
 
 *     on decodebin directly.
119
 
 */
120
 
GstElement* GstHelper::createPluggablePlaybin()
121
 
{
122
 
    GstElement *playbin = 0;
123
 
    //init playbin and add to our pipeline
124
 
    playbin = gst_element_factory_make("playbin2", NULL);
125
 
 
126
 
    //Create an identity element to redirect sound
127
 
    GstElement *audioSinkBin =  gst_bin_new (NULL);
128
 
    GstElement *audioPipe = gst_element_factory_make("identity", NULL);
129
 
    gst_bin_add(GST_BIN(audioSinkBin), audioPipe);
130
 
 
131
 
    //Create a sinkpad on the identity
132
 
    GstPad *audiopad = gst_element_get_pad (audioPipe, "sink");
133
 
    gst_element_add_pad (audioSinkBin, gst_ghost_pad_new ("sink", audiopad));
134
 
    gst_object_unref (audiopad);
135
 
 
136
 
    //Create an "audio_src" source pad on the playbin
137
 
    GstPad *audioPlaypad = gst_element_get_pad (audioPipe, "src");
138
 
    gst_element_add_pad (playbin, gst_ghost_pad_new ("audio_src", audioPlaypad));
139
 
    gst_object_unref (audioPlaypad);
140
 
 
141
 
    //Done with our audio redirection
142
 
    g_object_set (G_OBJECT(playbin), "audio-sink", audioSinkBin, (const char*)NULL);
143
 
 
144
 
    // * * Redirect video to "video_src" pad : * *
145
 
 
146
 
    //Create an identity element to redirect sound
147
 
    GstElement *videoSinkBin =  gst_bin_new (NULL);
148
 
    GstElement *videoPipe = gst_element_factory_make("identity", NULL);
149
 
    gst_bin_add(GST_BIN(videoSinkBin), videoPipe);
150
 
 
151
 
    //Create a sinkpad on the identity
152
 
    GstPad *videopad = gst_element_get_pad (videoPipe, "sink");
153
 
    gst_element_add_pad (videoSinkBin, gst_ghost_pad_new ("sink", videopad));
154
 
    gst_object_unref (videopad);
155
 
 
156
 
    //Create an "audio_src" source pad on the playbin
157
 
    GstPad *videoPlaypad = gst_element_get_pad (videoPipe, "src");
158
 
    gst_element_add_pad (playbin, gst_ghost_pad_new ("video_src", videoPlaypad));
159
 
    gst_object_unref (videoPlaypad);
160
 
 
161
 
    //Done with our video redirection
162
 
    g_object_set (G_OBJECT(playbin), "video-sink", videoSinkBin, (const char*)NULL);
163
 
    return playbin;
164
 
}
165
 
 
166
111
QString GstHelper::stateName(GstState state)
167
112
{
168
113
    switch(state) {