コード例 #1
0
// create the engine and output mix objects
JNICALL void JNIEXPORT Java_my_exercise_videoprocess_VideoFrameUnit_createEngine(JNIEnv* env, jclass clazz)
{
    XAresult res;

    // create engine
    res = xaCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);

    // realize the engine
    res = (*engineObject)->Realize(engineObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);

    // get the engine interface, which is needed in order to create other objects
    res = (*engineObject)->GetInterface(engineObject, XA_IID_ENGINE, &engineEngine);
    assert(XA_RESULT_SUCCESS == res);

    // create output mix
    res = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);

    // realize the output mix
    res = (*outputMixObject)->Realize(outputMixObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);

}
コード例 #2
0
// create the engine and output mix objects
void Java_com_example_nativemedia_NativeMedia_createEngine(JNIEnv* env, jclass clazz)
{
    XAresult res;

    // create engine
    res = xaCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);

    // realize the engine
    res = (*engineObject)->Realize(engineObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);

    // get the engine interface, which is needed in order to create other objects
    res = (*engineObject)->GetInterface(engineObject, XA_IID_ENGINE, &engineEngine);
    assert(XA_RESULT_SUCCESS == res);

    // create output mix
    res = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);

    // realize the output mix
    res = (*outputMixObject)->Realize(outputMixObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);

}
コード例 #3
0
ファイル: native-media-jni.cpp プロジェクト: Volcanoscar/note
JNIEXPORT void JNICALL Java_org_apache_cordova_example_VideoPlayer_createEngine(JNIEnv* env,
		jclass clazz) {
	finished = 0;	
	clear();
	XAresult res;
	// create engine
	res = xaCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
	assert(XA_RESULT_SUCCESS == res);
	// realize the engine
	res = (*engineObject)->Realize(engineObject, XA_BOOLEAN_FALSE);
	assert(XA_RESULT_SUCCESS == res);
	// get the engine interface, which is needed in order to create other objects
	res = (*engineObject)->GetInterface(engineObject, XA_IID_ENGINE,
			&engineEngine);
	assert(XA_RESULT_SUCCESS == res);

	// create output mix
	res = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0,
			NULL, NULL);
	assert(XA_RESULT_SUCCESS == res);

	// realize the output mix
	res = (*outputMixObject)->Realize(outputMixObject, XA_BOOLEAN_FALSE);
	assert(XA_RESULT_SUCCESS == res);
	LOGE("engine done");
}
コード例 #4
0
 /* Test setup*/
 virtual void SetUp() {
     ALOGV("Test Setup()");
     res = XA_RESULT_UNKNOWN_ERROR;
     engineItf = NULL;
     engineObj = NULL;
     outputMixObj = NULL;
     mediaPlayerObj = NULL;
     // Engine creation
     res = xaCreateEngine(&engineObj, 0, NULL, 0, NULL, NULL);
     ASSERT_TRUE(IsOk(res));
     res = (*engineObj)->Realize(engineObj, XA_BOOLEAN_FALSE);
     ASSERT_TRUE(IsOk(res));
     res = (*engineObj)->GetInterface(engineObj, XA_IID_ENGINE, &engineItf);
     ASSERT_TRUE(IsOk(res));
     ASSERT_TRUE(NULL != engineItf);
 }
