这是这个问题的后续问题。
这是我的TextureView
代码:
public class VideoTextureView extends TextureView implements SurfaceTextureListener{
private static final String LOG_TAG = VideoTextureView.class.getSimpleName();
private MediaCodecDecoder mMediaDecoder;
private MediaCodecAsyncDecoder mMediaAsyncDecoder;
public VideoTextureView(Context context, AttributeSet attrs) {
super(context, attrs);
setSurfaceTextureListener(this);
Log.d(LOG_TAG, "Video texture created.");
}
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
Log.d(LOG_TAG, "Surface Available: " + width + " x " + height);
mMediaDecoder = new MediaCodecDecoder();
mMediaDecoder.Start();
mMediaDecoder.SetSurface(new Surface(getSurfaceTexture()));
}
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
// TODO Auto-generated method stub
}
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mMediaDecoder.Stop();
return false;
}
@Override
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
// TODO Auto-generated method stub
}
}
我的问题 - 我的TextureView
实现是否可以渲染由解码的 H264 流MediaCodec
?还是我需要进行 EGL 设置或其他任何事情?
提前致谢!