Wednesday 15 September 2010

android - Grafika TextureMovieEncoder -



android - Grafika TextureMovieEncoder -

i have been modifying grafika's texturemovieencoder create recording of displayed onscreen: 2 sprite2ds overlapping. using cameracaptureactivity illustration reference point, ported created rendering thread texturemovieencoder output jagged lines across screen. think understand what's wrong, don't know how prepare it:

some code:

private void prepareencoder(eglcontext sharedcontext, int width, int height, int bitrate, file outputfile) { seek { mvideoencoder = new videoencodercore(width, height, bitrate, outputfile); } grab (ioexception ioe) { throw new runtimeexception(ioe); } meglcore = new eglcore(sharedcontext, eglcore.flag_recordable); minputwindowsurface = new windowsurface(meglcore, mvideoencoder.getinputsurface(), true); minputwindowsurface.makecurrent(); textureprogram = new texture2dprogram(texture2dprogram.programtype.texture_ext); backgrounddrawable = new drawable2d(drawable2d.prefab.rectangle); backgroundrect = new sprite2d(backgrounddrawable); frontdrawable = new drawable2d(drawable2d.prefab.rectangle); frontrect = new sprite2d(frontdrawable); backgroundrect.settexture(backtextureid); frontrect.settexture(fronttextureid); updategeometry(); } private void handleframeavailable(transform transform, long timestampnanos) { if (verbose) log.d(tag, "handleframeavailable tr=" + transform); mvideoencoder.drainencoder(false); backgroundrect.draw(textureprogram, transform.moviematrix); frontrect.draw(textureprogram, transform.cameramatrix); minputwindowsurface.setpresentationtime(timestampnanos); minputwindowsurface.swapbuffers(); }

i think problem comes downwards lack of understanding of how found right projection onto windowsurface videoencoder. in grafika example, fullframerect used, easier since can utilize identity matrix stretch given texture surface area. however, since want create overlapping effect, needed utilize sprite2d. problem shared eglcontext? need create new 1 can set viewport match windowsurface size? bit lost on go here.

turns out functionality of code above fine. problem interaction between textureencoder , calling parent.

i initializing fellow member variables backtextureid , fronttextureid after prepareencoder , hence recording garbage info output.

android opengl-es android-camera surfaceholder

No comments:

Post a Comment