Exemplo n.º 1
0
    void play()
    {
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env || !m_url.length())
            return;

        createJavaPlayerIfNeeded();

        if (!m_glue->m_javaProxy)
            return;

        m_paused = false;
        m_player->playbackStateChanged();
        env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play);
        checkException(env);
    }
Exemplo n.º 2
0
void JavaBridge::UpdatePluginDirectories(JNIEnv* env, jobject obj,
        jobjectArray array, jboolean reload) {
    WTF::Vector<WTF::String> directories;
    int count = env->GetArrayLength(array);
    for (int i = 0; i < count; i++) {
        jstring dir = (jstring) env->GetObjectArrayElement(array, i);
        directories.append(jstringToWtfString(env, dir));
        env->DeleteLocalRef(dir);
    }
    checkException(env);
    WebCore::PluginDatabase *pluginDatabase =
            WebCore::PluginDatabase::installedPlugins();
    pluginDatabase->setPluginDirectories(directories);
    // refreshPlugins() should refresh both PluginDatabase and Page's PluginData
    WebCore::Page::refreshPlugins(reload);
}
    void load(const String& url) {
        m_url = url;
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env || !m_url.length())
            return;

        createJavaPlayerIfNeeded();

        if (!m_glue->m_javaProxy)
            return;

        jstring jUrl = env->NewString((unsigned short *)m_url.characters(), m_url.length());
        // start loading the data asynchronously
        env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_setDataSource, jUrl);
        env->DeleteLocalRef(jUrl);
        checkException(env);
    }
Exemplo n.º 4
0
inline void RefCountAllocator_oobj_handle_reference(RefCountAllocator rc,
						    struct oobj** oobj) {
  struct _jobject obj;
#ifdef RTJ_DEBUG
  printf("RefCountAllocator_oobj_handle_reference(%p, %p)\n", rc, *oobj);
#endif
  obj.obj = *oobj;
  RefCountAllocator_getRefCountInstance();
  if ((!(((ptroff_t)(*oobj))&1)) && refCountInstance &&
      ((FNI_UNWRAP_MASKED(FNI_GetObjectField(FNI_GetJNIEnv(), &obj, memoryAreaID)))
       == refCountInstance)) {
#ifdef RTJ_DEBUG
    checkException();
#endif
    RefCountAllocator_DECREF(rc, *oobj);
  }
}
ANativeWindow* MediaTexture::requestNativeWindowForVideo()
{
    android::Mutex::Autolock lock(m_mediaLock);

    // the window was not ready before the timeout so return it this time
    if (ANativeWindow* window = m_newWindow.get()) {
        m_newWindow.clear();
        return window;
    }

    // we only allow for so many textures, so return NULL if we exceed that limit
    else if (m_videoTextures.size() >= MAX_WINDOW_COUNT) {
        return 0;
    }

    m_newWindowRequest = true;

    // post an inval message to the UI thread to fulfill the request
    if (m_weakWebViewRef) {
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        jobject localWebViewRef = env->NewLocalRef(m_weakWebViewRef);
        if (localWebViewRef) {
            jclass wvClass = env->GetObjectClass(localWebViewRef);
            jmethodID postInvalMethod = env->GetMethodID(wvClass, "postInvalidate", "()V");
            env->CallVoidMethod(localWebViewRef, postInvalMethod);
            env->DeleteLocalRef(wvClass);
            env->DeleteLocalRef(localWebViewRef);
        }
        checkException(env);
    }

    //block until the request can be fulfilled or we time out
    bool timedOut = false;
    while (m_newWindowRequest && !timedOut) {
        int ret = m_newMediaRequestCond.waitRelative(m_mediaLock, 500000000); // .5 sec
        timedOut = ret == TIMED_OUT;
    }

    // if the window is ready then return it otherwise return NULL
    if (ANativeWindow* window = m_newWindow.get()) {
        m_newWindow.clear();
        return window;
    }
    return 0;
}
Exemplo n.º 6
0
WTF::Vector<WTF::String>JavaBridge::getSupportedKeyStrengthList() {
    WTF::Vector<WTF::String> list;
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    AutoJObject obj = javaObject(env);
    if (!obj.get())
        return list;
    jobjectArray array = (jobjectArray) env->CallObjectMethod(obj.get(),
            mGetKeyStrengthList);
    int count = env->GetArrayLength(array);
    for (int i = 0; i < count; ++i) {
        jstring keyStrength = (jstring) env->GetObjectArrayElement(array, i);
        list.append(jstringToWtfString(env, keyStrength));
        env->DeleteLocalRef(keyStrength);
    }
    env->DeleteLocalRef(array);
    checkException(env);
    return list;
}
Exemplo n.º 7
0
/* when title is changed, we need to rebuild available chapters */
void VLCMediaController::refreshChapters( int i_title )
{
    //current_chapter = Phonon::ChapterDescription();
    //available_chapters.clear();
    current_chapter = 0;
    available_chapters = 0;

    // give info about chapters for actual title
    libvlc_track_description_t *p_info = libvlc_video_get_chapter_description(
        p_vlc_media_player, i_title, p_vlc_exception );
    checkException();
    while( p_info )
    {
        chapterAdded( p_info->i_id, p_info->psz_name );
        p_info = p_info->p_next;
    }
    libvlc_track_description_release( p_info );
}
Exemplo n.º 8
0
WTF::Vector<WebCore::String>
JavaBridge::getPluginDirectories()
{
    WTF::Vector<WebCore::String> directories;
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    AutoJObject obj = getRealObject(env, mJavaObject);
    jobjectArray array = (jobjectArray)
                         env->CallObjectMethod(obj.get(), mGetPluginDirectories);
    int count = env->GetArrayLength(array);
    for (int i = 0; i < count; i++) {
        jstring dir = (jstring) env->GetObjectArrayElement(array, i);
        directories.append(to_string(env, dir));
        env->DeleteLocalRef(dir);
    }
    env->DeleteLocalRef(array);
    checkException(env);
    return directories;
}
    void play()
    {
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env || !m_url.length() || !m_glue->m_javaProxy)
            return;

        m_paused = false;
        m_player->playbackStateChanged();

        if (m_currentTime == duration())
            m_currentTime = 0;

        jstring jUrl = wtfStringToJstring(env, m_url);
        env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_play, jUrl,
                            static_cast<jint>(m_currentTime * 1000.0f),
                            m_videoLayer->uniqueId());
        env->DeleteLocalRef(jUrl);

        checkException(env);
    }
