当前位置: 首页>>代码示例>>C++>>正文


C++ ElementPtr::link方法代码示例

本文整理汇总了C++中qgst::ElementPtr::link方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr::link方法的具体用法?C++ ElementPtr::link怎么用?C++ ElementPtr::link使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgst::ElementPtr的用法示例。


在下文中一共展示了ElementPtr::link方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: startListen

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);
}
开发者ID:jadeStrern,项目名称:kanaria,代码行数:32,代码来源:app.cpp

示例2: createRtpSink

void GstRecorder::createRtpSink(quint16 port, QString address) {
  QGst::BinPtr videoSrcBin = createVideoSrcBin();
  QGst::ElementPtr rtpbin = QGst::ElementFactory::make("rtpbin");
  QGst::ElementPtr h264pay = QGst::ElementFactory::make("rtph264pay");

  if (!videoSrcBin || !rtpbin) {
    qDebug() << "Error. One or more elements could not be created.";
    return;
  }

  m_pipeline = QGst::Pipeline::create();
  m_pipeline->add(videoSrcBin, h264pay);
  videoSrcBin->link(h264pay);

  m_pipeline->add(rtpbin);
  // send_rtp_sink_0 is needed as a parameter for rtpbin for the configuration
  h264pay->link(rtpbin, "send_rtp_sink_0");

  QGst::ElementPtr RtpUdpSink = QGst::ElementFactory::make("udpsink");
  RtpUdpSink->setProperty("port", (int)port);
  RtpUdpSink->setProperty("host", address);
  if (!RtpUdpSink) {
    qFatal("Failed to create udpsink. Aborting...");
  }
  m_pipeline->add(RtpUdpSink);
  rtpbin->link("send_rtp_src_0", RtpUdpSink);

  QGst::ElementPtr RtcpUdpSink = QGst::ElementFactory::make("udpsink");
  RtcpUdpSink->setProperty("port", port + 1);
  RtcpUdpSink->setProperty("host", address);
  RtcpUdpSink->setProperty("sync", false);  // needed for real-time
  RtcpUdpSink->setProperty("async", false);
  m_pipeline->add(RtcpUdpSink);
  rtpbin->link("send_rtcp_src_0", RtcpUdpSink);

  QGst::ElementPtr RtcpUdpSrc = QGst::ElementFactory::make("udpsrc");
  RtcpUdpSrc->setProperty("port", port + 2);
  m_pipeline->add(RtcpUdpSrc);
  RtcpUdpSrc->link(rtpbin, "recv_rtcp_sink_0");

  // watch the bus
  m_pipeline->bus()->addSignalWatch();
  QGlib::connect(m_pipeline->bus(), "message", this,
                 &GstRecorder::onBusMessage);

  qDebug() << "Streaming to RTP";

  m_pipeline->setState(QGst::StatePlaying);
}
开发者ID:studnitz,项目名称:octopus,代码行数:49,代码来源:gst_recorder.cpp

示例3: createDecoder

QGst::BinPtr GstExporter::createDecoder(const int i) {
  qDebug() << "createDecoder start, i: " << i;
  char* decArray = nameWithIndex("decoder", i);
  QGst::BinPtr decoderBin;
  try {
    decoderBin = QGst::Bin::create(decArray);
    QGst::ElementPtr parser = QGst::ElementFactory::make("h264parse");
    QGst::ElementPtr decoder;
    if (usesOmx) {
      decoder = QGst::ElementFactory::make("omxh264dec");
    } else {
      decoder = QGst::ElementFactory::make("avdec_h264");
    }
    decoderBin->add(parser, decoder);
    parser->link(decoder);

    QGst::PadPtr parserSinkPad = parser->getStaticPad("sink");
    QGst::PadPtr decoderSrcPad = decoder->getStaticPad("src");

    // Add Ghostpads for abstraction
    decoderBin->addPad(QGst::GhostPad::create(parserSinkPad, "sink"));
    decoderBin->addPad(QGst::GhostPad::create(decoderSrcPad, "src"));

  } catch (const QGlib::Error& error) {
    qCritical() << "Failed to create a decoder:" << error;
    return QGst::BinPtr();
  }
  return decoderBin;
}
开发者ID:studnitz,项目名称:octopus,代码行数:29,代码来源:gst_exporter.cpp

示例4: createFileSrcBin

