Example #1
0
void App::startListen(QGst::PipelinePtr pipe, int port) {
    QGst::ElementPtr rtcpudpsink = QGst::ElementFactory::make("udpsrc");
    rtcpudpsink->setProperty("host", "127.0.0.1"); // TODO settings
    rtcpudpsink->setProperty("port", port);        // source
//    rtcpudpsink->setProperty("sync", false);
//    rtcpudpsink->setProperty("async", false);
    rtcpudpsink->setProperty("caps", QGst::Caps::fromString("application/x-rtp,media=(string)audio, clock-rate=(int)8000, encoding-name=(string)SPEEX,payload=(int)110"));
    pipe->add(rtcpudpsink);


    QGst::ElementPtr bin;

    try {
        bin = QGst::Bin::fromDescription(
            "rtpspeexdepay ! speexdec ! audioconvert"
        );
    } catch (const QGlib::Error & error) {
        qCritical() << error;
        qFatal("One ore more required elements are missing. Aborting...");
    }
    pipe->add(bin);
    rtcpudpsink->link(bin);

    volumeIn = QGst::ElementFactory::make("volume"); // TODO settings
    pipe->add(volumeIn);
    bin->link(volumeIn);


    QGst::ElementPtr audioSynk = QGst::ElementFactory::make("autoaudiosink");
    pipe->add(audioSynk);
    volumeIn->link(audioSynk);
}
void AudioSinkController::initFromStreamingThread(const QGst::PadPtr & srcPad,
                                                  const QGst::PipelinePtr & pipeline)
{
    m_bin = QGst::Bin::fromDescription(
        "volume ! "
        "audioconvert ! "
        "audioresample ! "
        "level"
    );

    pipeline->add(m_bin);
    m_bin->syncStateWithParent();

    m_bin->getStaticPad("src")->link(m_adderRequestPad);
    srcPad->link(m_bin->getStaticPad("sink"));
}
Example #3
0
void VideoSinkController::initFromStreamingThread(const QGst::PadPtr & srcPad,
                                                  const QGst::PipelinePtr & pipeline)
{
    m_bin = QGst::Bin::create();
    m_tee = QGst::ElementFactory::make("tee");

    QGst::ElementPtr fakesink = QGst::ElementFactory::make("fakesink");
    fakesink->setProperty("sync", false);
    fakesink->setProperty("async", false);
    fakesink->setProperty("silent", true);
    fakesink->setProperty("enable-last-sample", false);

    m_bin->add(m_tee, fakesink);
    m_tee->getRequestPad("src_%u")->link(fakesink->getStaticPad("sink"));

    QGst::PadPtr binSinkPad = QGst::GhostPad::create(m_tee->getStaticPad("sink"), "sink");
    m_bin->addPad(binSinkPad);

    pipeline->add(m_bin);
    m_bin->syncStateWithParent();

    srcPad->link(binSinkPad);
}