Exemplo n.º 10
0
    void createJavaPlayerIfNeeded()
    {
        // Check if we have been already created.
        if (m_glue->m_javaProxy)
            return;

        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env)
            return;

        jclass clazz = env->FindClass(g_ProxyJavaClass);

        if (!clazz)
            return;

        jobject obj = 0;

        FrameView* frameView = m_player->frameView();
        if (!frameView)
            return;
        AutoJObject javaObject = WebViewCore::getWebViewCore(frameView)->getJavaObject();
        if (!javaObject.get())
            return;

        // Get the HTML5VideoViewProxy instance
        obj = env->CallStaticObjectMethod(clazz, m_glue->m_getInstance, javaObject.get(), this);
        m_glue->m_javaProxy = env->NewGlobalRef(obj);
        // Send the poster
        jstring jUrl = 0;
        if (m_posterUrl.length())
            jUrl = wtfStringToJstring(env, m_posterUrl);
        // Sending a NULL jUrl allows the Java side to try to load the default poster.
        env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_loadPoster, jUrl);
        if (jUrl)
            env->DeleteLocalRef(jUrl);

        // Clean up.
        env->DeleteLocalRef(obj);
        env->DeleteLocalRef(clazz);
        checkException(env);
    }
Exemplo n.º 11
0
    //_______________________________________________________
    void ExceptionListWidget::add( void )
    {


        QPointer<ExceptionDialog> dialog = new ExceptionDialog( this );
        dialog->setWindowTitle( i18n( "New Exception - Menda Settings" ) );
        InternalSettingsPtr exception( new InternalSettings() );

        exception->load();

        dialog->setException( exception );

        // run dialog and check existence
        if( !dialog->exec() )
        {
            delete dialog;
            return;
        }

        dialog->save();
        delete dialog;

        // check exceptions
        if( !checkException( exception ) ) return;

        // create new item
        model().add( exception );
        setChanged( true );

        // make sure item is selected
        QModelIndex index( model().index( exception ) );
        if( index != m_ui.exceptionListView->selectionModel()->currentIndex() )
        {
            m_ui.exceptionListView->selectionModel()->select( index,  QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
            m_ui.exceptionListView->selectionModel()->setCurrentIndex( index,  QItemSelectionModel::Current|QItemSelectionModel::Rows );
        }

        resizeColumns();
        return;

    }
Exemplo n.º 12
0
/*
 * Class:     de_fraunhofer_fokus_ants_jipfix_jIPFIX
 * Method:    ipfixAddVendorInformationElements
 * Signature: ([Lde/fraunhofer/fokus/ants/jipfix/ipfixFieldType;)B
 */
JNIEXPORT jbyte JNICALL Java_de_fraunhofer_fokus_ants_jipfix_jIPFIX_ipfixAddVendorInformationElements(
        JNIEnv * env, jobject self, jobjectArray elements)
{
    jsize len = (*env)->GetArrayLength(env, elements);
    ipfix_field_type_t *ipfix_fts = calloc(len+1, sizeof(ipfix_field_type_t));
    int i;

    jclass classFT = (*env)->FindClass(env, "de/fraunhofer/fokus/ants/jipfix/data/IPFIXFieldType");
    jfieldID feno    = (*env)->GetFieldID(env, classFT, "eno", "I");
    jfieldID fftype  = (*env)->GetFieldID(env, classFT, "ftype", "I");
    jfieldID flength = (*env)->GetFieldID(env, classFT, "length", "I");
    jfieldID fcoding = (*env)->GetFieldID(env, classFT, "coding", "I");
    jfieldID fname   = (*env)->GetFieldID(env, classFT, "name", "Ljava/lang/String;");
    jfieldID fdoc    = (*env)->GetFieldID(env, classFT, "documentation", "Ljava/lang/String;");

    for (i=0; i<len; i++) {
        jobject element = (*env)->GetObjectArrayElement(env, elements,i);
        ipfix_fts[i].eno    = (*env)->GetIntField(env,element, feno);
        ipfix_fts[i].ftype  = (*env)->GetIntField(env,element, fftype);
        ipfix_fts[i].length = (*env)->GetIntField(env,element, flength);
        ipfix_fts[i].coding = (*env)->GetIntField(env,element, fcoding);

        jstring sname = (*env)->GetObjectField(env, element, fname);
        ipfix_fts[i].name = (char*)((*env)->GetStringUTFChars(env, sname, NULL));

        jstring sdoc = (*env)->GetObjectField(env, element, fdoc);
        ipfix_fts[i].documentation = (char*)((*env)->GetStringUTFChars(env, sdoc, NULL));
    }

    ipfix_fts[i].eno = 0;
    ipfix_fts[i].ftype = 0;
    ipfix_fts[i].length = 0;
    ipfix_fts[i].coding = 0;
    ipfix_fts[i].name = NULL;
    ipfix_fts[i].documentation = NULL;

    checkException(env);
    //return ipfix_add_vendor_information_elements( ipfix_ft_fokus );
    return ipfix_add_vendor_information_elements( ipfix_fts );
}
Exemplo n.º 13
0
    void enterFullscreenMode()
    {
        JNIEnv* env = JSC::Bindings::getJNIEnv();

        //CAPPFIX_WEB_HTML5FULLVIDEO_LINKAGE_TO_STREAMING_PLAYER_JB_PLUS_FIX2
        createJavaPlayerIfNeeded();

        if (!env || !m_url.length() || !m_glue->m_javaProxy){
            //CAPPFIX_WEB_HTML5FULLVIDEO_LINKAGE_TO_STREAMING_PLAYER_JB_PLUS_FIX2
            //CAPPFIX_WEB_HTML5FULLVIDEO_LINKAGE_TO_STREAMING_PLAYER_JB_PLUS_FIX1
            //m_should_enterFullscreen = true;
            return;
        }

        jstring jUrl = wtfStringToJstring(env, m_url);
        env->CallVoidMethod(m_glue->m_javaProxy,
                            m_glue->m_enterFullscreenForVideoLayer, jUrl,
                            m_videoLayer->uniqueId());
        env->DeleteLocalRef(jUrl);

        checkException(env);
    }
    MediaPlayerAudioPrivate(MediaPlayer* player) : MediaPlayerPrivate(player) {
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env)
            return;

        jclass clazz = env->FindClass(g_ProxyJavaClassAudio);

        if (!clazz)
            return;

        m_glue = new JavaGlue;
        m_glue->m_newInstance = env->GetMethodID(clazz, "<init>", "(I)V");
        m_glue->m_setDataSource = env->GetMethodID(clazz, "setDataSource", "(Ljava/lang/String;)V");
        m_glue->m_play = env->GetMethodID(clazz, "play", "()V");
        m_glue->m_getMaxTimeSeekable = env->GetMethodID(clazz, "getMaxTimeSeekable", "()F");
        m_glue->m_teardown = env->GetMethodID(clazz, "teardown", "()V");
        m_glue->m_seek = env->GetMethodID(clazz, "seek", "(I)V");
        m_glue->m_pause = env->GetMethodID(clazz, "pause", "()V");
        m_glue->m_javaProxy = NULL;
        env->DeleteLocalRef(clazz);
        // An exception is raised if any of the above fails.
        checkException(env);
    }
    MediaPlayerVideoPrivate(MediaPlayer* player) : MediaPlayerPrivate(player) {
        JNIEnv* env = JSC::Bindings::getJNIEnv();
        if (!env)
            return;

        jclass clazz = env->FindClass(g_ProxyJavaClass);

        if (!clazz)
            return;

        m_glue = new JavaGlue;
        m_glue->m_getInstance = env->GetStaticMethodID(clazz, "getInstance", "(Landroid/webkit/WebViewCore;I)Landroid/webkit/HTML5VideoViewProxy;");
        m_glue->m_loadPoster = env->GetMethodID(clazz, "loadPoster", "(Ljava/lang/String;)V");
        m_glue->m_play = env->GetMethodID(clazz, "play", "(Ljava/lang/String;)V");

        m_glue->m_teardown = env->GetMethodID(clazz, "teardown", "()V");
        m_glue->m_seek = env->GetMethodID(clazz, "seek", "(I)V");
        m_glue->m_pause = env->GetMethodID(clazz, "pause", "()V");
        m_glue->m_javaProxy = NULL;
        env->DeleteLocalRef(clazz);
        // An exception is raised if any of the above fails.
        checkException(env);
    }
