MobileFFmpeg Android API  2.0
Functions | Variables
log.c File Reference

Go to the source code of this file.

Functions

jint JNI_OnLoad (JavaVM *vm, void *reserved)
 
static void * logThreadFunction ()
 
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_startNativeCollector (JNIEnv *env, jobject object)
 
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_stopNativeCollector (JNIEnv *env, jobject object)
 

Variables

static JavaVM * globalVm
 
static jclass logClass
 
static jmethodID logMethod
 
static int pipeFd [2]
 
static pthread_t logThread
 
static int logThreadEnabled = 1
 
const char * logClassName = "com/arthenica/mobileffmpeg/Log"
 
JNINativeMethod logMethods []
 

Function Documentation

◆ Java_com_arthenica_mobileffmpeg_Log_startNativeCollector()

JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_startNativeCollector ( JNIEnv *  env,
jobject  object 
)

Starts native log collector. Native log collector creates a pipe and redirects stdout and stderr to it. Then starts a thread, reads data written to this pipe and forwards it to the Java side.

Parameters
envpointer to native method interface
objectreference to the object on which this method is invoked
Returns
zero on success, non-zero if an error occurs

Definition at line 140 of file log.c.

◆ Java_com_arthenica_mobileffmpeg_Log_stopNativeCollector()

JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_stopNativeCollector ( JNIEnv *  env,
jobject  object 
)

Initiates a stop request for native log collector thread. Please note that when this function returns collector thread might be still alive.

Parameters
envpointer to native method interface
objectreference to the object on which this method is invoked
Returns
zero on success, non-zero if an error occurs

Definition at line 169 of file log.c.

◆ JNI_OnLoad()

jint JNI_OnLoad ( JavaVM *  vm,
void *  reserved 
)

Called when 'ffmpeglog' native library is loaded.

Parameters
vmpointer to the running virtual machine
reservedreserved
Returns
JNI version needed by 'ffmpeglog' library

Definition at line 56 of file log.c.

◆ logThreadFunction()

static void* logThreadFunction ( )
static

Native log collector main thread function.

Definition at line 91 of file log.c.

Variable Documentation

◆ globalVm

JavaVM* globalVm
static

Global reference to the virtual machine running

Definition at line 23 of file log.c.

◆ logClass

jclass logClass
static

Global reference of Log class in Java side

Definition at line 26 of file log.c.

◆ logClassName

const char* logClassName = "com/arthenica/mobileffmpeg/Log"

Full name of the Java class that owns native functions in this file.

Definition at line 41 of file log.c.

◆ logMethod

jmethodID logMethod
static

Global reference of forward log method in Java side

Definition at line 29 of file log.c.

◆ logMethods

JNINativeMethod logMethods[]
Initial value:
= {
{"startNativeCollector", "()I", (void*) Java_com_arthenica_mobileffmpeg_Log_startNativeCollector},
{"stopNativeCollector", "()I", (void*) Java_com_arthenica_mobileffmpeg_Log_stopNativeCollector}
}
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_stopNativeCollector(JNIEnv *env, jobject object)
Definition: log.c:169
JNIEXPORT jint JNICALL Java_com_arthenica_mobileffmpeg_Log_startNativeCollector(JNIEnv *env, jobject object)
Definition: log.c:140

Prototypes of native functions defined by this file.

Definition at line 44 of file log.c.

◆ logThread

pthread_t logThread
static

log collector thread variable

Definition at line 35 of file log.c.

◆ logThreadEnabled

int logThreadEnabled = 1
static

Holds whether log collector thread is enabled or not

Definition at line 38 of file log.c.

◆ pipeFd

int pipeFd[2]
static

file descriptor of the pipe created

Definition at line 32 of file log.c.