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

« back to all changes in this revision

Viewing changes to gstreamer/backend.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:
15
15
    along with this library.  If not, see <http://www.gnu.org/licenses/>.
16
16
*/
17
17
 
18
 
#include "common.h"
19
18
#include "backend.h"
20
19
#include "audiooutput.h"
21
20
#include "audiodataoutput.h"
25
24
#include "videowidget.h"
26
25
#include "devicemanager.h"
27
26
#include "effectmanager.h"
28
 
#include "message.h"
29
27
#include "volumefadereffect.h"
30
28
#include <gst/interfaces/propertyprobe.h>
31
29
#include <phonon/pulsesupport.h>
85
83
    if (err)
86
84
        g_error_free(err);
87
85
 
88
 
    qRegisterMetaType<Message>("Message");
89
86
#ifndef QT_NO_PROPERTIES
90
87
    setProperty("identifier",     QLatin1String("phonon_gstreamer"));
91
88
    setProperty("backendName",    QLatin1String("Gstreamer"));
92
89
    setProperty("backendComment", QLatin1String("Gstreamer plugin for Phonon"));
93
90
    setProperty("backendVersion", QLatin1String(PHONON_GST_VERSION));
94
 
    setProperty("backendWebsite", QLatin1String("http://qt.nokia.com/"));
 
91
    setProperty("backendWebsite", QLatin1String("http://phonon.kde.org/"));
95
92
#endif //QT_NO_PROPERTIES
96
93
 
97
94
    //check if we should enable debug output
121
118
    PulseSupport::shutdown();
122
119
}
123
120
 
124
 
gboolean Backend::busCall(GstBus *bus, GstMessage *msg, gpointer data)
125
 
{
126
 
    Q_UNUSED(bus);
127
 
    Q_ASSERT(msg);
128
 
 
129
 
    MediaObject *mediaObject = static_cast<MediaObject*>(data);
130
 
    Q_ASSERT(mediaObject);
131
 
 
132
 
    Message message(msg, mediaObject);
133
 
    QMetaObject::invokeMethod(mediaObject->backend(), "handleBusMessage", Qt::QueuedConnection, Q_ARG(Message, message));
134
 
 
135
 
    return true;
136
 
}
137
 
 
138
121
/***
139
122
 * !reimp
140
123
 */
441
424
    return true;
442
425
}
443
426
 
444
 
/***
445
 
 * Request bus messages for this mediaobject
446
 
 */
447
 
void Backend::addBusWatcher(MediaObject* node)
448
 
{
449
 
    Q_ASSERT(node);
450
 
    GstBus *bus = gst_pipeline_get_bus(GST_PIPELINE(node->pipeline()));
451
 
    gst_bus_add_watch(bus, busCall, node);
452
 
    gst_object_unref(bus);
453
 
    m_watchList.insert(node);
454
 
}
455
 
 
456
 
/***
457
 
 * Ignore bus messages for this mediaobject
458
 
 */
459
 
void Backend::removeBusWatcher(MediaObject* node)
460
 
{
461
 
    Q_ASSERT(node);
462
 
    g_source_remove_by_user_data(node);
463
 
    m_watchList.remove(node);
464
 
}
465
 
 
466
 
/***
467
 
 * Polls each mediaobject's pipeline and delivers
468
 
 * pending any pending messages
469
 
 */
470
 
void Backend::handleBusMessage(Message message)
471
 
{
472
 
    MediaObject *mediaObject = message.source();
473
 
    Q_ASSERT(mediaObject);
474
 
    if (m_watchList.contains(mediaObject)) {
475
 
        mediaObject->handleBusMessage(message);
476
 
    }
477
 
}
478
 
 
479
427
DeviceManager* Backend::deviceManager() const
480
428
{
481
429
    return m_deviceManager;