Exemplo n.º 16
0
    //_______________________________________________________
    void ExceptionListWidget::edit( void )
    {

        // retrieve selection
        QModelIndex current( m_ui.exceptionListView->selectionModel()->currentIndex() );
        if( ! model().contains( current ) ) return;

        InternalSettingsPtr exception( model().get( current ) );

        // create dialog
        QPointer<ExceptionDialog> dialog( new ExceptionDialog( this ) );
        dialog->setWindowTitle( i18n( "Edit Exception - Menda Settings" ) );
        dialog->setException( exception );

        // map dialog
        if( !dialog->exec() )
        {
            delete dialog;
            return;
        }

        // check modifications
        if( !dialog->isChanged() ) return;

        // retrieve exception
        dialog->save();
        delete dialog;

        // check new exception validity
        checkException( exception );
        resizeColumns();

        setChanged( true );

        return;

    }
void MediaPlayerPrivate::createJavaPlayerIfNeeded()
{
    // Check if we have been already created.
    if (m_glue->m_javaProxy)
        return;

    FrameView* frameView = m_player->frameView();
    if (!frameView)
        return;

    JNIEnv* env = JSC::Bindings::getJNIEnv();
    if (!env)
        return;

    jclass clazz = env->FindClass(g_ProxyJavaClass);
    if (!clazz)
        return;

    WebViewCore* webViewCore =  WebViewCore::getWebViewCore(frameView);
    ASSERT(webViewCore);

    // Get the HTML5VideoViewProxy instance
    jobject obj = env->CallStaticObjectMethod(clazz, m_glue->m_getInstance, webViewCore->getJavaObject().get(), this);
    m_glue->m_javaProxy = env->NewGlobalRef(obj);
    // Send the poster
    jstring jUrl = 0;
    if (m_posterUrl.length())
        jUrl = env->NewString((unsigned short *)m_posterUrl.characters(), m_posterUrl.length());
    // Sending a NULL jUrl allows the Java side to try to load the default poster.
    env->CallVoidMethod(m_glue->m_javaProxy, m_glue->m_loadPoster, jUrl);
    if (jUrl)
        env->DeleteLocalRef(jUrl);
    // Clean up.
    env->DeleteLocalRef(obj);
    env->DeleteLocalRef(clazz);
    checkException(env);
}
    //_______________________________________________________
    void ExceptionListWidget::add( void )
    {

        QPointer<ExceptionDialog> dialog = new ExceptionDialog( this );
        ConfigurationPtr exception( new Configuration() );
        exception->readConfig();
        dialog->setException( exception );

        // run dialog and check existence
        if( !dialog->exec() )
        {
            delete dialog;
            return;
        }

        dialog->save();
        delete dialog;

        // check exceptions
        if( !checkException( exception ) ) return;

        // create new item
        model().add( exception );
        setChanged( true );

        // make sure item is selected
        QModelIndex index( model().index( exception ) );
        if( index != ui.exceptionListView->selectionModel()->currentIndex() )
        {
            ui.exceptionListView->selectionModel()->select( index,  QItemSelectionModel::Clear|QItemSelectionModel::Select|QItemSelectionModel::Rows );
            ui.exceptionListView->selectionModel()->setCurrentIndex( index,  QItemSelectionModel::Current|QItemSelectionModel::Rows );
        }

        resizeColumns();
        return;

    }
