summaryrefslogtreecommitdiffstats
path: root/src/jogl/native
diff options
context:
space:
mode:
Diffstat (limited to 'src/jogl/native')
-rw-r--r--src/jogl/native/EGLContext.c39
-rw-r--r--src/jogl/native/libav/ffmpeg_impl_template.c7
-rw-r--r--src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c33
3 files changed, 76 insertions, 3 deletions
diff --git a/src/jogl/native/EGLContext.c b/src/jogl/native/EGLContext.c
new file mode 100644
index 000000000..7bf60b850
--- /dev/null
+++ b/src/jogl/native/EGLContext.c
@@ -0,0 +1,39 @@
+#include <jni.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <assert.h>
+
+#include <stdio.h> /* android */
+#include <gluegen_stdint.h>
+#include <gluegen_stddef.h>
+#include <EGL/egl.h>
+
+/* Java->C glue code:
+ * Java package: jogamp.opengl.egl.EGLContext
+ * Java method: long dispatch_eglGetProcAddress(java.lang.String procname)
+ * C function: __EGLFuncPtr eglGetProcAddress(const char * procname)
+ */
+JNIEXPORT jlong JNICALL
+Java_jogamp_opengl_egl_EGLContext_dispatch_1eglGetProcAddress0__Ljava_lang_String_2J(JNIEnv *env, jclass _unused, jstring procname, jlong procAddress) {
+ typedef __EGLFuncPtr (EGLAPIENTRY*_local_PFNEGLGETPROCADDRESSPROC)(const char * procname);
+ _local_PFNEGLGETPROCADDRESSPROC ptr_eglGetProcAddress;
+ const char* _strchars_procname = NULL;
+ __EGLFuncPtr _res;
+ if ( NULL != procname ) {
+ _strchars_procname = (*env)->GetStringUTFChars(env, procname, (jboolean*)NULL);
+ if ( NULL == _strchars_procname ) {
+ (*env)->ThrowNew(env, (*env)->FindClass(env, "java/lang/OutOfMemoryError"),
+ "Failed to get UTF-8 chars for argument \"procname\" in native dispatcher for \"dispatch_eglGetProcAddress\"");
+ return 0;
+ }
+ }
+ ptr_eglGetProcAddress = (_local_PFNEGLGETPROCADDRESSPROC) (intptr_t) procAddress;
+ assert(ptr_eglGetProcAddress != NULL);
+ _res = (* ptr_eglGetProcAddress) ((const char *) _strchars_procname);
+ if ( NULL != procname ) {
+ (*env)->ReleaseStringUTFChars(env, procname, _strchars_procname);
+ }
+ return (jlong) (intptr_t) _res;
+}
+
diff --git a/src/jogl/native/libav/ffmpeg_impl_template.c b/src/jogl/native/libav/ffmpeg_impl_template.c
index 3077070db..ca283ef52 100644
--- a/src/jogl/native/libav/ffmpeg_impl_template.c
+++ b/src/jogl/native/libav/ffmpeg_impl_template.c
@@ -535,7 +535,8 @@ JNIEXPORT jint JNICALL FF_FUNC(getSwResampleMajorVersionCC0)
}
JNIEXPORT jlong JNICALL FF_FUNC(createInstance0)
- (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer, jboolean verbose)
+ (JNIEnv *env, jobject instance, jobject ffmpegMediaPlayer,
+ jboolean enableAvResample, jboolean enableSwResample, jboolean verbose)
{
FFMPEGToolBasicAV_t * pAV = calloc(1, sizeof(FFMPEGToolBasicAV_t));
if(NULL==pAV) {
@@ -545,12 +546,12 @@ JNIEXPORT jlong JNICALL FF_FUNC(createInstance0)
pAV->avcodecVersion = sp_avcodec_version();
pAV->avformatVersion = sp_avformat_version();
pAV->avutilVersion = sp_avutil_version();
- if(HAS_FUNC(sp_avresample_version)) {
+ if(HAS_FUNC(sp_avresample_version) && enableAvResample) {
pAV->avresampleVersion = sp_avresample_version();
} else {
pAV->avresampleVersion = 0;
}
- if(HAS_FUNC(sp_swresample_version)) {
+ if(HAS_FUNC(sp_swresample_version) && enableSwResample) {
pAV->swresampleVersion = sp_swresample_version();
} else {
pAV->swresampleVersion = 0;
diff --git a/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
new file mode 100644
index 000000000..d1657d0c6
--- /dev/null
+++ b/src/jogl/native/libav/ffmpeg_lavc56_lavf56_lavu54_lavr02.c
@@ -0,0 +1,33 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+
+#include "jogamp_opengl_util_av_impl_FFMPEGv11Natives.h"
+
+#define FF_FUNC(METHOD) Java_jogamp_opengl_util_av_impl_FFMPEGv11Natives_ ## METHOD
+
+#include "ffmpeg_impl_template.c"