当前位置: 首页>>代码示例>>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;未经允许,请勿转载。