Exemplo n.º 19
0
//AudioChannel
void VLCMediaController::setCurrentAudioChannel( const Phonon::AudioChannelDescription & audioChannel )
{
	current_audio_channel = audioChannel;
    libvlc_audio_set_track( p_vlc_media_player, audioChannel.index(), p_vlc_exception );
    checkException();
}
Exemplo n.º 20
0
/*
 * Class:     de_fraunhofer_fokus_ants_jipfix_jIPFIX
 * Method:    ipfixCleanup
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_de_fraunhofer_fokus_ants_jipfix_jIPFIX_ipfixCleanup(JNIEnv * env, jobject self) {
  ipfix_cleanup();
  checkException(env);
}
Exemplo n.º 21
0
void  ImmortalPhysical_MemBlock_gc(struct MemBlock* mem) {
#ifdef RTJ_DEBUG
    checkException();
    printf("ImmortalPhysical_RThread_MemBlock_gc(%p)\n", mem);
#endif
}
/*
 * MAIN, part II
 */
static int
main2(JNIEnv* env, char *argv[], int farg, int argc)
{
	char gc_safe_zone[1024];
	jarray args;
	jclass cls;
	jclass mcls;
	jmethodID mmth;
	jobject str;
	int i;
	int ret_code;
	const char* exec;

	/* make sure no compiler optimizes this away */
	gc_safe_zone[0] = gc_safe_zone[sizeof gc_safe_zone - 1] = 0;

	/* Executable is a JAR?  Use the JAR launcher */
	if (isJar != 0) {
		exec = "kaffe.jar.ExecJar";
	}
	else {
		exec = argv[farg];
		farg++;
		argc--;
	}
	
	mcls = (*env)->FindClass(env, exec);
	if (checkException(env))
		goto exception_happened;
	
	/* ... and run main. */
	mmth = (*env)->GetStaticMethodID(env,
	    mcls, "main", "([Ljava/lang/String;)V");
	if (checkException(env))
		goto exception_happened;

	/* Build an array of strings as the arguments */
	cls = (*env)->FindClass(env, "java/lang/String");
	if (checkException(env))
		goto exception_happened;
	args = (*env)->NewObjectArray(env, argc, cls, NULL);
	if (checkException(env))
		goto exception_happened;
	for (i = 0; i < argc; i++) {
		str = (*env)->NewStringUTF(env, argv[farg+i]);
		if (checkException(env))
			goto exception_happened;
		(*env)->SetObjectArrayElement(env, args, i, str);
		if (checkException(env))
			goto exception_happened;
	}

	/* Call method, check for errors and then exit */
	(*env)->CallStaticVoidMethod(env, mcls, mmth, args);
	if (checkException(env))
	  goto exception_happened;

	ret_code = 0;
	goto done;

exception_happened:
	ret_code = 1;
done:
	/* We're done. We are the "main thread" and so are required to call
	   (*vm)->DestroyJavaVM() instead of (*vm)->DetachCurrentThread() */
	(*global_vm)->DestroyJavaVM(global_vm);
	return ret_code;
}
void WebCoreResourceLoader::downloadFile()
{
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    env->CallVoidMethod(mJLoader, gResourceLoader.mDownloadFileMethodID);
    checkException(env);
}
Exemplo n.º 24
0
/*
 * Class:     de_fraunhofer_fokus_ants_jipfix_jIPFIX
 * Method:    ipfixInit
 * Signature: ()B
 */