QGst::BinPtr GstExporter::createFileSrcBin(const QString path, const int i) {
  qDebug() << "creating filesrc bin, path: " << path << " i: " << i;
  QGst::BinPtr videoBin;

  QDir current = QDir::current();
  current.cd("recordings");
  const QString fullPath = current.absoluteFilePath(path);

  try {
    char* srcname = nameWithIndex("file", i);
    QGst::ElementPtr src = QGst::ElementFactory::make("filesrc", srcname);
    src->setProperty("location", fullPath);

    char* demuxName = nameWithIndex("demux", i);
    QGst::ElementPtr demuxer = QGst::ElementFactory::make("qtdemux", demuxName);
    QGst::BinPtr decoder = createDecoder(i);
    QGst::ElementPtr scale = QGst::ElementFactory::make("videoscale");
    QGst::ElementPtr capsfilter =
        createCapsFilter(elementWidthPx, elementHeightPx);

    char* binname = nameWithIndex("filebin", i);
    videoBin = QGst::Bin::create(binname);

    videoBin->add(src, demuxer, decoder, capsfilter, scale);
    src->link(demuxer);
    videoBin->linkMany(decoder, scale, capsfilter);

    qDebug() << "filesrc bin: Added and linked all elements";

    QGst::PadPtr filterPadSrc = capsfilter->getStaticPad("src");
    videoBin->addPad(QGst::GhostPad::create(filterPadSrc, "src"));

    qDebug() << "filesrc bin: Added Ghostpad to the bin";

    QGlib::connect(demuxer, "pad-added", this, &GstExporter::callbackNewPad,
                   QGlib::PassSender);

  } catch (const QGlib::Error& error) {
    qCritical() << "Failed to create a filesource:" << error;
    return QGst::BinPtr();
  }

  return videoBin;
}
开发者ID:studnitz,项目名称:octopus,代码行数:44,代码来源:gst_exporter.cpp

示例5: startCapture

void QtGStreamerCaptureBackend::startCapture(const QString &filePath)
{
    // clear pipeline if still existing
    if (m_pipeline) {
        qCWarning(LIBSOUND_LOG) << "removing forgotten pipeline";
        //send an end-of-stream event to flush metadata and cause an EosMessage to be delivered
        m_pipeline->sendEvent(QGst::EosEvent::create());
    }

    QGst::BinPtr audioSrcBin = createAudioSrcBin();
    QGst::ElementPtr mux = QGst::ElementFactory::make("oggmux");
    QGst::ElementPtr sink = QGst::ElementFactory::make("filesink");

    if (!audioSrcBin || !mux || !sink) {
        qCritical() << "One or more elements could not be created. "
                 << "Verify that you have all the necessary element plugins installed.";
        return;
    }

    // set output path
    sink->setProperty("location", filePath);

    m_pipeline = QGst::Pipeline::create();
    m_pipeline->add(audioSrcBin, mux, sink);

    //link elements
    QGst::PadPtr audioPad = mux->getRequestPad("audio_%u");
    audioSrcBin->getStaticPad("src")->link(audioPad);

    mux->link(sink);

    //connect the bus
    m_pipeline->bus()->addSignalWatch();
    QGlib::connect(m_pipeline->bus(), "message", this, &QtGStreamerCaptureBackend::onBusMessage);
    m_pipeline->setState(QGst::StatePlaying);
}
开发者ID:KDE,项目名称:artikulate,代码行数:36,代码来源:qtgstreamercapturebackend.cpp

示例6: startVoice

void App::startVoice() {
    rtpbin = QGst::ElementFactory::make("gstrtpbin");
    if (!rtpbin) {
        qFatal("Failed to create gstrtpbin");
    }
    qDebug() << "initn create";

    m_pipelineOut->add(rtpbin);

    //audio content
    //sending side
    QGst::ElementPtr audiosrc;

    try {
        audiosrc = QGst::Bin::fromDescription(
//            "alsasrc device=plughw:0 ! queue ! audioconvert ! audiorate ! audio/x-raw-int,rate=8000 "
//            "! speexenc ! rtpspeexpay"
//        );
            "audiotestsrc ! queue ! audioconvert ! audiorate ! audio/x-raw-int,rate=8000 ! audioconvert"
        );
//        audiosrc = QGst::Bin::fromDescription(
//             "audiotestsrc ! audioconvert ! level ! audioconvert ! twolame  ! rtpmpapay"
//        );
    } catch (const QGlib::Error & error) {
        qCritical() << error;
        qFatal("One ore more required elements are missing. Aborting...");
    }
    m_pipelineOut->add(audiosrc);

    volumeOut = QGst::ElementFactory::make("volume");
    m_pipelineOut->add(volumeOut); // TODO settings

    audiosrc->link(volumeOut);

    QGst::ElementPtr decoder;
    try {
        decoder = QGst::Bin::fromDescription(
            "speexenc vad=false ! rtpspeexpay"
        );
    } catch (const QGlib::Error & error) {
        qCritical() << error;
        qFatal("One ore more required elements are missing. Aborting...");
    }
    m_pipelineOut->add(decoder);
    volumeOut->link(decoder);



    decoder->link(rtpbin, "send_rtp_sink_1");

    rtpudpsink =  QGst::ElementFactory::make("udpsink");
    if (!rtpudpsink) {
        qFatal("Failed to create udpsink. Aborting...");
    }


    rtpudpsink->setProperty("host", "127.0.0.1"); // desttination 192.168.0.102
    rtpudpsink->setProperty("port", 5000);        // port
    m_pipelineOut->add(rtpudpsink);
    rtpbin->link("send_rtp_src_1", rtpudpsink);

}
开发者ID:jadeStrern,项目名称:kanaria,代码行数:62,代码来源:app.cpp


注:本文中的qgst::ElementPtr::link方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。