コード例 #1
0
STDMETHODIMP
CPosPassThru::GetCurrentPosition(LONGLONG *pCurrent)
{
    // Can we report the current position
    HRESULT hr = GetMediaTime(pCurrent,NULL);
    if (SUCCEEDED(hr)) hr = NOERROR;
    else hr = GetSeekingLongLong( &IMediaSeeking::GetCurrentPosition, pCurrent );
    return hr;
}
コード例 #2
0
void CMMAMMFPlayerBase::StopL(TBool aPostEvent)
{
    if (iState == EStarted)
    {
        TInt64 time;
        GetMediaTime(&time);
        iStartedEventTime = time;

        TInt err = KErrNone;
        // AAC controller does not support multiple
        // calls to pause but leave with KErrNotReady.
        // That error is dismissed as player should
        // be paused already in that case.
        if (time == 0)
        {
            LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position is zero, stopping");
            // Normally pause would be called, but if
            // current time is zero, Stop is called instead.
            // This is done because video playback breaks
            // if pause is called between events
            // KMMFEventCategoryVideoLoadingStarted and
            // KMMFEventCategoryVideoLoadingCompleted
            // (no wurther events are delivered altough
            // playback continues fine).
            // However calling Stop is tolerated in that
            // situation.
            err = iController.Stop();
            if (err == KErrNone)
            {
                err = iController.Prime();
            }
        }
        else
        {
            LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::StopL: Position not zero, pausing");
            err = iController.Pause();
        }

        if ((err != KErrNone) && (err != KErrNotReady))
        {
            ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::StopL: pause/stop failed %d, leaving", err);
            User::Leave(err);
        }

        if (aPostEvent)
        {
            PostLongEvent(CMMAPlayerEvent::EStopped, time);
        }
        // go back to prefetched state
        ChangeState(EPrefetched);
    }
}
コード例 #3
0
void CMMAMMFPlayerBase::SetMediaTimeL(TInt64* aTime)
{
    LOG(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL");

    // Negative values are not checked here
    // because it's done already in Java side.

    // Get clip duration
    TTimeIntervalMicroSeconds duration;
    User::LeaveIfError(iController.GetDuration(duration));
    LOG1(EJavaMMAPI, EInfo, "CMMAMMFPlayerBase::SetMediaTimeL iController.GetDuration=%d", duration.Int64());

    TTimeIntervalMicroSeconds position;

    // If the desired media time is beyond the duration,
    // the time is set to the end of the media.
    if (*aTime > duration.Int64())
    {
        position = duration;
    }
    else
    {
        position = *aTime;
    }

    TBool paused = EFalse;
    TInt err = KErrNone;

    if (iState == EStarted)
    {
        paused = ETrue;
        User::LeaveIfError(err = iController.Pause());
        ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL after iController.Pause = %d", err);
    }

    if (err == KErrNone)
    {
        // The controller must be in the PRIMED or PLAYING state
        User::LeaveIfError(err = iController.SetPosition(position));
        ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.SetPosition() = %d", err);
    }

    // Reset cached media time, because actual set position may be
    // something else than aTime.
    iMediaTime = KTimeUnknown;

    // Inform about the position change to the StateListeners
    ChangeState(iState);

    // Get the actual media time
    GetMediaTime(aTime);

    iStartedEventTime = iMediaTime;

    if (err == KErrNone)
    {
        if (paused == (TBool)ETrue)
        {
            User::LeaveIfError(err = iController.Play());
            ELOG1(EJavaMMAPI, "CMMAMMFPlayerBase::SetMediaTimeL iController.Play() = %d", err);
        }
    }

    if (err != KErrNone)
    {
        User::Leave(err);
    }
}