tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

cubeb-jni-instances.h (895B)


      1 #ifndef _CUBEB_JNI_INSTANCES_H_
      2 #define _CUBEB_JNI_INSTANCES_H_
      3 
      4 #include "mozilla/java/GeckoAppShellWrappers.h"
      5 #include "mozilla/jni/Utils.h"
      6 
      7 /*
      8 * The methods in this file offer a way to pass in the required
      9 * JNI instances in the cubeb library. By default they return NULL.
     10 * In this case part of the cubeb API that depends on JNI
     11 * will return CUBEB_ERROR_NOT_SUPPORTED. Currently only one
     12 * method depends on that:
     13 *
     14 * cubeb_stream_get_position()
     15 *
     16 * Users that want to use that cubeb API method must "override"
     17 * the methods bellow to return a valid instance of JavaVM
     18 * and application's Context object.
     19 * */
     20 
     21 JNIEnv *
     22 cubeb_get_jni_env_for_thread()
     23 {
     24  return mozilla::jni::GetEnvForThread();
     25 }
     26 
     27 jobject
     28 cubeb_jni_get_context_instance()
     29 {
     30  auto context = mozilla::java::GeckoAppShell::GetApplicationContext();
     31  return context.Forget();
     32 }
     33 
     34 #endif //_CUBEB_JNI_INSTANCES_H_