Ejemplo n.º 1
0
TInt XAPlaySessionImpl::pause()
{
    TInt retVal(KErrGeneral);
    XAresult xaRes;
    XAuint32 state;

#ifdef USE_VIDEOPLAYERUTILITY
    TRAPD(err, mVideoPlayUtil->PauseL());
    return 0;
#endif

    if (!mMOPlayer || !mPlayItf)
        return retVal;

    xaRes = (*mPlayItf)->GetPlayState(mPlayItf, &state);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);

    if ((state == XA_PLAYSTATE_STOPPED) ||
            (state == XA_PLAYSTATE_PLAYING)) {
        xaRes = (*mPlayItf)->SetPlayState(mPlayItf, XA_PLAYSTATE_PAUSED);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);
    }

    return retVal;
}
Ejemplo n.º 2
0
TInt XAPlaySessionImpl::stop()
{
    TInt retVal(KErrGeneral);
    XAresult xaRes;
    XAuint32 state;

#ifdef USE_VIDEOPLAYERUTILITY
    mVideoPlayUtil->Stop();
    return 0;
#endif

    if (!mMOPlayer || !mPlayItf)
        return retVal;

    xaRes = (*mPlayItf)->GetPlayState(mPlayItf, &state);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);

    if ((state == XA_PLAYSTATE_PAUSED) ||
            (state == XA_PLAYSTATE_PLAYING)) {
        xaRes = (*mPlayItf)->SetPlayState(mPlayItf, XA_PLAYSTATE_STOPPED);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);
        mCurPosition += KPlayPosUpdatePeriod;
        mParent.cbPositionChanged(mCurPosition);
    }

    return retVal;
}
TInt COpenMAXALTestModule::al_radioitf_GetStereoMode( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TInt expectedStereoMode;
    status = aItem.GetNextInt(expectedStereoMode);
    RET_ERR_IF_ERR(status);
    XAuint32 stereoMode;

    if(m_RadioItf)
        {
        status = (*m_RadioItf)->GetStereoMode(
                m_RadioItf, &stereoMode);
        if (!status)
           {
           if (stereoMode != (XAboolean)expectedStereoMode)
               {
               status = KErrCompletion;
               }
           }
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_GetFreqRange( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    XAuint8 freqRange;
    TInt expectedRange;
    status = aItem.GetNextInt(expectedRange);
    RET_ERR_IF_ERR(status);

    if (m_RadioItf)
        {
        status = (*m_RadioItf)->GetFreqRange(
                m_RadioItf, &freqRange);
        if (!status)
            {
            if (freqRange != (TInt)expectedRange)
                {
                status = KErrCompletion;
                }
            }
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_GetSquelch( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TBool expectedSquelch;
    status = aItem.GetNextInt(expectedSquelch);
    RET_ERR_IF_ERR(status);
    XAboolean squelch;

    if(m_RadioItf)
        {
        status = (*m_RadioItf)->GetSquelch(
                m_RadioItf, &squelch);
         if (!status)
            {
            if (squelch != (XAboolean)expectedSquelch)
                {
                status = KErrCompletion;
                }
            }
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
Ejemplo n.º 6
0
TInt XAPlaySessionImpl::postConstruct()
{
    TInt retVal;
    XAresult xaRes;
    XAEngineOption engineOption[] = {     (XAuint32) XA_ENGINEOPTION_THREADSAFE,
                                          (XAuint32) XA_BOOLEAN_TRUE
                                    };
    XAEngineItf engineItf;

    mNativeDisplay.locatorType = XA_DATALOCATOR_NATIVEDISPLAY;
    mNativeDisplay.hWindow = NULL;
    mNativeDisplay.hDisplay = NULL;
    mVideoSink.pLocator = (void*)&mNativeDisplay;
    mVideoSink.pFormat = NULL;

    // Create and realize Engine object
    xaRes = xaCreateEngine (&mEOEngine, 1, engineOption, 0, NULL, NULL);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);
    xaRes = (*mEOEngine)->Realize(mEOEngine, XA_BOOLEAN_FALSE);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);

    // Create and realize Output Mix object to be used by player
    xaRes = (*mEOEngine)->GetInterface(mEOEngine, XA_IID_ENGINE, (void**) &engineItf);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);

    TRAP(retVal, mWAVMime = HBufC8::NewL(K8WAVMIMETYPE().Length() + 1));
    RET_ERR_IF_ERR(retVal);
    TPtr8 ptr = mWAVMime->Des();
    ptr = K8WAVMIMETYPE(); // copy uri name into local variable
    ptr.PtrZ(); // append zero terminator to end of URI

#ifdef USE_VIDEOPLAYERUTILITY
    TRAP(retVal, mVideoPlayUtil =
             CVideoPlayerUtility2::NewL( *this,
                                         EMdaPriorityNormal,
                                         EMdaPriorityPreferenceTimeAndQuality)
        );
    mActiveSchedulerWait = new CActiveSchedulerWait;
#endif

    return retVal;
}
Ejemplo n.º 7
0
TInt XARadioSessionImpl::SetFrequency(TInt aFreq)
{
    TRACE_FUNCTION_ENTRY;

    TRACE_LOG((_L("XARadioSessionImpl::SetFrequency: Setting Frequency to: %d"), aFreq));
    XAresult res = (*iRadioItf)->SetFrequency(iRadioItf, aFreq );
    RET_ERR_IF_ERR(CheckErr(res));

    TRACE_FUNCTION_EXIT;
    return res;
}
Ejemplo n.º 8
0
TInt XARadioSessionImpl::GetFrequencyRangeProperties(TInt range, TInt &minFreq, TInt &maxFreq)
{
    TRACE_FUNCTION_ENTRY;
    XAuint32 freqInterval = 0;
    XAresult res = (*iRadioItf)->GetFreqRangeProperties(iRadioItf, (XAuint8)range, (XAuint32*)&minFreq,(XAuint32*)&maxFreq, (XAuint32*)&freqInterval);
    RET_ERR_IF_ERR(CheckErr(res));
    TRACE_LOG((_L("XARadioSessionImpl::GetFrequencyRangeProperties: minFreq = %d, maxFreq = %d"), minFreq, maxFreq));

    TRACE_FUNCTION_EXIT;
    return res;
}
Ejemplo n.º 9
0
TInt XAPlaySessionImpl::setupMetaData()
{
    XAresult res;
    if(mMetadataExtItf) {
        XAuint32 numItems = 0;
        res = (*mMetadataExtItf)->GetItemCount(mMetadataExtItf, &numItems);
        RET_ERR_IF_ERR(mapError(res, ETrue));

        for(int i=0; i<numItems; ++i) {
            XAuint32 keySize;
            res = (*mMetadataExtItf)->GetKeySize(mMetadataExtItf, i, &keySize);
            RET_ERR_IF_ERR(mapError(res, ETrue));

            XAMetadataInfo *key = (XAMetadataInfo *)calloc(keySize,1);
            if(key) {
                res = (*mMetadataExtItf)->GetKey(mMetadataExtItf, i, keySize, key);
                RET_ERR_IF_ERR(mapError(res, ETrue));

                if(key->encoding == XA_CHARACTERENCODING_ASCII) { //only handle ASCII keys ignore others
                    QtMultimediaKit::MetaData qtKey;
                    if(mapMetaDataKey((const char*)key->data, qtKey) == KErrNone)//qt metadata
                        keyMap[qtKey] = i;
                    else //extended metadata
                        extendedKeyMap[(const char*)key->data] = i;
                }

                free(key);
            }
        }

        //check for seek property to generate seekable signal
        QVariant var = extendedMetaData("Seekable");
        if(!var.isValid() || (var.toString() == "1"))
            mParent.cbSeekableChanged(ETrue);
        else
            mParent.cbSeekableChanged(EFalse);

    }

    return KErrGeneral;
}
Ejemplo n.º 10
0
TInt XARadioSessionImpl::GetFrequencyRange()
{
    TRACE_FUNCTION_ENTRY;
    XAuint8 range = 0;

    XAresult res = (*iRadioItf)->GetFreqRange(iRadioItf, &range);
    RET_ERR_IF_ERR(CheckErr(res));
    TRACE_LOG((_L("XARadioSessionImpl::GetFrequencyRange: Frequency Range = %d"), range));

    TRACE_FUNCTION_EXIT;
    return (int)range;
}
Ejemplo n.º 11
0
TInt XARadioSessionImpl::GetFrequency()
{
    TRACE_FUNCTION_ENTRY;

    XAuint32 freq = 0;
    XAresult res = (*iRadioItf)->GetFrequency(iRadioItf, &freq );
    RET_ERR_IF_ERR(CheckErr(res));
    TRACE_LOG((_L("XARadioSessionImpl::GetFrequency: Frequency = %d"), freq));

    TRACE_FUNCTION_EXIT;
    return (int)freq;
}
TInt COpenMAXALTestModule::al_radioitf_GetFreqRangeProperties( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TInt range;
    status = aItem.GetNextInt(range);
    RET_ERR_IF_ERR(status);
    TInt expectedMinFreq;
    status = aItem.GetNextInt(expectedMinFreq);
    RET_ERR_IF_ERR(status);
    TInt expectedMaxFreq;
    status = aItem.GetNextInt(expectedMaxFreq);
    RET_ERR_IF_ERR(status);
    TInt expectedFreqInterval;
    status = aItem.GetNextInt(expectedFreqInterval);
    RET_ERR_IF_ERR(status);

    XAuint32 minFreq;
    XAuint32 maxFreq;
    XAuint32 freqInterval;

    if (m_RadioItf)
        {
        status = (*m_RadioItf)->GetFreqRangeProperties(
                m_RadioItf, range, &minFreq, &maxFreq, &freqInterval);
        if (!status)
            {
            /* If duration does not fall between the range we expected fail the case */
            if ( ( minFreq != (XAuint32)expectedMinFreq) || (maxFreq != (XAuint32)expectedMaxFreq) || (freqInterval != (XAuint32)expectedFreqInterval) )
                {
                status = KErrCompletion;
                }
            }
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
Ejemplo n.º 13
0
TInt XAPlaySessionImpl::seek(TInt64 pos)
{
    TInt retVal(KErrGeneral);
    XAresult xaRes;

    if (!mMOPlayer || !mSeekItf)
        return retVal;

    xaRes = (*mSeekItf)->SetPosition(mSeekItf, (XAmillisecond)pos, XA_SEEKMODE_FAST);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);
    mCurPosition = pos;

    return retVal;
}
TInt COpenMAXALTestModule::al_radioitf_GetNumberOfPresets( CStifItemParser& /*aItem*/)
    {
    TInt status(KErrNone);
    RET_ERR_IF_ERR(status);
    XAuint32 num;

    if (m_RadioItf)
        {
        status = (*m_RadioItf)->GetNumberOfPresets(
                m_RadioItf, &num);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_Seek( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TBool upwards;
    status = aItem.GetNextInt(upwards);
    RET_ERR_IF_ERR(status);

    if(m_RadioItf)
        {
        status = (*m_RadioItf)->Seek(
                m_RadioItf, upwards);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_SetStereoMode( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TInt stereoMode;
    status = aItem.GetNextInt(stereoMode);
    RET_ERR_IF_ERR(status);

    if(m_RadioItf)
        {
        status = (*m_RadioItf)->SetStereoMode(
                m_RadioItf, (XAuint32)stereoMode);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_SetFreqRange( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TInt freqRange(0);
    status = aItem.GetNextInt(freqRange);
    RET_ERR_IF_ERR(status);

    if(m_RadioItf)
        {
        status = (*m_RadioItf)->SetFreqRange(
                m_RadioItf, freqRange);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_SetFrequency( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    TInt freq;
    status = aItem.GetNextInt(freq);
    RET_ERR_IF_ERR(status);
    if (m_RadioItf)
        {
        status = (*m_RadioItf)->SetFrequency(
                m_RadioItf, freq);
        if (status != KErrNone)
            status = KErrCompletion;
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_SetPreset( CStifItemParser& aItem)
    {
    TInt status(KErrNone);
    TInt preset;
    status = aItem.GetNextInt(preset);
    RET_ERR_IF_ERR(status);
    XAuint32 presetVal = preset;
    XAuint32 freq = 0;
    XAuint8 range = 0;
    XAuint32 mode = 0;

    if (m_RadioItf)
        {
        status = (*m_RadioItf)->SetPreset(m_RadioItf, presetVal, freq, range, mode, 0);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
TInt COpenMAXALTestModule::al_radioitf_GetPreset( CStifItemParser& aItem)
    {
    TInt status(KErrNone);
    TInt presetToGet;
    status = aItem.GetNextInt(presetToGet);
    RET_ERR_IF_ERR(status); 
    XAuint32 preset = presetToGet;
    XAuint32 freq = 0;
    XAuint8 range = 0;
    XAuint32 mode = 0;
    XAuint16 nameLength = 0;

    if (m_RadioItf)
        {
        status = (*m_RadioItf)->GetPreset(m_RadioItf, preset, &freq, &range, &mode, 0, &nameLength);
        }
    else
        {
        status = KErrNotFound;
        }
    return status;
    }
// ---------------------------------------------------------------------------
// Called by framework forwarding request to create a custom interface
// ---------------------------------------------------------------------------
//
TInt CCIPlatformFactoryPlugin::CreateInterface( TUid aUid, TAny*& aInterface )
    {
    DEB_TRACE1(_L("*CI* CCIPlatformFactoryPlugin::CreateInterface 0x%x"), aUid.iUid);

    TInt status(KErrNone);
    aInterface = NULL;
    CCustomInterfaceUtility* ccInterfaceUtil = NULL;
    TRAP(status, ccInterfaceUtil = CCustomInterfaceUtility::NewL( *iMCustomCommand ));
    DEB_TRACE1(_L("*CI* CCIPlatformFactoryPlugin::CreateInterface status = %d"), status);

    RET_ERR_IF_ERR(status);

    // If custom interface is created, the ownership of ccInterfaceUtil
    // is automatically
    aInterface = ccInterfaceUtil->CustomInterface(aUid);
    if ( aInterface == NULL )
        {
        delete ccInterfaceUtil;
        status = KErrNotFound;
        }

    return status;
    }
Ejemplo n.º 22
0
TInt XAPlaySessionImpl::load(const TDesC& aURI)
{
    TInt retVal;
    XAresult xaRes;
    XAEngineItf engineItf;
    XADynamicSourceItf dynamicSourceItf;
    XAboolean required[MAX_NUMBER_INTERFACES];
    XAInterfaceID iidArray[MAX_NUMBER_INTERFACES];
    XAuint32 noOfInterfaces = 0;
    TInt i;

    XAmillisecond dur(0);
    TPtr8 uriPtr(0,0,0);
    TPtr8 mimeTypePtr(0,0,0);

#ifdef USE_VIDEOPLAYERUTILITY
    TRAP(m_VPError, mVideoPlayUtil->OpenFileL(_L("C:\\data\\test.3gp")));
    if (m_VPError)
        return 0;

    if(!mActiveSchedulerWait->IsStarted())
        mActiveSchedulerWait->Start();

    if (m_VPError)
        return 0;

    mVideoPlayUtil->Prepare();

    if(!mActiveSchedulerWait->IsStarted())
        mActiveSchedulerWait->Start();

    return 0;
#endif

    delete mURIName;
    mURIName = NULL;
    TRAP(retVal, mURIName = HBufC8::NewL(aURI.Length()+1));
    RET_ERR_IF_ERR(retVal);
    uriPtr.Set(mURIName->Des());

    // This has to be done here since we can not destroy the Player
    // in the Resource Lost callback.
    if (mbMediaPlayerUnrealized) {
        if (mMOPlayer) {
            (*mMOPlayer)->Destroy(mMOPlayer);
            mMOPlayer = NULL;
        }
    }

    //py uri name into local variable
    //TODO fix copy issue from 16 bit to 8 bit
    uriPtr.Copy(aURI);

    //If media player object already exists, just switch source
    //using dynamic source interface
    if (mMOPlayer && mPlayItf) {
        dynamicSourceItf = NULL;
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_DYNAMICSOURCE, &dynamicSourceItf);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        //Setup the data source
        //TODO Hard coded locator type
        mUri.locatorType = XA_DATALOCATOR_URI;

        //append zero terminator to end of URI
        mUri.URI = (XAchar*) uriPtr.PtrZ();

        //TODO Hard coded locator type
        mMime.containerType = XA_CONTAINERTYPE_WAV;

        //TODO Hard coded locator type
        mMime.formatType = XA_DATAFORMAT_MIME;
        mimeTypePtr.Set(mWAVMime->Des());
        mMime.mimeType = (XAchar*)mimeTypePtr.Ptr();
        mDataSource.pFormat = (void*)&mMime;
        mDataSource.pLocator = (void*)&mUri;

        xaRes = (*dynamicSourceItf)->SetSource(dynamicSourceItf, &mDataSource);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);
    }
    else { // Create media player object

        // Setup the data source
        // TODO Hard coded locator type
        mUri.locatorType = XA_DATALOCATOR_URI;

        //append zero terminator to end of URI
        mUri.URI = (XAchar*) uriPtr.PtrZ();

        //TODO Hard coded locator type
        mMime.containerType = XA_CONTAINERTYPE_WAV;

        //TODO Hard coded locator type
        mMime.formatType = XA_DATAFORMAT_MIME;
        mimeTypePtr.Set(mWAVMime->Des());
        mMime.mimeType = (XAchar*)mimeTypePtr.Ptr();
        mDataSource.pFormat = (void*)&mMime;
        mDataSource.pLocator = (void*)&mUri;

        //Setup the audio data sink
        mLocatorOutputDevice.locatorType = XA_DATALOCATOR_IODEVICE;
        mLocatorOutputDevice.deviceType = 6;
        mAudioSink.pLocator = (void*) &mLocatorOutputDevice;
        mAudioSink.pFormat = NULL;

        //Init arrays required[] and iidArray[]
        for (i = 0; i < MAX_NUMBER_INTERFACES; i++) {
            required[i] = XA_BOOLEAN_FALSE;
            iidArray[i] = XA_IID_NULL;
        }

        noOfInterfaces = 0;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_SEEK;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_DYNAMICSOURCE;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_METADATAEXTRACTION;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_NOKIALINEARVOLUME;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_NOKIAVOLUMEEXT;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_PREFETCHSTATUS;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_STREAMINFORMATION;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_PLAYBACKRATE;
        noOfInterfaces++;
        required[noOfInterfaces] = XA_BOOLEAN_FALSE;
        iidArray[noOfInterfaces] = XA_IID_VIDEOPOSTPROCESSING;
        noOfInterfaces++;

        xaRes = (*mEOEngine)->GetInterface(mEOEngine, XA_IID_ENGINE, (void**) &engineItf);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*engineItf)->CreateMediaPlayer(engineItf,
                                                &mMOPlayer,
                                                &mDataSource,
                                                NULL,
                                                &mAudioSink,
                                                &mVideoSink,
                                                NULL,
                                                NULL,
                                                noOfInterfaces,
                                                iidArray,
                                                required);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mMOPlayer)->Realize(mMOPlayer, XA_BOOLEAN_FALSE);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        mbMediaPlayerUnrealized = FALSE;

        xaRes = (*mMOPlayer)->RegisterCallback(mMOPlayer, MediaPlayerCallback, (void*)this);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PLAY, &mPlayItf);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mPlayItf)->RegisterCallback(mPlayItf, PlayItfCallback, (void*)this);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mPlayItf)->SetPositionUpdatePeriod(mPlayItf, (XAmillisecond)KPlayPosUpdatePeriod);
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mPlayItf)->SetCallbackEventsMask(    mPlayItf,
                ( XA_PLAYEVENT_HEADATEND |
                  XA_PLAYEVENT_HEADATNEWPOS |
                  XA_PLAYEVENT_HEADMOVING )
                                                  );
        retVal = mapError(xaRes, ETrue);
        RET_ERR_IF_ERR(retVal);

        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_SEEK, &mSeekItf);
        retVal = mapError(xaRes, ETrue);

        //Metadata
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_METADATAEXTRACTION, &mMetadataExtItf);
        if(mapError(xaRes, ETrue)==KErrNone) {
            mbMetadataAvailable = ETrue;
            setupALKeyMap(); //done only once at creation of meadia player
        }

        //volume
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_NOKIALINEARVOLUME, &mNokiaLinearVolumeItf);
        if(mapError(xaRes, ETrue)==KErrNone)
            mbVolEnabled = ETrue;

        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_NOKIAVOLUMEEXT, &mNokiaVolumeExtItf);
        if(mapError(xaRes, ETrue)==KErrNone)
            mbMuteEnabled = ETrue;

        //buffer status
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PREFETCHSTATUS, &mPrefetchStatusItf);
        if(mapError(xaRes, ETrue)==KErrNone) {
            mbPrefetchStatusChange = ETrue;
            (*mPrefetchStatusItf)->RegisterCallback(mPrefetchStatusItf, PrefetchItfCallback, (void*)this);
            (*mPrefetchStatusItf)->SetCallbackEventsMask(mPrefetchStatusItf, XA_PREFETCHEVENT_FILLLEVELCHANGE);
        }

        //stream information
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_STREAMINFORMATION, &mStreamInformationItf);
        if(mapError(xaRes, ETrue)==KErrNone) {
            mbStreamInfoAvailable = ETrue;
            mParent.cbStreamInformation(ETrue); //indicate first time
            (*mStreamInformationItf)->RegisterStreamChangeCallback(mStreamInformationItf, StreamInformationItfCallback, (void*)this);
        }

        //playback rate
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_PLAYBACKRATE, &mPlaybackRateItf);
        if(mapError(xaRes, ETrue)==KErrNone)
            mbPlaybackRateItfAvailable = ETrue;


        //videopostprocessing
        xaRes = (*mMOPlayer)->GetInterface(mMOPlayer, XA_IID_VIDEOPOSTPROCESSING, &mVideoPostProcessingItf);
        if(mapError(xaRes, ETrue)==KErrNone)
            mbScalable = ETrue;

    }

    if(mbMetadataAvailable) {
        keyMap.clear();
        extendedKeyMap.clear();
        setupMetaData(); //done every time source is changed
    }
    else { //send signal for seekable
        mParent.cbSeekableChanged(ETrue);
    }

    mCurPosition = 0;
    mParent.cbPositionChanged(mCurPosition);

    xaRes = (*mPlayItf)->GetDuration(mPlayItf, &dur);
    retVal = mapError(xaRes, ETrue);
    RET_ERR_IF_ERR(retVal);

    mDuration = dur;
    mParent.cbDurationChanged(mDuration);

    return retVal;
}
TInt COpenMAXALTestModule::al_CreateWindow( CStifItemParser& aItem )
    {
    TInt status(KErrNone);
    if (iRwSession.Handle())
        User::Leave(KErrAlreadyExists);

    TInt topX;
    TInt topY ;
    TInt bottomX;
    TInt bottomY;
    TInt posX;
    TInt posY;

    status = aItem.GetNextInt(posX);
    RET_ERR_IF_ERR(status);
    status = aItem.GetNextInt(posY);
    RET_ERR_IF_ERR(status);

    status = aItem.GetNextInt(topX);
    RET_ERR_IF_ERR(status);
    status = aItem.GetNextInt(topY);
    RET_ERR_IF_ERR(status);
    status = aItem.GetNextInt(bottomX);
    RET_ERR_IF_ERR(status);
    status = aItem.GetNextInt(bottomY);
    RET_ERR_IF_ERR(status);

    /* Create resources needed for video play back*/
    status = iRwSession.Connect();
    RET_ERR_IF_ERR(status);

    TInt groupId = iRwSession.GetFocusWindowGroup();
    iRwGroup = RWindowGroup(iRwSession);
    status = iRwGroup.Construct(groupId, ETrue);
    RET_ERR_IF_ERR(status);
    _LIT(KXASTIFWindowGroupName,"XASTIF");
    iRwGroup.SetName(KXASTIFWindowGroupName);
    iRwGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);

    iRWindow = RWindow(iRwSession);
    status = iRWindow.Construct(iRwGroup, (TUint32) this + 1);
    RET_ERR_IF_ERR(status);

    TPoint point(posX, posY);
    iRWindow.SetPosition(point);
    TRect rect(topX, topY, bottomX, bottomY);
    TSize size(rect.Size());
    iRWindow.SetSize(size);
    iRWindow.Activate();
    iRWindow.SetVisible(ETrue);
    iRwSession.Flush();
    iDevice = NULL;
    iDevice = new CWsScreenDevice(iRwSession);
    if (!iDevice)
        {
        status = KErrNoMemory;
        }
    RET_ERR_IF_ERR(status);

    status = iDevice->Construct(0);
    return status;
    }
