Kaidul

Untitled

Sep 14th, 2015
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.57 KB | None | 0 0
  1. package com.eyeball.sipcontact;
  2.  
  3. import android.content.Context;
  4. import android.graphics.SurfaceTexture;
  5. import android.util.Log;
  6. import android.view.TextureView;
  7.  
  8. public class GLVideoTextureView extends TextureView implements TextureView.SurfaceTextureListener {
  9.    
  10.     private static boolean VERBOSE = true; // enable heavy logging
  11.     private static final String TAG = GLVideoTextureView.class.getSimpleName();
  12.     private VideoRenderer mVideoRenderer;
  13.    
  14.     private static native void OpenGLResize(int width, int height);
  15.     private static native void OpenGLRender();
  16.     private static native void OpenGLPause(boolean pause);
  17.    
  18.     public GLVideoTextureView(Context context) {
  19.         super(context);
  20.         setSurfaceTextureListener(this);
  21.         mVideoRenderer = new VideoRenderer();
  22.     }
  23.  
  24.     @Override
  25.     public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
  26.         Log.d(TAG, "onSurfaceTextureAvailable(" + width + " x " + height + ")");
  27.         mVideoRenderer.start();
  28.     }
  29.  
  30.     @Override
  31.     public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) {
  32.         Log.d(TAG, "onSurfaceTextureAvailable(" + width + " x " + height + ")");
  33.         OpenGLResize(width, height);
  34.     }
  35.  
  36.     @Override
  37.     public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
  38.         Log.d(TAG, "onSurfaceTextureDestroyed");
  39.         return false;
  40.     }
  41.  
  42.     @Override
  43.     public void onSurfaceTextureUpdated(SurfaceTexture surface) {
  44.         // TODO Auto-generated method stub
  45.        
  46.     }
  47.    
  48.     private static class VideoRenderer extends Thread {
  49.         @Override
  50.         public void run() {
  51.             OpenGLRender();
  52.         }
  53.     };
  54.    
  55. }
Advertisement
Add Comment
Please, Sign In to add comment