本文整理匯總了Java中android.view.Surface.release方法的典型用法代碼示例。如果您正苦於以下問題:Java Surface.release方法的具體用法?Java Surface.release怎麽用?Java Surface.release使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.Surface
的用法示例。
在下文中一共展示了Surface.release方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testSetPresentationTime
import android.view.Surface; //導入方法依賴的package包/類
/**
* Test for {@link GLTools#setPresentationTime(EGLDisplay, EGLSurface, long)} .
* @throws Exception by some fails
*/
@Test
public final void testSetPresentationTime() throws Exception {
final EGLDisplay eglDisplay = GLTools.newDisplay();
final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
final EGLSurface eglSurface =
GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);
final int txt = GLTools.newTexture(TEXTURE_LEVEL);
final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
final Surface surface = new Surface(surfaceTexture);
final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);
GLTools.setPresentationTime(eglDisplay, window, PRESENTATION_TIME);
GLTools.closeSurface(eglDisplay, window);
surface.release();
surfaceTexture.release();
GLTools.closeTexture(txt, TEXTURE_LEVEL);
GLTools.closeSurface(eglDisplay, eglSurface);
GLTools.closeContext(eglDisplay, eglContext);
GLTools.closeDisplay(eglDisplay);
}
示例2: testSwapBuffers
import android.view.Surface; //導入方法依賴的package包/類
/**
* Test for {@link GLTools#swapBuffers(EGLDisplay, EGLSurface)}.
* @throws Exception by some fails
*/
@Test
public final void testSwapBuffers() throws Exception {
final EGLDisplay eglDisplay = GLTools.newDisplay();
final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
final EGLSurface eglSurface =
GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);
try {
GLTools.swapBuffers(eglDisplay, eglSurface);
} catch (RuntimeException exception) {
final int txt = GLTools.newTexture(TEXTURE_LEVEL);
final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
final Surface surface = new Surface(surfaceTexture);
final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);
GLTools.makeCurrent(eglDisplay, window, eglContext);
GLTools.swapBuffers(eglDisplay, window);
GLTools.closeSurface(eglDisplay, window);
surface.release();
surfaceTexture.release();
GLTools.closeTexture(txt, TEXTURE_LEVEL);
}
GLTools.closeSurface(eglDisplay, eglSurface);
GLTools.closeContext(eglDisplay, eglContext);
GLTools.closeDisplay(eglDisplay);
}
示例3: clickPlayStop
import android.view.Surface; //導入方法依賴的package包/類
/**
* onClick handler for "play"/"stop" button.
*/
public void clickPlayStop(@SuppressWarnings("unused") View unused) {
if (mShowStopLabel) {
Log.d(TAG, "stopping movie");
stopPlayback();
// Don't update the controls here -- let the task thread do it after the movie has
// actually stopped.
//mShowStopLabel = false;
//updateControls();
} else {
if (mPlayTask != null) {
Log.w(TAG, "movie already playing");
return;
}
Log.d(TAG, "starting movie");
SpeedControlCallback callback = new SpeedControlCallback();
if (((CheckBox) findViewById(R.id.locked60fps_checkbox)).isChecked()) {
// TODO: consider changing this to be "free running" mode
callback.setFixedPlaybackRate(60);
}
SurfaceTexture st = mTextureView.getSurfaceTexture();
Surface surface = new Surface(st);
MoviePlayer player = null;
try {
player = new MoviePlayer(
new File(getFilesDir(), mMovieFiles[mSelectedMovie]), surface, callback);
} catch (IOException ioe) {
Log.e(TAG, "Unable to play movie", ioe);
surface.release();
return;
}
adjustAspectRatio(player.getVideoWidth(), player.getVideoHeight());
mPlayTask = new MoviePlayer.PlayTask(player, this);
if (((CheckBox) findViewById(R.id.loopPlayback_checkbox)).isChecked()) {
mPlayTask.setLoopMode(true);
}
mShowStopLabel = true;
updateControls();
mPlayTask.execute();
}
}
示例4: clickPlayStop
import android.view.Surface; //導入方法依賴的package包/類
/**
* onClick handler for "play"/"stop" button.
*/
public void clickPlayStop(@SuppressWarnings("unused") View unused) {
if (mShowStopLabel) {
Log.d(TAG, "stopping movie");
stopPlayback();
// Don't update the controls here -- let the task thread do it after the movie has
// actually stopped.
//mShowStopLabel = false;
//updateControls();
} else {
if (mPlayTask != null) {
Log.w(TAG, "movie already playing");
return;
}
Log.d(TAG, "starting movie");
SpeedControlCallback callback = new SpeedControlCallback();
SurfaceHolder holder = mSurfaceView.getHolder();
Surface surface = holder.getSurface();
// Don't leave the last frame of the previous video hanging on the screen.
// Looks weird if the aspect ratio changes.
clearSurface(surface);
MoviePlayer player = null;
try {
player = new MoviePlayer(
new File(getFilesDir(), mMovieFiles[mSelectedMovie]), surface, callback);
} catch (IOException ioe) {
Log.e(TAG, "Unable to play movie", ioe);
surface.release();
return;
}
AspectFrameLayout layout = (AspectFrameLayout) findViewById(R.id.playMovie_afl);
int width = player.getVideoWidth();
int height = player.getVideoHeight();
layout.setAspectRatio((double) width / height);
//holder.setFixedSize(width, height);
mPlayTask = new MoviePlayer.PlayTask(player, this);
mShowStopLabel = true;
updateControls();
mPlayTask.execute();
}
}
示例5: run
import android.view.Surface; //導入方法依賴的package包/類
@Override
public void run() {
try {
mGifInfoHandle = mInputSource.open();
} catch (IOException ex) {
mIOException = ex;
return;
}
GifTextureView.super.setSurfaceTextureListener(this);
final boolean isSurfaceAvailable = isAvailable();
isSurfaceValid.set(isSurfaceAvailable);
if (isSurfaceAvailable) {
post(new Runnable() {
@Override
public void run() {
updateTextureViewSize(mGifInfoHandle);
}
});
}
mGifInfoHandle.setSpeedFactor(mSpeedFactor);
while (!isInterrupted()) {
try {
isSurfaceValid.block();
} catch (InterruptedException e) {
break;
}
final SurfaceTexture surfaceTexture = getSurfaceTexture();
if (surfaceTexture == null) {
continue;
}
final Surface surface = new Surface(surfaceTexture);
try {
mGifInfoHandle
.bindSurface(surface, mSavedState, isOpaque());
} finally {
surface.release();
}
}
mGifInfoHandle.recycle();
}