Ejemplo n.º 24
0
TInt XARadioSessionImpl::CreateEngine()
{
    TRACE_FUNCTION_ENTRY;
    XAboolean required[MAX_NUMBER_INTERFACES];
    XAInterfaceID iidArray[MAX_NUMBER_INTERFACES];
    XAuint32 noOfInterfaces = 0;
    int i;
    XAresult res;

    XAEngineOption EngineOption[] =
    {
        {
        (XAuint32) XA_ENGINEOPTION_THREADSAFE,
        (XAuint32) XA_BOOLEAN_TRUE
        }
    };

    /* Create XA engine */
    if (!iEngine) {
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Engine...")));
        res = xaCreateEngine(&iEngine, 1, EngineOption, 0, NULL, NULL);
        RET_ERR_IF_ERR(CheckErr(res));
        res = (*iEngine)->RegisterCallback(iEngine, EngineObjectCallback, NULL);
        RET_ERR_IF_ERR(CheckErr(res));

        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realizing...")));
        res = (*iEngine)->Realize(iEngine, XA_BOOLEAN_FALSE);
        RET_ERR_IF_ERR(CheckErr(res));

        // Create Engine Interface:
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Engine Interface")));
        RET_ERR_IF_ERR(CheckErr((*iEngine)->GetInterface(iEngine, XA_IID_ENGINE, (void*)&iEngineItf)));

        // Create Radio Device and interface(s):
        if (!iRadio) {
            TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Creating Radio Device")));
            res = (*iEngineItf)->CreateRadioDevice(iEngineItf,&iRadio, 0, NULL, NULL);
            RET_ERR_IF_ERR(CheckErr(res));

            TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realize Radio Device")));
            res = (*iRadio)->Realize(iRadio, XA_BOOLEAN_FALSE);
            RET_ERR_IF_ERR(CheckErr(res));

            // Get Radio interface:
            TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get Radio Interface")));
            res = (*iRadio)->GetInterface(iRadio, XA_IID_RADIO, (void*)&iRadioItf);
            RET_ERR_IF_ERR(CheckErr(res));
            iRadioAvailable = ETrue;
            // Register Radio Callback:
            TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create Radio Callback:")));
            res = (*iRadioItf)->RegisterRadioCallback(iRadioItf, RadioCallback, (void*)this);
            RET_ERR_IF_ERR(CheckErr(res));
        }
        XADataSource            audioSource;
        XADataLocator_IODevice  locatorIODevice;
        XADataSink              audioSink;
        XADataLocator_OutputMix locator_outputmix;

        /* Init arrays required[] and iidArray[] */
        for (i = 0; i < MAX_NUMBER_INTERFACES; i++) {
            required[i] = XA_BOOLEAN_FALSE;
            iidArray[i] = XA_IID_NULL;
        }

        iidArray[0] = XA_IID_NOKIAVOLUMEEXT;
        iidArray[1] = XA_IID_NOKIALINEARVOLUME;
        noOfInterfaces = 2;

        locatorIODevice.locatorType = XA_DATALOCATOR_IODEVICE;
        locatorIODevice.deviceType  = XA_IODEVICE_RADIO;
        locatorIODevice.deviceID    = 0; /* ignored */
        locatorIODevice.device      = iRadio;
        audioSource.pLocator        = (void*) &locatorIODevice;
        audioSource.pFormat         = NULL;

        /* Setup the data sink structure */
        locator_outputmix.locatorType = XA_DEFAULTDEVICEID_AUDIOOUTPUT;
        locator_outputmix.outputMix   = NULL;
        audioSink.pLocator            = (void*) &locator_outputmix;
        audioSink.pFormat             = NULL;

        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create Media Player:")));
        res = (*iEngineItf)->CreateMediaPlayer(iEngineItf, &iPlayer, &audioSource, NULL, &audioSink, NULL, NULL, NULL, noOfInterfaces, iidArray, required);
        RET_ERR_IF_ERR(CheckErr(res));

        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Realize Media Player:")));
        res = (*iPlayer)->Realize(iPlayer, XA_BOOLEAN_FALSE);
        RET_ERR_IF_ERR(CheckErr(res));
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get Play Interface from player:")));
        res = (*iPlayer)->GetInterface(iPlayer, XA_IID_PLAY, (void*) &iPlayItf);
        RET_ERR_IF_ERR(CheckErr(res));
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create PlayItf Callback:")));
        res = (*iPlayItf)->RegisterCallback(iPlayItf, PlayItfCallbackForRadio, (void*)this);
        RET_ERR_IF_ERR(CheckErr(res));

        // Get Volume Interfaces specific for Nokia impl:
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get NokiaVolumeExt Interface")));
        res = (*iPlayer)->GetInterface(iPlayer, XA_IID_NOKIAVOLUMEEXT, (void*)&iNokiaVolumeExtItf);
        RET_ERR_IF_ERR(CheckErr(res));

        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Get NokiaLinearVolume Interface")));
        res = (*iPlayer)->GetInterface(iPlayer, XA_IID_NOKIALINEARVOLUME, (void*)&iNokiaLinearVolumeItf);
        RET_ERR_IF_ERR(CheckErr(res));

        // Register Volume Callbacks:
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create NokiaVolumeExtItf Callback:")));
        res = (*iNokiaVolumeExtItf)->RegisterVolumeCallback(iNokiaVolumeExtItf, NokiaVolumeExtItfCallback, (void*)this);
        RET_ERR_IF_ERR(CheckErr(res));
        res = (*iNokiaVolumeExtItf)->SetCallbackEventsMask(iNokiaVolumeExtItf,(XA_NOKIAVOLUMEEXT_EVENT_MUTE_CHANGED));
        RET_ERR_IF_ERR(CheckErr(res));
        TRACE_LOG((_L("XARadioSessionImpl::CreateEngine: Create NokiaLinearVolumeItf Callback:")));
        res = (*iNokiaLinearVolumeItf)->RegisterVolumeCallback(iNokiaLinearVolumeItf, NokiaLinearVolumeItfCallback, (void*)this);
        RET_ERR_IF_ERR(CheckErr(res));
        res = (*iNokiaLinearVolumeItf)->SetCallbackEventsMask(iNokiaLinearVolumeItf,(XA_NOKIALINEARVOLUME_EVENT_VOLUME_CHANGED));
        RET_ERR_IF_ERR(CheckErr(res));
    }

    TRACE_FUNCTION_EXIT;
    return EFalse;
}