예제 #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;
    }
}
예제 #2
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();
}