OSCL_EXPORT_REF PVCommandId PV2WayMIO::HandleEvent(const PVAsyncInformationalEvent& aEvent)
{
    PVCommandId retvalue = -1;
    TPVChannelId id = GetIdFromLocalBuffer((PVAsyncInformationalEvent &) aEvent);
    if (PVT_INDICATION_INCOMING_TRACK == aEvent.GetEventType())
    {
        if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
        {
            OutputInfo("PVT_INDICATION_INCOMING_TRACK video, id %d\n", id);
        }
        else if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
        {
            OutputInfo("PVT_INDICATION_INCOMING_TRACK audio, id %d\n", id);
        }
    }
    else if (PVT_INDICATION_OUTGOING_TRACK == aEvent.GetEventType())
    {
        if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_VIDEO)
        {
            OutputInfo("PVT_INDICATION_OUTGOING_TRACK video, id %d\n", id);
        }
        else if (((PVAsyncInformationalEvent&)aEvent).GetLocalBuffer()[0] == PV_AUDIO)
        {
            OutputInfo("PVT_INDICATION_OUTGOING_TRACK audio, id %d\n", id);
        }
    }
    if (iChannelId == id)
    {
        OutputInfo("\nDuplicate callback for  id %d\n", id);
        return -1;
    }

    if (iChannelId)
    {
        OutputInfo("\nBusy ... MIO id=%d being closed\n", iChannelId);
        iNextChannelId = id;
        return -1;
    }
    if (!iClosing && !iAdded)
    {
        iChannelId = id;
        // format matching capabilities and create- create can tell us which kind to create
        // including which file we should use, etc.
        iSelectedCodec = FormatMatchesCapabilities(aEvent);
        if (iSelectedCodec)
        {
            iMioNode = iObserver->CreateMIONode(iSelectedCodec, iMyDir);
            iMySelectedFormat = iSelectedCodec->GetFormat();
            retvalue = Add();
        }
        else
        {
            OutputInfo("\nDid not find a codec!!! \n");
        }
    }
    return retvalue;
}
void PV2WayMIO::ParseResponse(const PVAsyncInformationalEvent& aEvent,
                              PVMFFormatType& aMimeString,
                              int& aMedia_type)
{

    PV2WayTrackInfoInterface* aTrackInfoInterface;
    aTrackInfoInterface = (PV2WayTrackInfoInterface *)aEvent.GetEventExtensionInterface();
    if (aTrackInfoInterface)
        aTrackInfoInterface->GetFormatString(aMimeString);
    aMedia_type = aEvent.GetLocalBuffer()[0];
}
void pv_mediainput_async_test_delete::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "pv_mediainput_async_test_delete::HandleInformationalEvent"));
    OsclAny* eventData = NULL;
    switch (aEvent.GetEventType())
    {
        case PVMF_COMPOSER_MAXFILESIZE_REACHED:
        case PVMF_COMPOSER_MAXDURATION_REACHED:
            PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
                            (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: Max file size reached"));
            Cancel();
            PVPATB_TEST_IS_TRUE(true);
            CompleteTest();
            break;

        case PVMF_COMPOSER_DURATION_PROGRESS:
            aEvent.GetEventData(eventData);
            PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
                            (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: Duration progress: %d ms",
                             (int32)eventData));
            break;

        case PVMF_COMPOSER_FILESIZE_PROGRESS:
            aEvent.GetEventData(eventData);
            PVLOGGER_LOGMSG(PVLOGMSG_INST_LLDBG, iLogger, PVLOGMSG_DEBUG,
                            (0, "pv_mediainput_async_test_delete::HandleNodeInformationalEvent: File size progress: %d bytes",
                             (int32)eventData));
            break;

        case PVMF_COMPOSER_EOS_REACHED:
            //Engine already stopped at EOS so send reset command.
            iState = PVAE_CMD_RESET;
            //cancel recording timeout scheduled for timer object.
            Cancel();
            RunIfNotReady();
            break;

        default:
            break;
    }
}
void pv_mediainput_async_test_errorhandling::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
{
    PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
                    (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent"));

    switch (aEvent.GetEventType())
    {
        case PVMF_COMPOSER_EOS_REACHED:
            //Engine already stopped at EOS so send reset command.
            iState = PVAE_CMD_RESET;
            Cancel();
            RunIfNotReady();
            PVLOGGER_LOGMSG(PVLOGMSG_INST_REL, iLogger, PVLOGMSG_STACK_TRACE,
                            (0, "pv_mediainput_async_test_errorhandling::HandleInformationalEvent: EOS reached"));

            break;

        default:
            break;
    }

}
void connect_test::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
{

    switch (aEvent.GetEventType())
    {
        case PVT_INDICATION_DISCONNECT:
            iAudioSourceAdded = false;
            iVideoSourceAdded = false;
            iAudioSinkAdded = false;
            iVideoSinkAdded = false;
            break;

        case PVT_INDICATION_INTERNAL_ERROR:
            break;

        case PVT_INDICATION_INCOMING_TRACK:
            printf("Incoming Indication\n");
            break;

        default:
            break;
    }
}
TPVChannelId GetIdFromLocalBuffer(PVAsyncInformationalEvent &aEvent)
{
    TPVChannelId *channel = (TPVChannelId *) & aEvent.GetLocalBuffer()[4];
    return *channel;
}
Ejemplo n.º 7
0
void MetadataDriver::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
{
    LOGV("HandleInformationalEvent: Event [type(%d), response type(%d)] received.", aEvent.GetEventType(), aEvent.GetResponseType());
}
void PlayerDriver::HandleInformationalEvent(const PVAsyncInformationalEvent& aEvent)
{
    switch(aEvent.GetEventType()) {
    case PVMFInfoEndOfData:
        LOGV("PVMFInfoEndOfData");
        mEndOfData = true;
        if (mIsLooping) {
            mDoLoop = true;
            Cancel();
            RunIfNotReady();
        } else {
            mPvPlayer->sendEvent(MEDIA_PLAYBACK_COMPLETE);
        }
        break;

    case PVMFInfoErrorHandlingComplete:
        LOGW("PVMFInfoErrorHandlingComplete");
        RunIfNotReady();
        break;

    case PVMFInfoBufferingStart:
        LOGV("PVMFInfoBufferingStart");
        mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, 0);
        break;

    case PVMFInfoBufferingStatus:
        {
            uint8 *localBuf = aEvent.GetLocalBuffer();
            if (localBuf != NULL) {
                uint32 bufPercent;
                oscl_memcpy(&bufPercent, localBuf, sizeof(uint32));
                LOGV("PVMFInfoBufferingStatus(%u)", bufPercent);
                mPvPlayer->sendEvent(MEDIA_BUFFERING_UPDATE, bufPercent);
            }
        }
        break;

    case PVMFInfoDurationAvailable:
        LOGV("PVMFInfoDurationAvailable event ....");
        {
            PVUuid infomsguuid = PVMFDurationInfoMessageInterfaceUUID;
            PVMFDurationInfoMessageInterface* eventMsg = NULL;
            PVInterface* infoExtInterface = aEvent.GetEventExtensionInterface();
            if (infoExtInterface &&
                    infoExtInterface->queryInterface(infomsguuid, (PVInterface*&)eventMsg))
            {
                PVUuid eventuuid;
                int32 infoCode;
                eventMsg->GetCodeUUID(infoCode, eventuuid);
                if (eventuuid == infomsguuid)
                {
                    uint32 SourceDurationInMS = eventMsg->GetDuration();
                    LOGV(".... with duration = %u ms",SourceDurationInMS);
                }
            }
        }
        break;

    case PVMFInfoDataReady:
        LOGV("PVMFInfoDataReady");
        if (mDataReadyReceived)
            break;
        mDataReadyReceived = true;
        // If this is a network stream, we are now ready to play.
        if (mDownloadContextData && mPrepareDone) {
            mPvPlayer->sendEvent(MEDIA_PREPARED);
        }
        break;

    case PVMFInfoVideoTrackFallingBehind:
        LOGW("Video track fell behind");
        mPvPlayer->sendEvent(MEDIA_ERROR, PVMFInfoVideoTrackFallingBehind);
        break;

    case PVMFInfoPoorlyInterleavedContent:
        LOGW("Poorly interleaved content.");
        mPvPlayer->sendEvent(MEDIA_ERROR, PVMFInfoPoorlyInterleavedContent);
        break;

    case PVMFInfoContentTruncated: //LOGI("PVMFInfoContentTruncated\n"); break;
        LOGE("Content is truncated.");
        break;

    /* Certain events we don't really care about, but don't
     * want log spewage, so just no-op them here.
     */
    case PVMFInfoPositionStatus: //LOGI("PVMFInfoPositionStatus\n"); break;
    case PVMFInfoBufferingComplete: //LOGI("PVMFInfoBufferingComplete\n"); break;
    case PVMFInfoContentLength: //LOGI("PVMFInfoContentLength: %d\n", (int)get_event_data(aEvent)); break;
    case PVMFInfoContentType: //LOGI("PVMFInfoContentType: %s\n", (char *)get_event_data(aEvent)); break;
    case PVMFInfoUnderflow: //LOGI("PVMFInfoUnderflow\n"); break;
    case PVMFInfoDataDiscarded: //LOGI("PVMFInfoDataDiscarded\n"); break;
        break;

    default:
        LOGV("HandleInformationalEvent: type=%d UNHANDLED", aEvent.GetEventType());
        break;
    }
}