JNIEXPORT jbyte JNICALL Java_de_fraunhofer_fokus_ants_jipfix_jIPFIX_ipfixInit(JNIEnv * env, jobject self) {
  return ipfix_init();
  checkException(env);
}
Exemplo n.º 25
0
/*
 * Class:     de_fraunhofer_fokus_ants_jipfix_jIPFIX
 * Method:    mlogSetVerbosityLevel
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_de_fraunhofer_fokus_ants_jipfix_jIPFIX_mlogSetVerbosityLevel(JNIEnv *env, jobject self, jint level) {
  mlog_set_vlevel(level);
  checkException(env);
}
Exemplo n.º 26
0
/*
 * Class:     javax_realtime_ScopedMemory
 * Method:    getPortalObj
 * Signature: ()Ljava/lang/Object;
 */
JNIEXPORT jobject JNICALL Java_javax_realtime_ScopedMemory_getPortalObj
(JNIEnv *env, jobject memoryArea) {
  jobject result = getInflatedObject(env, memoryArea)->portalObj;
  checkException(env);
  return result;
}
Exemplo n.º 27
0
/*
 * Class:     javax_realtime_ScopedMemory
 * Method:    DECREF
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_javax_realtime_ScopedMemory_DECREF
(JNIEnv *env, jobject memoryArea) {
  MemBlock_DECREF(getInflatedObject(env, memoryArea)->memBlock);
  checkException(env);
} 
void WebCoreResourceLoader::cancel()
{
    JNIEnv* env = JSC::Bindings::getJNIEnv();
    env->CallVoidMethod(mJLoader, gResourceLoader.mCancelMethodID);
    checkException(env);
}
Exemplo n.º 29
0
std::list<VersionedValue> * 
VoldemortNativeRequestFormat::readGetResponse(std::istream* inputStream) {
    checkException(inputStream);
    return readResults(inputStream);
}
Exemplo n.º 30
0
/*
 * Class:     de_fraunhofer_fokus_ants_jipfix_jIPFIX
 * Method:    ipfixCollectorInitFileExport
 * Signature: (Ljava/io/File;)V
 */
JNIEXPORT void JNICALL Java_de_fraunhofer_fokus_ants_jipfix_jIPFIX_ipfixCollectorInitFileExport(JNIEnv *env, jobject self, jstring dir) {
  char * datadir = (char*)((*env) -> GetStringUTFChars(env, dir, NULL));
  ipfix_col_init_fileexport( datadir );
  checkException(env);
}