Finally this is fixed by not explicitly casting to (ANativeWindow*)
before calling eglCreateWindowSurface. It is really wired.
"ANativeWindow* pW = (ANativeWindow*)(m_pSurfaceHolder->m_pSurface); "

On Nov 29, 10:42 am, xiaolu <[email protected]> wrote:
> I also tried to create a new surface from SurfaceComposerClient. Then
> feed the eglCreateWindowSurface with this surface just like the Bootup
> animation did. However, it will runtime crash because of lacking the
> permission of ACCESS_SURFACE_FLINGER. Seems this permission will not
> be granted to third-party application. So how can I setup the EGL
> environment without a native window? <_>
>
> On Nov 28, 6:47 pm, xiaolu <[email protected]> wrote:
>
> > Hi, Guys:
>
> > I have a question about the eglCreateWindowSurface usage. I want to
> > setup a EGL environment onto the movie view, set by the calling
> > MediaPlayer::setVideoSurface(xxx) from Java. Then use OpenGL to do the
> > video output work.
>
> > I have refer to some demo code about the setup steps as below:
>
> > 582     ///////////////////////////////////
> > 583     EGLint configAttribs[] = {
> > 584             EGL_SURFACE_TYPE,   EGL_WINDOW_BIT,
> > 585             EGL_NONE
> > 586     };
> > 587
> > 588     EGLint majorVersion;
> > 589     EGLint minorVersion;
> > 590     EGLContext context;
> > 591     EGLConfig config;
> > 592     EGLint numConfigs=0;
> > 593     EGLSurface surface;
> > 594     EGLint w, h;
> > 595     EGLDisplay dpy;
> > 596
> > 597     dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY);
> > 598     eglInitialize(dpy, 0 ,0) ;//&majorVersion, &minorVersion);
> > 599     eglChooseConfig(dpy, configAttribs, &config, 1, &numConfigs);
> > 600
> > 601     ANativeWindow* pW = (ANativeWindow*)(m_pSurfaceHolder->m_pSurface);
>
> > 602     surface = eglCreateWindowSurface(dpy, config,
> > (EGLNativeWindowType)(pW), NULL);
> > 603     if (surface != EGL_NO_SURFACE)
> > 604     {
> > 605         LOGI("EGL Surface create successfully");
> > 611     }
> > 612     LOGI("EGL surface %x", surface);
> > 613     ///////////////////////////////////
>
> > However, I always got a result EGL_NO_SURFACE, and a error log like
> > this:
> > E/Surface ( 1393): invalid token (identity=0)
> > I guess it is because the video surface passed from UI is not proper
> > to setup EGL environment. So my question is:
> > What kind of window does eglCreateWindowSurface expect? Should it be
> > the same with the movie view set from UI, or should I create a new
> > surface?
>
> > Thank you for your reply.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to