我正试图在Android上渲染vlc流式传输到OpenGL。 我想我错过了一些东西。这是我到目前为止所拥有的。
这是我的自定义类:
公共类VLCVideoView扩展SurfaceView实现SurfaceHolder.Callback,IVideoPlayer,GLSurfaceView.Renderer
我在VLC上的初始化:
try {
// Create a new media player
libvlc = LibVLC.getInstance();
libvlc.setHardwareAcceleration(LibVLC.HW_ACCELERATION_FULL);
libvlc.eventVideoPlayerActivityCreated(true);
libvlc.setSubtitlesEncoding("");
libvlc.setAout(LibVLC.AOUT_OPENSLES);
libvlc.setVout(LibVLC.VOUT_OPEGLES2);
//libvlc.setVout(LibVLC.VOUT_ANDROID_SURFACE);
libvlc.setTimeStretching(true);
libvlc.setChroma("RV32");
libvlc.setVerboseMode(true);
LibVLC.restart(context);
holder.setFormat(PixelFormat.RGBA_8888);
mSurface = holder.getSurface();
libvlc.attachSurface(mSurface, this);
实现了整个GLSurfaceView.Renderer方法:
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config)
@Override
public void onSurfaceChanged(GL10 gl, int width, int height)
@Override
public void onDrawFrame(GL10 gl)
同样如:
@Override
protected void onDraw(Canvas canvas) for the VLCVideoView
{
if (mSurface!= null)
{
try {
Canvas surfaceCanvas = mSurface.lockCanvas(null);
if(surfaceCanvas != null)
{
super.onDraw(surfaceCanvas);
mSurface.unlockCanvasAndPost(surfaceCanvas);
}
} catch (Surface.OutOfResourcesException excp) {
excp.printStackTrace();
}
}
}
我有一个正在绘制的旋转立方体,但它不是将流帧作为纹理,而是简单地在平面上流动。
有任何线索吗?