Esempio n. 1
3
void AbstractAudioSource::onPipelineBusmessage (const QGst::MessagePtr& message)
{
    switch (message->type()) {
    case QGst::MessageError: {
        QGst::ErrorMessagePtr errMsg = message.staticCast<QGst::ErrorMessage>();
        qDebug() << "[AbstractContentSource::onPipelineBusmessage()] Error message:" << errMsg->debugMessage();
    }
    break;

    case QGst::MessageStateChanged: {
        QGst::StateChangedMessagePtr stateMsg = message.staticCast<QGst::StateChangedMessage>();
        QString oldState = getStateText (stateMsg->oldState());
        QString newState = getStateText (stateMsg->newState());
        qDebug() << "[AbstractContentSource::onPipelineBusmessage()] State changed from" << oldState << "to" << newState;
    }
    break;

    case QGst::MessageAsyncDone:
        qDebug() << "[AbstractContentSource::onPipelineBusmessage()] Asynchronous completion invoked.";
        break;

    case QGst::MessageAsyncStart:
        qDebug() << "[AbstractContentSource::onPipelineBusmessage()] Asynchronous start invoked.";
        break;

    case QGst::MessageStreamStatus: {
        QGst::StreamStatusMessagePtr streamStatusMessage = message.staticCast<QGst::StreamStatusMessage>();
        qWarning() << "[AbstractContentSource::onPipelineBusmessage()] " << streamStatusMessage->streamStatusObject().toString();
    }
    break;

    case QGst::MessageElement: {
        QGst::ElementMessagePtr elementMessage = message.staticCast<QGst::ElementMessage>();
        //qDebug() << "[AbstractContentSource::onPipelineBusmessage()] Element message: " << elementMessage->internalStructure()->toString();
    }
    break;

    case QGst::MessageClockProvide:
    case QGst::MessageClockLost: {
    }
    break;

    default:
        qWarning() << "[AbstractContentSource::onPipelineBusmessage()] Unexpected message:" << message->typeName();
        break;
    }
}
Esempio n. 2
1
void EventTest::sinkMessageTest()
{
    QGst::MessagePtr msg = QGst::BufferingMessage::create(QGst::ObjectPtr(), 90);
    QGst::SinkMessageEventPtr evt = QGst::SinkMessageEvent::create("sink-message", msg);
    QVERIFY(evt->type()==QGst::EventSinkMessage);
    QCOMPARE(evt->typeName(), QString("sink-message"));

    QGst::MessagePtr msg2 = evt->message();
    QVERIFY(msg2->type() == msg->type());
    QGst::BufferingMessagePtr msg3 = msg2.dynamicCast<QGst::BufferingMessage>();
    QCOMPARE(msg3->percent(), 90);
};
Esempio n. 3
0
void MediaSourceBase::onBusMessage(const QGst::MessagePtr &message)
{
    qDebug() << "SOURCEPIPELINE" << id << "MESSAGE" << message->type() << message->typeName();
    switch (message->type()) {
    case QGst::MessageEos:
        sourceOffline();
        emit pipelineEOS();
        break;
    case QGst::MessageError:
        qCritical() << "SOURCEPIPELINE" << id << "ERROR:" << message.staticCast<QGst::ErrorMessage>()->error() << message.staticCast<QGst::ErrorMessage>()->debugMessage();
        sourceOffline();
        emit pipelineError(message.staticCast<QGst::ErrorMessage>()->error().message(), message.staticCast<QGst::ErrorMessage>()->debugMessage());
        break;
    case QGst::MessageStateChanged:
        qDebug() << "NEWSTATE:" << message.staticCast<QGst::StateChangedMessage>()->newState();
        emit pipelineNewState(message.staticCast<QGst::StateChangedMessage>()->newState());
        break;
    default:
        break;
    }

    updateBackground();
}
Esempio n. 4
0
void GstRecorder::onBusMessage(const QGst::MessagePtr &message) {
  switch (message->type()) {
    case QGst::MessageEos:
      // got end-of-stream - stop the pipeline
      stop();
      break;
    case QGst::MessageError:
      // check if the pipeline exists before destroying it,
      // as we might get multiple error messages
      if (m_pipeline) {
        stop();
      }
      qDebug() << message.staticCast<QGst::ErrorMessage>()->error().message();
      break;
    default:
      break;
  }
}
Esempio n. 5
0
void Player::onBusMessage(const QGst::MessagePtr & message)
{
    switch (message->type()) {
    case QGst::MessageEos: //End of stream. We reached the end of the file.
        stop();
        break;
    case QGst::MessageError: //Some error occurred.
        qCritical() << message.staticCast<QGst::ErrorMessage>()->error();
        stop();
        break;
    case QGst::MessageStateChanged: //The element in message->source() has changed state
        if (message->source() == m_pipeline) {
            handlePipelineStateChange(message.staticCast<QGst::StateChangedMessage>());
        }
        break;
    default:
        break;
    }
}
void GStreamerPipeline::handleBusMessage( const QGst::MessagePtr &message )
{
    switch( message->type() ) {
    case( QGst::MessageEos ):
        onEos();
        break;
    case( QGst::MessageError ):
        onError( message.staticCast<QGst::ErrorMessage>() );
        break;
    case( QGst::MessageBuffering ):
        onBuffering( message.staticCast<QGst::BufferingMessage>() );
        break;
    case( QGst::MessageClockLost ):
        qDebug() << "Clock Lost!";
        mPipeline->setState( QGst::StatePaused );
        mPipeline->setState( QGst::StatePlaying );
        break;
    }
}
void QtGStreamerCaptureBackend::onBusMessage(const QGst::MessagePtr & message)
{
    switch (message->type()) {
    case QGst::MessageEos:
        //got end-of-stream - stop the pipeline
        qCDebug(LIBSOUND_LOG) << "EOS signal received, stopping pipeline";
        stopPipeline();
        break;
    case QGst::MessageError:
        //check if the pipeline exists before destroying it,
        //since we could get multiple error messages
        if (m_pipeline) {
            stopPipeline();
        }
        qCritical() << "Pipeline Error:"
                 << message.staticCast<QGst::ErrorMessage>()->error().message();
        break;
    default:
        break;
    }
}