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

« back to all changes in this revision

Viewing changes to gstreamer/audiooutput.cpp

  • Committer: Package Import Robot
  • Author(s): Harald Sitter
  • Date: 2013-02-04 14:30:52 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20130204143052-yfhzb2p4vm4xal2r
Tags: 4:4.7.0really4.6.3-0ubuntu1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
{
48
48
    static int count = 0;
49
49
    m_name = "AudioOutput" + QString::number(count++);
50
 
    if (m_backend->isValid()) {
51
 
        m_audioBin = gst_bin_new (NULL);
52
 
        gst_object_ref (GST_OBJECT (m_audioBin));
53
 
        gst_object_sink (GST_OBJECT (m_audioBin));
54
 
 
55
 
        m_conv = gst_element_factory_make ("audioconvert", NULL);
56
 
 
57
 
        // Get category from parent
58
 
        Phonon::Category category = Phonon::NoCategory;
59
 
        if (Phonon::AudioOutput *audioOutput = qobject_cast<Phonon::AudioOutput *>(parent))
60
 
            category = audioOutput->category();
61
 
 
62
 
        m_audioSink = m_backend->deviceManager()->createAudioSink(category);
63
 
        m_volumeElement = gst_element_factory_make ("volume", NULL);
64
 
        GstElement *queue = gst_element_factory_make ("queue", NULL);
65
 
        GstElement *audioresample = gst_element_factory_make ("audioresample", NULL);
66
 
 
67
 
        if (queue && m_audioBin && m_conv && audioresample && m_audioSink && m_volumeElement) {
68
 
            gst_bin_add_many(GST_BIN(m_audioBin), queue, m_conv,
69
 
                             audioresample, m_volumeElement, m_audioSink, NULL);
70
 
 
71
 
            if (gst_element_link_many(queue, m_conv, audioresample, m_volumeElement,
72
 
                                      m_audioSink, NULL)) {
73
 
                // Add ghost sink for audiobin
74
 
                GstPad *audiopad = gst_element_get_static_pad (queue, "sink");
75
 
                gst_element_add_pad (m_audioBin, gst_ghost_pad_new ("sink", audiopad));
76
 
                gst_object_unref (audiopad);
77
 
                m_isValid = true; // Initialization ok, accept input
78
 
            }
 
50
 
 
51
    m_audioBin = gst_bin_new (NULL);
 
52
    gst_object_ref (GST_OBJECT (m_audioBin));
 
53
    gst_object_sink (GST_OBJECT (m_audioBin));
 
54
 
 
55
    m_conv = gst_element_factory_make ("audioconvert", NULL);
 
56
 
 
57
    // Get category from parent
 
58
    Phonon::Category category = Phonon::NoCategory;
 
59
    if (Phonon::AudioOutput *audioOutput = qobject_cast<Phonon::AudioOutput *>(parent))
 
60
        category = audioOutput->category();
 
61
 
 
62
    m_audioSink = m_backend->deviceManager()->createAudioSink(category);
 
63
    m_volumeElement = gst_element_factory_make ("volume", NULL);
 
64
    GstElement *queue = gst_element_factory_make ("queue", NULL);
 
65
    GstElement *audioresample = gst_element_factory_make ("audioresample", NULL);
 
66
 
 
67
    if (queue && m_audioBin && m_conv && audioresample && m_audioSink && m_volumeElement) {
 
68
        gst_bin_add_many(GST_BIN(m_audioBin), queue, m_conv,
 
69
                         audioresample, m_volumeElement, m_audioSink, NULL);
 
70
 
 
71
        if (gst_element_link_many(queue, m_conv, audioresample, m_volumeElement,
 
72
                                  m_audioSink, NULL)) {
 
73
            // Add ghost sink for audiobin
 
74
            GstPad *audiopad = gst_element_get_static_pad (queue, "sink");
 
75
            gst_element_add_pad (m_audioBin, gst_ghost_pad_new ("sink", audiopad));
 
76
            gst_object_unref (audiopad);
 
77
            m_isValid = true; // Initialization ok, accept input
79
78
        }
80
79
    }
81
80
}