當前位置: 首頁>>代碼示例>>Java>>正文


Java Surface.isValid方法代碼示例

本文整理匯總了Java中android.view.Surface.isValid方法的典型用法代碼示例。如果您正苦於以下問題:Java Surface.isValid方法的具體用法?Java Surface.isValid怎麽用?Java Surface.isValid使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.Surface的用法示例。


在下文中一共展示了Surface.isValid方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setVideoResourceId

import android.view.Surface; //導入方法依賴的package包/類
/**
 * Sets the raw resource ID of video to play.
 *
 * @param id The raw resource ID.
 */
public void setVideoResourceId(@RawRes int id) {
    if (id == mVideoResourceId) {
        return;
    }
    mVideoResourceId = id;
    Surface surface = mSurfaceView.getHolder().getSurface();
    if (surface != null && surface.isValid()) {
        closeVideo();
        openVideo(surface);
    }
}
 
開發者ID:googlesamples,項目名稱:android-PictureInPicture,代碼行數:17,代碼來源:MovieView.java

示例2: maybeStartHostedTest

import android.view.Surface; //導入方法依賴的package包/類
private void maybeStartHostedTest() {
  if (hostedTest == null || hostedTestStarted) {
    return;
  }
  Surface surface = surfaceView.getHolder().getSurface();
  if (surface != null && surface.isValid()) {
    hostedTestStarted = true;
    Log.d(TAG, "Starting test.");
    hostedTest.onStart(this, surface);
    checkCanStopRunnable.startChecking();
  }
}
 
開發者ID:ashwanijanghu,項目名稱:ExoPlayer-Offline,代碼行數:13,代碼來源:HostActivity.java

示例3: setOutputSurface

import android.view.Surface; //導入方法依賴的package包/類
/**
 * Set the output surface to consume the stream of edited camera frames. This is probably
 * from a SurfaceView or TextureView. Please make sure it's valid.
 *
 * @param outputSurface a valid surface to consume a stream of edited frames from the camera
 */
@AnyThread
@Override
public synchronized void setOutputSurface(Surface outputSurface) {
    if (isRunning()) {
        if (!outputSurface.isValid()) {
            throw new IllegalArgumentException("output was invalid");
        }
        rgbOutAlloc.setSurface(outputSurface);
        outputSurfaceIsSet = true;
        Log.d(TAG, "output surface was set");
    }
}
 
開發者ID:lydia-schiff,項目名稱:hella-renderscript,代碼行數:19,代碼來源:RsCameraPreviewRenderer.java

示例4: startBouncing

import android.view.Surface; //導入方法依賴的package包/類
private void startBouncing() {
    final Surface surface = mSurfaceView2.getHolder().getSurface();
    if (surface == null || !surface.isValid()) {
        Log.w(TAG, "mSurfaceView2 is not ready");
        return;
    }
    mBounceThread = new Thread() {
        @Override
        public void run() {
            while (true) {
                long startWhen = System.nanoTime();
                for (int i = 0; i < BOUNCE_STEPS; i++) {
                    if (!mBouncing) return;
                    drawBouncingCircle(surface, i);
                }
                for (int i = BOUNCE_STEPS; i > 0; i--) {
                    if (!mBouncing) return;
                    drawBouncingCircle(surface, i);
                }
                long duration = System.nanoTime() - startWhen;
                double framesPerSec = 1000000000.0 / (duration / (BOUNCE_STEPS * 2.0));
                Log.d(TAG, "Bouncing at " + framesPerSec + " fps");
            }
        }
    };
    mBouncing = true;
    mBounceThread.setName("Bouncer");
    mBounceThread.start();
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:30,代碼來源:MultiSurfaceActivity.java

示例5: startCamera

import android.view.Surface; //導入方法依賴的package包/類
@Override
    public void startCamera() {
        try {
            CameraCharacteristics characteristics = cameraManager.getCameraCharacteristics(cameraID);
            StreamConfigurationMap configMap = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);

            int width = textureView.getWidth();
            int height = textureView.getHeight();

            //設置一個合適的預覽尺寸,防止圖像拉伸
//            previewSize = getPreferredPreviewSize(configMap.getOutputSizes(SurfaceTexture.class), width, height);
            previewSize = Util.getPreferredPreviewSize(configMap.getOutputSizes(ImageFormat.JPEG), width, height);
            surfaceTexture.setDefaultBufferSize(previewSize.getWidth(),previewSize.getHeight());
            Log.i(TAG, "previewSize info:" + previewSize.getWidth() + "x" + previewSize.getHeight());

            surface = new Surface(surfaceTexture);

            builder =cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);

            if (surface.isValid()) {
                builder.addTarget(surface);
            }
            Log.i(TAG, "mTextureView info:" + textureView.getWidth() + "x" + textureView.getHeight());

            cameraDevice.createCaptureSession(Arrays.asList(surface),sessionStateCallback,null);

        } catch (CameraAccessException e) {
            e.printStackTrace();
        }
    }
 
開發者ID:lazyparser,項目名稱:xbot_head,代碼行數:31,代碼來源:InteractionFragment.java

示例6: setSurface

import android.view.Surface; //導入方法依賴的package包/類
private void setSurface(Surface surface) {
    if (surface.isValid() && getNativeSurface(mId) == null) {
        mSurface = surface;
        setNativeSurface(mId, mSurface);
        onSurfaceCreated();
    }
}
 
開發者ID:pedroSG94,項目名稱:vlc-example-streamplayer,代碼行數:8,代碼來源:AWindow.java


注:本文中的android.view.Surface.isValid方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。