public void onSurfaceChanged(GL10 glUnused,int width,int height){
  Log.d(TAG,"Surface size: " + width + "x"+ height);
  int video_width=mMediaPlayer.getVideoWidth();
  int video_height=mMediaPlayer.getVideoHeight();
  Log.d(TAG,"Video size: " + video_width + "x"+ video_height);
  GLES20.glViewport(0,0,video_width,video_height);
  mWidth=Math.min(VideoDumpConfig.MAX_DUMP_WIDTH,video_width);
  mHeight=Math.min(VideoDumpConfig.MAX_DUMP_HEIGHT,video_height);
  mStartX=video_width / mWidth / 2 * mWidth;
  mStartY=video_height / mHeight / 2 * mHeight;
  Log.d(TAG,"dumping block start at (" + mStartX + ","+ mStartY+ ") "+ "size "+ mWidth+ "x"+ mHeight);
  int image_size=mWidth * mHeight * VideoDumpConfig.BYTES_PER_PIXEL;
  mBuffer=ByteBuffer.allocate(image_size);
  int bpp[]=new int[3];
  GLES20.glGetIntegerv(GLES20.GL_RED_BITS,bpp,0);
  GLES20.glGetIntegerv(GLES20.GL_GREEN_BITS,bpp,1);
  GLES20.glGetIntegerv(GLES20.GL_BLUE_BITS,bpp,2);
  Log.d(TAG,"rgb bits: " + bpp[0] + "-"+ bpp[1]+ "-"+ bpp[2]);
  Properties prop=new Properties();
  prop.setProperty("width",Integer.toString(mWidth));
  prop.setProperty("height",Integer.toString(mHeight));
  prop.setProperty("startX",Integer.toString(mStartX));
  prop.setProperty("startY",Integer.toString(mStartY));
  prop.setProperty("bytesPerPixel",Integer.toString(VideoDumpConfig.BYTES_PER_PIXEL));
  prop.setProperty("frameRate",Integer.toString(VideoDumpConfig.FRAME_RATE));
  try {
    prop.storeToXML(new FileOutputStream(VideoDumpConfig.ROOT_DIR + VideoDumpConfig.PROPERTY_FILE),"");
  }
 catch (  java.io.IOException e) {
    Log.e(TAG,e.getMessage(),e);
  }
}

public void onSurfaceChanged ( GL10 glUnused , int width , int height ) { Log . d ( TAG , "Surface size: " + width + "x" + height ) ; int video_width = mMediaPlayer . getVideoWidth ( ) ; int video_height = mMediaPlayer . getVideoHeight ( ) ; Log . d ( TAG , "Video size: " + video_width + "x" + video_height ) ; GLES20 . glViewport ( 0 , 0 , video_width , video_height ) ; mWidth = Math . min ( VideoDumpConfig . MAX_DUMP_WIDTH , video_width ) ; mHeight = Math . min ( VideoDumpConfig . MAX_DUMP_HEIGHT , video_height ) ; mStartX = video_width / mWidth / 2 * mWidth ; mStartY = video_height / mHeight / 2 * mHeight ; Log . d ( TAG , "dumping block start at (" + mStartX + "," + mStartY + ") " + "size " + mWidth + "x" + mHeight ) ; int image_size = mWidth * mHeight * VideoDumpConfig . BYTES_PER_PIXEL ; mBuffer = ByteBuffer . allocate ( image_size ) ; int bpp [ ] = new int [ 3 ] ; GLES20 . glGetIntegerv ( GLES20 . GL_RED_BITS , bpp , 0 ) ; GLES20 . glGetIntegerv ( GLES20 . GL_GREEN_BITS , bpp , 1 ) ; GLES20 . glGetIntegerv ( GLES20 . GL_BLUE_BITS , bpp , 2 ) ; Log . d ( TAG , "rgb bits: " + bpp [ 0 ] + "-" + bpp [ 1 ] + "-" + bpp [ 2 ] ) ; Properties prop = new Properties ( ) ; prop . setProperty ( "width" , Integer . toString ( mWidth ) ) ; prop . setProperty ( "height" , Integer . toString ( mHeight ) ) ; prop . setProperty ( "startX" , Integer . toString ( mStartX ) ) ; prop . setProperty ( "startY" , Integer . toString ( mStartY ) ) ; prop . setProperty ( "bytesPerPixel" , Integer . toString ( VideoDumpConfig . BYTES_PER_PIXEL ) ) ; prop . setProperty ( "frameRate" , Integer . toString ( VideoDumpConfig . FRAME_RATE ) ) ; try { prop . storeToXML ( new FileOutputStream ( VideoDumpConfig . ROOT_DIR + VideoDumpConfig . PROPERTY_FILE ) , "" ) ; } catch ( java . io . IOException e ) { Log . e ( TAG , e . getMessage ( ) , e ) ; } }
called when the surface changed size . called after the surface is created and whenever the opengl surface size changes .
