From 3a26aa701b4a1a0991cd997a0d295a1b83cd12f3 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 9 Apr 2012 04:49:41 +0200 Subject: GLMediaPlayer*: Revised - Working on buggy MediaPlayer impl. (Android ICS Tegra) GLMediaPlayer: Merging 'initStream()' and 'initGL()' to 'initGLStream()' due to incompatible/buggy implementations (Android/Tegra) requiring the GL texture being setup before preparing the stream. This also implies that w/o an GL context we cannot fetch the stream information (size, ..) hence we need to evaluate this detail (FIXME). 'getNextTexture(GL gl, boolean blocking)' can request the impl. to block GLMediaEventListener: The TextureFrame not yet available, adding 'when' --- .../native/openmax/jogamp_opengl_omx_OMXGLMediaPlayer.c | 4 ++-- src/jogl/native/openmax/omx_tool.c | 15 ++++++++------- src/jogl/native/openmax/omx_tool.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src/jogl/native') diff --git a/src/jogl/native/openmax/jogamp_opengl_omx_OMXGLMediaPlayer.c b/src/jogl/native/openmax/jogamp_opengl_omx_OMXGLMediaPlayer.c index 86307ae59..73687f305 100644 --- a/src/jogl/native/openmax/jogamp_opengl_omx_OMXGLMediaPlayer.c +++ b/src/jogl/native/openmax/jogamp_opengl_omx_OMXGLMediaPlayer.c @@ -222,12 +222,12 @@ JNIEXPORT jlong JNICALL Java_jogamp_opengl_omx_OMXGLMediaPlayer__1seek } JNIEXPORT jint JNICALL Java_jogamp_opengl_omx_OMXGLMediaPlayer__1getNextTextureID - (JNIEnv *env, jobject instance, jlong ptr) + (JNIEnv *env, jobject instance, jlong ptr, jboolean blocking) { jint textureID = 0xffffffff; OMXToolBasicAV_t *pOMXAV = (OMXToolBasicAV_t *)((void *)((intptr_t)ptr)); if (pOMXAV != NULL) { - textureID = OMXToolBasicAV_GetNextTextureID(pOMXAV); + textureID = OMXToolBasicAV_GetNextTextureID(pOMXAV, blocking ? 1 : 0); } return textureID; } diff --git a/src/jogl/native/openmax/omx_tool.c b/src/jogl/native/openmax/omx_tool.c index 784d6facf..5e168ad02 100644 --- a/src/jogl/native/openmax/omx_tool.c +++ b/src/jogl/native/openmax/omx_tool.c @@ -1411,9 +1411,9 @@ void OMXToolBasicAV_PlaySeek(OMXToolBasicAV_t * pOMXAV, KDint64 time) kdThreadMutexUnlock(pOMXAV->mutex); } -GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV) { +GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV, int blocking) { GLuint texID = 0; - int ret = pOMXAV->glPos; + int idx = pOMXAV->glPos; kdThreadMutexLock(pOMXAV->mutex); if(pOMXAV->status==OMXAV_PLAYING) { @@ -1438,9 +1438,10 @@ GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV) { pOMXAV->omxPos = next; next = (pOMXAV->omxPos + 1) % pOMXAV->vBufferNum; pOMXAV->filled++; - } - else - { + if(!blocking) { + break; + } + } else { DBG_PRINT2( "GetNextTexture p2.3\n"); break; } @@ -1462,11 +1463,11 @@ GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV) { pOMXAV->available--; pOMXAV->filled--; pOMXAV->glPos = (pOMXAV->glPos + 1) % pOMXAV->vBufferNum; - ret = pOMXAV->glPos; + idx = pOMXAV->glPos; } } - texID = pOMXAV->available ? pOMXAV->buffers[ret].tex : 0; + texID = pOMXAV->available ? pOMXAV->buffers[idx].tex : 0; DBG_PRINT2( "GetNextTexture B avail %d, filled %d, pos o:%d g:%d t:%d\n", pOMXAV->available, pOMXAV->filled, pOMXAV->omxPos, pOMXAV->glPos, texID); diff --git a/src/jogl/native/openmax/omx_tool.h b/src/jogl/native/openmax/omx_tool.h index be5b8f175..1ade60e4f 100644 --- a/src/jogl/native/openmax/omx_tool.h +++ b/src/jogl/native/openmax/omx_tool.h @@ -139,7 +139,7 @@ void OMXToolBasicAV_PlayStart(OMXToolBasicAV_t * pOMXAV); // #5 void OMXToolBasicAV_PlayPause(OMXToolBasicAV_t * pOMXAV); void OMXToolBasicAV_PlayStop(OMXToolBasicAV_t * pOMXAV); void OMXToolBasicAV_PlaySeek(OMXToolBasicAV_t * pOMXAV, KDint64 time); -GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV); +GLuint OMXToolBasicAV_GetNextTextureID(OMXToolBasicAV_t * pOMXAV, int blocking); KDint64 OMXToolBasicAV_GetCurrentPosition(OMXToolBasicAV_t * pOMXAV); -- cgit v1.2.3