grafika

SurfaceTexture AttachToGLContext and Surface

只谈情不闲聊 提交于 2021-02-18 08:48:31
问题 I'm trying to find out whether I need to remake a Surface if I want to call the attachToGLContext method from a SurfaceTexture. I tried to look in the android documentation, but there is no mention. I'm guessing not because as far as I'm aware, Surface is a buffer for a SurfaceTexture which can act as an external texture for an OpenGL context. So attaching the SurfaceTexture to a different context should not affect this. Does anybody know for sure? 回答1: The internal name for SurfaceTexture is

setPreviewTexture failed in MTK device

泄露秘密 提交于 2021-02-07 12:52:26
问题 Recently I am learning android Camera and OpenglES by grafika (Thanks fadden).It's good on most device, but I encounter bugs in some device, espacially MTK device(such as MT6580,MT8163...). For example, when "CameraCaptureActivity" run in MTK. I am getting this error: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.hardware.Camera.setPreviewTexture(android.graphics.SurfaceTexture)' on a null object reference so I changed "handleSetSurfaceTexture" function to

Android - Gaussian blur like effect - OpenGL

左心房为你撑大大i 提交于 2019-12-25 01:19:50
问题 Where not specified this question is just building on top of the CameraCaptureActivity within the grafika project found on github. It has a built in blur effect that utilises a 3x3 kernel kernel = new float[] { 1f/16f, 2f/16f, 1f/16f, 2f/16f, 4f/16f, 2f/16f, 1f/16f, 2f/16f, 1f/16f }; However this blur effect is not strong enough, im looking for something like what the gaussian effect can do on iOS with UIVisualEffectView , it looks something like this: A nice smooth heavy blur effect but so

Modify ExtractMpegFramesTest example to render decoded output on screen

蹲街弑〆低调 提交于 2019-12-23 03:44:09
问题 I'm trying to modify ExtractMpegFramesTest to do the rendering on screen and still use glReadPixels to extract the frames. I copied the relevant code for extracting the frames from ExtractMpegFramesTest (the CodecOutputSurface and STextureRender classes) and the frame extraction works as expected when rendered off screen. I have a TextureView with a SurfaceTextureListener and when I receive onSurfaceTextureAvailable I get the SurfaceTexture and start the decoding process. I pass this

Android Precise seeking of video

 ̄綄美尐妖づ 提交于 2019-12-21 02:14:10
问题 I'm struggling with precise seeking using MediaExtractor's seekTo() . While I can seek to sync frames without problems, I would like to seek to specific time. This question led me to some ideas how to do this, but I'm not sure if they are valid. Basicly, I would have to seek to closest previous sync frame and then advance() the extractor until target time is reached. Every frame in the process would be fed to the decoder, i.e the first I-frame and the rest P-frames. This is related code

Field of camera preview is smaller if I use the way of preview in grifika's ContinuousCaptureActivity

不想你离开。 提交于 2019-12-20 04:25:27
问题 We know that we will get a lager field of preview at the same distance when camera preview ratio set to 4:3 instead of 16:9 , the detail is as follows: Android Camera API - Weird zoom effect But I encountered a problem when I worked with android camera preview with opengl, that is the second way mentioned below. There are 2 ways of implementing camera preview: Traditional way without opengl, just use Camera.setPreviewTexture(SurfaceTexture texture) or Camera.setPreviewDisplay(SurfaceHolder

Use rotateM() of Matrix to rotate matrix from SurfaceTexture but corrupt the video output

邮差的信 提交于 2019-12-18 05:08:08
问题 I managed to play video with opengl es, I used the way of grafika's ContinuousCaptureActivity, my data source is MediaPlayer rather than Camera which makes no difference. MediaPlayer produces video frames continuously and I draw each frame to screen in onFrameAvailable callback. The code is as follows which works well: mVideoTexture.updateTexImage(); mVideoTexture.getTransformMatrix(mTmpMatrix); mDisplaySurface.makeCurrent(); int viewWidth = getWidth(); int viewHeight = getHeight(); GLES20

MediaCodec createInputSurface failed with -38

Deadly 提交于 2019-12-13 02:29:41
问题 I launch the grafika, a dialog turned out and said "Failed to generate cotent. Some features may be unavailable. Can't use input surface with software codec: OMX.google.h264.encoder" Then I click OK button and entered the continuous caputure activity, the app crashed. My device infomation is as follows: Model: Lenovo A560 Android version: 4.3 I am sure this is the key log: 06-29 21:27:50.267 E/OMXMaster(17347): A component of name 'OMX.qcom.audio.decoder.aac' already exists, ignoring this one

Android MediaCodec backward seeking

那年仲夏 提交于 2019-12-10 10:59:35
问题 I'm trying to implement precise seeking for video using MediaCodec and MediaExtractor . By following Grafika's MoviePlayer, I've managed to implement the forward seeking. However I'm still having problem with backward seeking. The relevant bit of code is here: public void seekBackward(long position){ final int TIMEOUT_USEC = 10000; int inputChunk = 0; long firstInputTimeNsec = -1; boolean outputDone = false; boolean inputDone = false; mExtractor.seekTo(position, MediaExtractor.SEEK_TO

Picture produced by saveFrame of Grafika is upside-down

醉酒当歌 提交于 2019-12-09 23:57:33
问题 I wrote a demo according to Continuous capture activity.I wanted to save the first frame of the video as a jpeg file, so I used the saveFrame() function which was already prepared by Grafika. The source code of the function is as follows: https://github.com/google/grafika/blob/master/src/com/android/grafika/gles/EglSurfaceBase.java But I found that the jpeg picture produced was upside-down.This is not what I want. Is there a way of rotating the frame before I save the frame? Rotating the