Java 类android.hardware.display.VirtualDisplay 实例源码

项目:ScreenCapture    文件:MainActivity.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("MainActivity",
            DISPLAY_WIDTH, DISPLAY_HEIGHT, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mMediaRecorder.getSurface(), null /*Callbacks*/, null
            /*Handler*/);
}
项目:androidStreamer    文件:ScreenCaptureActivity.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("ScreenCaptureActivity",
            DISPLAY_WIDTH, DISPLAY_HEIGHT, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mMediaRecorder.getSurface(), null /*Callbacks*/, null
            /*Handler*/);
}
项目:ProyectoAndroid    文件:Presenter.java   
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("MainActivity",
            DISPLAY_WIDTH, DISPLAY_HEIGHT, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mMediaRecorder.getSurface(), null /*Callbacks*/, null
            /*Handler*/);
}
项目:screenrecorder    文件:RecorderService.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("MainActivity",
            WIDTH, HEIGHT, DENSITY_DPI,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mMediaRecorder.getSurface(), null /*Callbacks*/, null
            /*Handler*/);
}
项目:DeviceConnect-Android    文件:HostDeviceScreenCast.java   
private void setupVirtualDisplay() {
    setupVirtualDisplay(mPreviewSize, new VirtualDisplay.Callback() {
        @Override
        public void onPaused() {
        }

        @Override
        public void onResumed() {
        }

        @Override
        public void onStopped() {
        }
    });
}
项目:DeviceConnect-Android    文件:HostDeviceScreenCast.java   
private void setupVirtualDisplay(final PictureSize size, final VirtualDisplay.Callback callback) {
    int w = size.getWidth();
    int h = size.getHeight();

    WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
    DisplayMetrics dm = new DisplayMetrics();
    wm.getDefaultDisplay().getMetrics(dm);
    if (dm.widthPixels > dm.heightPixels) {
        if (w < h) {
            w = size.getHeight();
            h = size.getWidth();
        }
    } else {
        if (w > h) {
            w = size.getHeight();
            h = size.getWidth();
        }
    }

    mImageReader = ImageReader.newInstance(w, h, PixelFormat.RGBA_8888, 4);
    mVirtualDisplay = mMediaProjection.createVirtualDisplay(
            "Android Host Screen",
            w,
            h,
            mDisplayDensityDpi,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mImageReader.getSurface(), callback, null);
}
项目:ScreenRecoder    文件:ScreenRecoder.java   
@Override
public void run() {
    MediaFormat format = MediaFormat.createVideoFormat("video/avc",
            mWidth, mHeight);
    format.setInteger(MediaFormat.KEY_COLOR_FORMAT,
            MediaCodecInfo.CodecCapabilities.COLOR_FormatSurface);
    format.setInteger(MediaFormat.KEY_BIT_RATE, BIT_RATE);
    format.setInteger(MediaFormat.KEY_FRAME_RATE, FRAME_RATE);
    format.setInteger(MediaFormat.KEY_I_FRAME_INTERVAL,
            I_FRAME_INTERVAL);

    MediaCodec codec = MediaCodec.createEncoderByType("video/avc");
    codec.configure(format, null, null,
            MediaCodec.CONFIGURE_FLAG_ENCODE);
    Surface surface = codec.createInputSurface();
    codec.start();

    VirtualDisplay virtualDisplay = mDisplayManager
            .createVirtualDisplay(DISPLAY_NAME, mWidth, mHeight,
                    mDensityDpi, surface,
                    DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC);

    if (virtualDisplay != null) {
        stream(codec);
        virtualDisplay.release();
    }

    codec.signalEndOfInputStream();
    codec.stop();
}
项目:FloatingNew    文件:RecordingScreen.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("MainActivity",
            DISPLAY_WIDTH, DISPLAY_HEIGHT, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mMediaRecorder.getSurface(), null /*Callbacks*/, null /*Handler*/);
}
项目:MoodSync    文件:MirroringHelper.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("LIFX",
            Config.VIRTUAL_DISPLAY_WIDTH, Config.VIRTUAL_DISPLAY_HEIGHT, mMetrics.densityDpi,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            null, null /*Callbacks*/, null /*Handler*/);
}
项目:ApkLauncher    文件:MediaProjectionDemo.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("ScreenSharingDemo",
            mDisplayWidth, mDisplayHeight, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mSurface, null /*Callbacks*/, null /*Handler*/);
}
项目:felix-on-android    文件:MediaProjectionDemo.java   
private VirtualDisplay createVirtualDisplay() {
    return mMediaProjection.createVirtualDisplay("ScreenSharingDemo",
            mDisplayWidth, mDisplayHeight, mScreenDensity,
            DisplayManager.VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR,
            mSurface, null /*Callbacks*/, null /*Handler*/);
}