【问题标题】:Gstreamer video to opengl textureGstreamer 视频到 opengl 纹理
【发布时间】:2011-09-29 08:31:59
【问题描述】:

我正在尝试渲染从使用 Gstreamer 的 MPEG4 视频抓取并转换为 Android (2.2)-opengl 纹理的 AV 帧。我已经用尽谷歌并没有找到答案。

基本上,我使用Gstreamer uridecodebin 来解码帧,然后将帧转换为RGB,然后glTexSubImage2D() 从中创建一个openGL 纹理,但似乎无法得到任何工作。纹理是当我从 Gstreamer 获取解码数据 (RGB) 时会着色。

我得到的视频大小是320 * 256,我的纹理大小是512 * 256,我正在使用glDrawTexiOES(0,0,videowidth,videoheight),我没有收到任何与opengl相关的错误,但纹理是空白的(不同的颜色帧),虽然音频工作正常。

这是我的代码:Native OnDraw:

if (theGStPixelBuffer != 0) {

    glBindTexture (GL_TEXTURE_2D, s_texture);

    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

    glPixelStorei( GL_UNPACK_ALIGNMENT, 2);

    glTexSubImage2D (GL_TEXTURE_2D, 0, 0, 0, theTexWidth,
        theTexHeight, GL_RGB, GL_UNSIGNED_BYTE,
        GST_BUFFER_DATA(theGStPixelBuffer));

    check_gl_error("glTexSubImage2D");

    theGStPixelBuffer = 0;

}

glDrawTexiOES(0, 0, 0, theTexWidth, theTexHeight);
check_gl_error("glDrawTexiOES")

【问题讨论】:

    标签: android opengl-es gstreamer


    【解决方案1】:

    我也遇到过同样的问题;你可以获取位图并使用 martix 类来调整位图的大小。

    【讨论】:

      猜你喜欢
      • 2011-09-23
      • 2020-01-24
      • 1970-01-01
      • 1970-01-01
      • 2011-11-05
      • 1970-01-01
      • 1970-01-01
      • 2015-08-03
      • 1970-01-01
      相关资源
      最近更新 更多