QGst::BinPtr QtGStreamerCaptureBackend::createAudioSrcBin()
{
    QGst::BinPtr audioBin;

    try {
        audioBin = QGst::Bin::fromDescription("autoaudiosrc name=\"audiosrc\" ! audioconvert ! "
                                              "audioresample ! audiorate ! vorbisenc name=enc quality=0.6 ! queue");
    } catch (const QGlib::Error &error) {
        qCritical() << "Failed to create audio source bin:" << error;
        return QGst::BinPtr();
    }
    QGst::ElementPtr src = audioBin->getElementByName("audiosrc");
    //autoaudiosrc creates the actual source in the READY state

    src->setState(QGst::StateReady);
    return audioBin;
}
示例#2
0
QGst::BinPtr GstRecorder::createAudioSrcBin() {
  QGst::BinPtr audioBin;
  qDebug() << "creating Audio Source bin.";

  try {
    audioBin = QGst::Bin::fromDescription(
        "autoaudiosrc name=\"audiosrc\" ! audioconvert ! "
        "audioresample ! audiorate ! speexenc ! queue");
  } catch (const QGlib::Error &error) {
    qCritical() << "Failed to create audioSrcBin: " << error;
    return QGst::BinPtr();
  }

  QGst::ElementPtr src = audioBin->getElementByName("audiosrc");
  //autoaudiosrc creates the actual source in the READY state
  src->setState(QGst::StateReady);

  return audioBin;
}