2

I want to develop an app, which will have 2 buttons and SurfaceView(Actually a class extends SurfaceView implements SurfaceHolder.Callback).

When user click on button1 - with ScreenCapture, I will get an image and using mediacodec, I will do vp8 encoding and the output saving in bytebuffer.(I am not saving in a file location)

When user click on button2 - I need to show it on SurfaceView with that output of bytebuffer which is captured.

i have tried as

MediaCodec decoder = MediaCodec.createDecoderByType("video/x-vnd.on2.vp8"); decoder.dequeueOutputBuffer(mBufferInfo, DEFAULT_TIMEOUT_US);

.....

but not able to update the surfaceview.

How can i update the surfaceview using bytebuffer data?

user2318724
  • 259
  • 5
  • 16
  • 1
    Have you been able to get this to work with AVC? It might be useful to get everything working with .mp4 to ensure that any issues you're encountering are not VP8-specific. – fadden Feb 27 '15 at 17:02
  • No.. I feel i am doing some mistake in MediaProjection.createVirtualDisplay(..); with this api, i am able to capture the screen. mMediaProjection.createVirtualDisplay("SCREEN_CAPTURE",Width, height, density, 0, surface, new VirtualDisplay.Callback() { }, handler); surface contains captured screen data. is this correct? – user2318724 Mar 02 '15 at 10:16

1 Answers1

0

I got the answer... mMediaCOdec.releaseOutputBuffer(index, true)... -- here i set render as false. If set render value as true, then i can able to draw or set the captured image. With releaseOutputBuffer (int index, long renderTimestampNs) -- we can render the image. But supported in API level 21 only. Thanks..

user2318724
  • 259
  • 5
  • 16