コード例 #5
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;
}
コード例 #6
0
//-----------------------------------------------------------------
void TestVideoDecoderCapabilities() {

    XAObjectItf xa;
    XAresult res;

    /* parameters for the OpenMAX AL engine creation */
    XAEngineOption EngineOption[] = {
            {(XAuint32) XA_ENGINEOPTION_THREADSAFE, (XAuint32) XA_BOOLEAN_TRUE}
    };
    XAInterfaceID itfIidArray[NUM_ENGINE_INTERFACES] = { XA_IID_VIDEODECODERCAPABILITIES };
    XAboolean     itfRequired[NUM_ENGINE_INTERFACES] = { XA_BOOLEAN_TRUE };

    /* create OpenMAX AL engine */
    res = xaCreateEngine( &xa, 1, EngineOption, NUM_ENGINE_INTERFACES, itfIidArray, itfRequired);
    ExitOnError(res);

    /* realize the engine in synchronous mode. */
    res = (*xa)->Realize(xa, XA_BOOLEAN_FALSE); ExitOnError(res);

    /* Get the video decoder capabilities interface which was explicitly requested */
    XAVideoDecoderCapabilitiesItf decItf;
    res = (*xa)->GetInterface(xa, XA_IID_VIDEODECODERCAPABILITIES, (void*)&decItf);
    ExitOnError(res);

    /* Query the platform capabilities */
    XAuint32 numDecoders = 0;
    XAuint32 *decoderIds = NULL;

    /* -> Number of decoders */
    res = (*decItf)->GetVideoDecoders(decItf, &numDecoders, NULL); ExitOnError(res);
    fprintf(stdout, "Found %d video decoders\n", numDecoders);
    if (0 == numDecoders) {
        fprintf(stderr, "0 video decoders is not an acceptable number, exiting\n");
        goto destroyRes;
    }

    /* -> Decoder list */
    decoderIds = (XAuint32 *) malloc(numDecoders * sizeof(XAuint32));
    res = (*decItf)->GetVideoDecoders(decItf, &numDecoders, decoderIds); ExitOnError(res);
    fprintf(stdout, "Decoders:\n");
    for(XAuint32 i = 0 ; i < numDecoders ; i++) {
        fprintf(stdout, "decoder %d is %s\n", i, videoCodecIdToString(decoderIds[i]));
    }

    /* -> Decoder capabilities */
    /*       for each decoder  */
    for(XAuint32 i = 0 ; i < numDecoders ; i++) {
        XAuint32 nbCombinations = 0;
        /* get the number of profile / level combinations */
        res = (*decItf)->GetVideoDecoderCapabilities(decItf, decoderIds[i], &nbCombinations, NULL);
        ExitOnError(res);
        fprintf(stdout, "decoder %s has %d profile/level combinations:\n\t",
                videoCodecIdToString(decoderIds[i]), nbCombinations);
        /* display the profile / level combinations */
        for(XAuint32 pl = 0 ; pl < nbCombinations ; pl++) {
            XAVideoCodecDescriptor decDescriptor;
            XAuint32 decoder = decoderIds[i];
            res = (*decItf)->GetVideoDecoderCapabilities(decItf, decoder, &pl, &decDescriptor);
            ExitOnError(res);
            XAuint32 profile = decDescriptor.profileSetting;
            XAuint32 level = decDescriptor.levelSetting;
            fprintf(stdout, "%u/%u ", profile, level);
            ExitOnError(res);
            printf("(%s/%s) ", videoProfileToString(decoder, profile),
                    videoLevelToString(decoder, level));
        }
        fprintf(stdout, "\n");
    }

destroyRes:
    free(decoderIds);

    /* shutdown OpenMAX AL */
    (*xa)->Destroy(xa);
}
コード例 #7
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;
}
コード例 #8
0
AndroidVideoDecoder::AndroidVideoDecoder(RectGUI* rect, std::string path){
    
	textureRect = NULL;
	textureID = (GLuint)NULL;
	originalWidth = 0.0;
	originalHeight = 0.0;
	originalTop = 0.0;
	originalLeft = 0.0;
	engineObject = NULL;
	engineEngine = NULL;
	outputMixObject = NULL;
	playerObj = NULL;
	playerPlayItf = NULL;
	playerBQItf = NULL;
	playerStreamInfoItf = NULL;
	playerVolItf = NULL;
	theNativeWindow = NULL;
	file = NULL;
	discontinuity = false;
	reachedEof = false;
    
	ended = false;
	sourcePath = path;
	glGenTextures(1, &textureID);
	glBindTexture(GL_TEXTURE_EXTERNAL_OES, textureID);
	glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
	glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
	glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
    
	theNativeWindow = getANativeWindow(textureID);//texture->getTextureId());
    
	textureRect = rect;
	originalWidth = rect->getWidth();
	originalHeight = rect->getHeight();
	originalLeft = rect->getLeft();
	originalTop = rect->getTop();
    
	Shader* shader = new VideoPlaneShader();
	rect->setShader(shader);
	rect->setTexture(TextureManager::getInstance()->getTexture("blueSquare.png"));
	rect->setTexture(textureID);
    
    XAresult res;
    
    // create engine
    res = xaCreateEngine(&engineObject, 0, NULL, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);
    
    // realize the engine
    res = (*engineObject)->Realize(engineObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);
    
    // get the engine interface, which is needed in order to create other objects
    res = (*engineObject)->GetInterface(engineObject, XA_IID_ENGINE, &engineEngine);
    assert(XA_RESULT_SUCCESS == res);
    
    // create output mix
    res = (*engineEngine)->CreateOutputMix(engineEngine, &outputMixObject, 0, NULL, NULL);
    assert(XA_RESULT_SUCCESS == res);
    
    // realize the output mix
    res = (*outputMixObject)->Realize(outputMixObject, XA_BOOLEAN_FALSE);
    assert(XA_RESULT_SUCCESS == res);
    
    createStreamingMediaPlayer();
    setPlayingStreamingMediaPlayer();
    logInf("setted all stuff from openmax");
	this->stop();  // We force the head to stay at the start of the video (pause will not suffice)
    
	textureRect->setTexture(textureID);
    
	instanceDecoder = this;
    
	res = (*playerPlayItf)->RegisterCallback(playerPlayItf, endCallbackDecoder, NULL);
	assert(XA_RESULT_SUCCESS == res);
    
	res = (*playerPlayItf)->SetCallbackEventsMask(playerPlayItf, XA_PLAYEVENT_HEADATEND);
	assert(XA_RESULT_SUCCESS == res);
}