Search in sources :

Example 56 with SurfaceHolder

use of android.view.SurfaceHolder in project platform_frameworks_base by android.

the class EGLImpl method eglCreateWindowSurface.

public EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list) {
    Surface sur = null;
    if (native_window instanceof SurfaceView) {
        SurfaceView surfaceView = (SurfaceView) native_window;
        sur = surfaceView.getHolder().getSurface();
    } else if (native_window instanceof SurfaceHolder) {
        SurfaceHolder holder = (SurfaceHolder) native_window;
        sur = holder.getSurface();
    } else if (native_window instanceof Surface) {
        sur = (Surface) native_window;
    }
    long eglSurfaceId;
    if (sur != null) {
        eglSurfaceId = _eglCreateWindowSurface(display, config, sur, attrib_list);
    } else if (native_window instanceof SurfaceTexture) {
        eglSurfaceId = _eglCreateWindowSurfaceTexture(display, config, native_window, attrib_list);
    } else {
        throw new java.lang.UnsupportedOperationException("eglCreateWindowSurface() can only be called with an instance of " + "Surface, SurfaceView, SurfaceHolder or SurfaceTexture at the moment.");
    }
    if (eglSurfaceId == 0) {
        return EGL10.EGL_NO_SURFACE;
    }
    return new EGLSurfaceImpl(eglSurfaceId);
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceTexture(android.graphics.SurfaceTexture) SurfaceView(android.view.SurfaceView) Surface(android.view.Surface)

Example 57 with SurfaceHolder

use of android.view.SurfaceHolder in project platform_frameworks_base by android.

the class SurfaceHolderTarget method onBindToView.

@Override
public void onBindToView(View view) {
    if (view instanceof SurfaceView) {
        SurfaceHolder holder = ((SurfaceView) view).getHolder();
        if (holder == null) {
            throw new RuntimeException("Could not get SurfaceHolder from SurfaceView " + view + "!");
        }
        setSurfaceHolder(holder);
    } else {
        throw new IllegalArgumentException("View must be a SurfaceView!");
    }
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceView(android.view.SurfaceView)

Example 58 with SurfaceHolder

use of android.view.SurfaceHolder in project libgdx by libgdx.

the class GLSurfaceViewAPI18 method init.

private void init() {
    // Install a SurfaceHolder.Callback so we get notified when the
    // underlying surface is created and destroyed
    SurfaceHolder holder = getHolder();
    holder.addCallback(this);
    int sdkVersion = android.os.Build.VERSION.SDK_INT;
    // setFormat is done by SurfaceView in SDK 2.3 and newer.
    if (sdkVersion <= 8) {
        // SDK 2.2 or older
        holder.setFormat(PixelFormat.RGB_565);
    }
// setType is not needed for SDK 2.0 or newer. Uncomment this
// statement if back-porting this code to older SDKs.
// holder.setType(SurfaceHolder.SURFACE_TYPE_GPU);
}
Also used : SurfaceHolder(android.view.SurfaceHolder)

Example 59 with SurfaceHolder

use of android.view.SurfaceHolder in project AndroidSDK-RecipeBook by gabu.

the class Recipe066 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // フルスクリーン表示にします
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    // タイトルバーを非表示にします
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);
    // プレビューのためSurfaceHolderに
    // SURFACE_TYPE_PUSH_BUFFERSをセット
    mCameraView = (SurfaceView) findViewById(R.id.camera_view);
    SurfaceHolder holder = mCameraView.getHolder();
    holder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS);
}
Also used : SurfaceHolder(android.view.SurfaceHolder)

Example 60 with SurfaceHolder

use of android.view.SurfaceHolder in project android-zxing by PearceXu.

the class CaptureActivity method onPause.

@Override
protected void onPause() {
    if (handler != null) {
        handler.quitSynchronously();
        handler = null;
    }
    inactivityTimer.onPause();
    ambientLightManager.stop();
    beepManager.close();
    cameraManager.closeDriver();
    // historyManager = null; // Keep for onActivityResult
    if (!hasSurface) {
        SurfaceView surfaceView = (SurfaceView) findViewById(R.id.preview_view);
        SurfaceHolder surfaceHolder = surfaceView.getHolder();
        surfaceHolder.removeCallback(this);
    }
    super.onPause();
}
Also used : SurfaceHolder(android.view.SurfaceHolder) SurfaceView(android.view.SurfaceView)

Aggregations

SurfaceHolder (android.view.SurfaceHolder)189 SurfaceView (android.view.SurfaceView)62 LargeTest (android.test.suitebuilder.annotation.LargeTest)50 Parameters (android.hardware.Camera.Parameters)37 IOException (java.io.IOException)29 MediaPlayer (android.media.MediaPlayer)17 Surface (android.view.Surface)16 SurfaceTexture (android.graphics.SurfaceTexture)14 CamcorderProfile (android.media.CamcorderProfile)13 MediaRecorder (android.media.MediaRecorder)13 Camera (android.hardware.Camera)9 OverlayData (android.media.videoeditor.VideoEditor.OverlayData)9 Paint (android.graphics.Paint)8 AudioManager (android.media.AudioManager)8 SharedPreferences (android.content.SharedPreferences)7 MediaVideoItem (android.media.videoeditor.MediaVideoItem)7 CameraManager (com.google.zxing.client.android.camera.CameraManager)7 Intent (android.content.Intent)6 VideoEditor (android.media.videoeditor.VideoEditor)6 MediaProcessingProgressListener (android.media.videoeditor.VideoEditor.MediaProcessingProgressListener)6