android.graphics.SurfaceTexture#OnFrameAvailableListener ( )源码实例Demo

下面列出了android.graphics.SurfaceTexture#OnFrameAvailableListener ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@TargetApi(21)
private static void setOnFrameAvailableListener(
        SurfaceTexture surfaceTexture,
        SurfaceTexture.OnFrameAvailableListener listener,
        Handler handler) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        surfaceTexture.setOnFrameAvailableListener(listener, handler);
    } else {
        // The documentation states that the listener will be called on an arbitrary thread, but
        // in
        // pratice, it is always the thread on which the SurfaceTexture was constructed. There
        // are
        // assertions in place in case this ever changes. For API >= 21, we use the new API to
        // explicitly specify the handler.
        surfaceTexture.setOnFrameAvailableListener(listener);
    }
}
 
源代码2 项目: webrtc_android   文件: SurfaceTextureHelper.java
@TargetApi(21)
private static void setOnFrameAvailableListener(SurfaceTexture surfaceTexture,
    SurfaceTexture.OnFrameAvailableListener listener, Handler handler) {
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    surfaceTexture.setOnFrameAvailableListener(listener, handler);
  } else {
    // The documentation states that the listener will be called on an arbitrary thread, but in
    // pratice, it is always the thread on which the SurfaceTexture was constructed. There are
    // assertions in place in case this ever changes. For API >= 21, we use the new API to
    // explicitly specify the handler.
    surfaceTexture.setOnFrameAvailableListener(listener);
  }
}
 
源代码3 项目: SimpleVideoEdit   文件: OutputSurface.java
/**
 * Creates instances of TextureRender and SurfaceTexture, and a Surface associated
 * with the SurfaceTexture.
 */
private void setup(SurfaceTexture.OnFrameAvailableListener listener) {
    mTextureRender = new FrameBufferObjectRenderer(mFilter);
    mTextureRender.surfaceCreated();

    // Even if we don't access the SurfaceTexture after the constructor returns, we
    // still need to keep a reference to it.  The Surface doesn't retain a reference
    // at the Java level, so if we don't either then the object can get GCed, which
    // causes the native finalizer to run.
    if (VERBOSE) Log.d(TAG, "textureID=" + mTextureRender.getTextureId());
    mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());

    // This doesn't work if OutputSurface is created on the thread that CTS started for
    // these test cases.
    //
    // The CTS-created thread has a Looper, and the SurfaceTexture constructor will
    // create a Handler that uses it.  The "frame available" message is delivered
    // there, but since we're not a Looper-based thread we'll never see it.  For
    // this to do anything useful, OutputSurface must be created on a thread without
    // a Looper, so that SurfaceTexture uses the main application Looper instead.
    //
    // Java language note: passing "this" out of a constructor is generally unwise,
    // but we should be able to get away with it here.
    mSurfaceTexture.setOnFrameAvailableListener(listener);

    mSurface = new Surface(mSurfaceTexture);
    checkEglError("setup");
}
 
源代码4 项目: FuAgoraDemoDroid   文件: FuSurfaceTextureHelper.java
@TargetApi(21)
private static void setOnFrameAvailableListener(SurfaceTexture surfaceTexture, SurfaceTexture.OnFrameAvailableListener listener, Handler handler) {
    if (Build.VERSION.SDK_INT >= 21) {
        surfaceTexture.setOnFrameAvailableListener(listener, handler);
    } else {
        surfaceTexture.setOnFrameAvailableListener(listener);
    }
}
 
源代码5 项目: GPUVideo-android   文件: GlSurfaceTexture.java
public void setOnFrameAvailableListener(final SurfaceTexture.OnFrameAvailableListener l) {
    onFrameAvailableListener = l;
}
 
源代码6 项目: Mp4Composer-android   文件: GlSurfaceTexture.java
public void setOnFrameAvailableListener(final SurfaceTexture.OnFrameAvailableListener l) {
    onFrameAvailableListener = l;
}
 
源代码7 项目: SimpleVideoEdit   文件: OutputSurface.java
public OutputSurface(final SurfaceTexture.OnFrameAvailableListener listener) {
    setup(listener);
}
 
源代码8 项目: CameraRecorder-android   文件: GlSurfaceTexture.java
public void setOnFrameAvailableListener(final SurfaceTexture.OnFrameAvailableListener l) {
    onFrameAvailableListener = l;
}
 
源代码9 项目: Spectaculum   文件: ExternalSurfaceTexture.java
public void setOnFrameAvailableListener(SurfaceTexture.OnFrameAvailableListener l) {
    mOnFrameAvailableListener = l;
}