本文整理汇总了C++中qgst::ElementPtr::getRequestPad方法的典型用法代码示例。如果您正苦于以下问题:C++ ElementPtr::getRequestPad方法的具体用法?C++ ElementPtr::getRequestPad怎么用?C++ ElementPtr::getRequestPad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgst::ElementPtr
的用法示例。
在下文中一共展示了ElementPtr::getRequestPad方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createVideoMixer
QGst::BinPtr GstExporter::createVideoMixer() {
qDebug() << "createVideoMixer start";
QGst::BinPtr videoMixerBin = QGst::Bin::create();
try {
QGst::ElementPtr videoMixer =
QGst::ElementFactory::make("videomixer", "mix");
videoMixer->setProperty("background", (int) 1); //black background
videoMixerBin->add(videoMixer);
int count = 0;
// go through every element in the grid
for (int i = 0; i < rec_->grid.height; ++i) {
for (int j = 0; j < rec_->grid.width; ++j) {
VideoFile* current = &rec_->grid.grid[i][j];
if (current->id != 0) {
qDebug() << "Working on video[" << i << "][" << j
<< "] with id: " << current->id;
QGst::PadPtr pad = videoMixer->getRequestPad("sink_%u");
pad->setProperty("ypos", i * elementHeightPx);
pad->setProperty("xpos", j * elementWidthPx);
qDebug() << "Pad created with xpos: " << pad->property("xpos")
<< ", ypos: " << pad->property("ypos");
QGst::BinPtr filesrc = createFileSrcBin(current->filepath, count);
videoMixerBin->add(filesrc);
QGst::PadPtr sourcepad = filesrc->getStaticPad("src");
sourcepad->link(pad);
++count;
}
}
}
QGst::PadPtr mixSrcPad = videoMixer->getStaticPad("src");
videoMixerBin->addPad(QGst::GhostPad::create(mixSrcPad, "src"));
} catch (const QGlib::Error& error) {
qDebug() << "Failed to create a videomixer:" << error;
return QGst::BinPtr();
}
return videoMixerBin;
}
示例2: 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);
}