当前位置: 首页>>代码示例>>Java>>正文


Java SurfaceTexture类代码示例

本文整理汇总了Java中android.graphics.SurfaceTexture的典型用法代码示例。如果您正苦于以下问题:Java SurfaceTexture类的具体用法?Java SurfaceTexture怎么用?Java SurfaceTexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SurfaceTexture类属于android.graphics包,在下文中一共展示了SurfaceTexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onSurfaceTextureAvailable

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i1) {
    Log.i(TAG, "onSurfaceTextureAvailable [" + this.hashCode() + "] ");
    if (savedSurfaceTexture == null) {
        savedSurfaceTexture = surfaceTexture;
        prepare();
    } else {
        textureView.setSurfaceTexture(savedSurfaceTexture);
    }
}
 
开发者ID:qq1210514049,项目名称:ListVideoPlayer,代码行数:11,代码来源:MediaManager.java

示例2: open

import android.graphics.SurfaceTexture; //导入依赖的package包/类
public void open() {
    try {
        CameraManager manager = (CameraManager) mActivity.getSystemService(Context.CAMERA_SERVICE);
        for (String cameraId : manager.getCameraIdList()) {
            CameraCharacteristics characteristics = manager.getCameraCharacteristics(cameraId);
            if (characteristics.get(CameraCharacteristics.LENS_FACING) == CameraCharacteristics.LENS_FACING_BACK) {
                StreamConfigurationMap map = characteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
                mCameraSize = map.getOutputSizes(SurfaceTexture.class)[0];

                HandlerThread thread = new HandlerThread("OpenCamera");
                thread.start();
                Handler backgroundHandler = new Handler(thread.getLooper());

                manager.openCamera(cameraId, mCameraDeviceCallback, null);

                // カメラの物理的な情報を得る
                mCameraCharacteristics = manager.getCameraCharacteristics( cameraId );
                return;
            }
        }
    } catch (CameraAccessException e) {
        e.printStackTrace();
    }
}
 
开发者ID:jphacks,项目名称:TK_1701,代码行数:25,代码来源:Camera2.java

示例3: onOpened

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void onOpened(CameraDevice camera) {
  checkIsOnCameraThread();

  Logging.d(TAG, "Camera opened.");
  cameraDevice = camera;

  final SurfaceTexture surfaceTexture = surfaceTextureHelper.getSurfaceTexture();
  surfaceTexture.setDefaultBufferSize(captureFormat.width, captureFormat.height);
  surface = new Surface(surfaceTexture);
  List<Surface> surfaces = new ArrayList<Surface>();
  surfaces.add(surface);
  if (mediaRecorderSurface != null) {
    Logging.d(TAG, "Add MediaRecorder surface to capture session.");
    surfaces.add(mediaRecorderSurface);
  }
  try {
    camera.createCaptureSession(surfaces, new CaptureSessionCallback(), cameraThreadHandler);
  } catch (CameraAccessException e) {
    reportError("Failed to create capture session. " + e);
    return;
  }
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:24,代码来源:Camera2Session.java

示例4: open

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public Point open(SurfaceTexture surface) {
    try {
        if(!extractMedia()){
            return new Point(0,0);
        }
        mFrameSem=new Semaphore(0);
        mDecodeSem=new Semaphore(1);
        videoProvideEndFlag=false;
        isUserWantToStop=false;
        mAudioEncodeTrack=mStore.addTrack(mExtractor.getTrackFormat(mAudioDecodeTrack));
        MediaFormat format=mExtractor.getTrackFormat(mVideoDecodeTrack);
        mVideoDecoder = MediaCodec.createDecoderByType(format.getString(MediaFormat.KEY_MIME));
        mVideoDecoder.configure(format,new Surface(surface),null,0);
        mVideoDecoder.start();
        startDecodeThread();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return mVideoSize;
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:22,代码来源:Mp4Provider.java

示例5: bindToMediaPlayer

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void bindToMediaPlayer(IMediaPlayer mp) {
    if (mp == null)
        return;

    if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) &&
            (mp instanceof ISurfaceTextureHolder)) {
        ISurfaceTextureHolder textureHolder = (ISurfaceTextureHolder) mp;
        mTextureView.mSurfaceCallback.setOwnSurfaceTexture(false);

        SurfaceTexture surfaceTexture = textureHolder.getSurfaceTexture();
        if (surfaceTexture != null) {
            mTextureView.setSurfaceTexture(surfaceTexture);
        } else {
            textureHolder.setSurfaceTexture(mSurfaceTexture);
            textureHolder.setSurfaceTextureHost(mTextureView.mSurfaceCallback);
        }
    } else {
        mp.setSurface(openSurface());
    }
}
 
开发者ID:SethWen,项目名称:GestureVideoView,代码行数:22,代码来源:TextureRenderView.java

示例6: EglSurface

import android.graphics.SurfaceTexture; //导入依赖的package包/类
EglSurface(final EGLEnvironment egl, final Object surface) {
    if (!(surface instanceof SurfaceView)
            && !(surface instanceof Surface)
            && !(surface instanceof SurfaceHolder)
            && !(surface instanceof SurfaceTexture))
        throw new IllegalArgumentException("unsupported surface");
    mEgl = egl;
    mEglSurface = mEgl.createWindowSurface(surface);
    mWidth = mEgl.querySurface(mEglSurface, EGL14.EGL_WIDTH);
    mHeight = mEgl.querySurface(mEglSurface, EGL14.EGL_HEIGHT);
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:12,代码来源:EGLEnvironment.java

示例7: onSurfaceTextureAvailable

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) {
    mSurfaceTexture = surface;
    mIsFormatChanged = false;
    mWidth = 0;
    mHeight = 0;

    ISurfaceHolder surfaceHolder = new InternalSurfaceHolder(mWeakRenderView.get(), surface);
    for (IRenderCallback renderCallback : mRenderCallbackMap.keySet()) {
        renderCallback.onSurfaceCreated(surfaceHolder, 0, 0);
    }
}
 
开发者ID:xinpianchang,项目名称:NSMPlayer-Android,代码行数:13,代码来源:TextureRenderView.java

示例8: onSurfaceTextureDestroyed

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
    synchronized (mCameraStateLock) {
        mPreviewSize = null;
    }
    return true;
}
 
开发者ID:OkayCamera,项目名称:OkayCamera-Android,代码行数:8,代码来源:Camera2RawFragment.java

示例9: initSurfaceTexture

import android.graphics.SurfaceTexture; //导入依赖的package包/类
private void initSurfaceTexture() {
    Log.d(LOGTAG, "initSurfaceTexture");
    deleteSurfaceTexture();
    initTexOES(texCamera);
    mSTexture = new SurfaceTexture(texCamera[0]);
    mSTexture.setOnFrameAvailableListener(this);
}
 
开发者ID:beast,项目名称:react-native-scan-doc,代码行数:8,代码来源:CameraGLRendererBase.java

示例10: InternalSurfaceHolder

import android.graphics.SurfaceTexture; //导入依赖的package包/类
public InternalSurfaceHolder(@NonNull TextureRenderView textureView,
                             @Nullable SurfaceTexture surfaceTexture,
                             @NonNull ISurfaceTextureHost surfaceTextureHost) {
    mTextureView = textureView;
    mSurfaceTexture = surfaceTexture;
    mSurfaceTextureHost = surfaceTextureHost;
}
 
开发者ID:TongmingWu,项目名称:BLPlayer,代码行数:8,代码来源:TextureRenderView.java

示例11: setVideoTextureView

import android.graphics.SurfaceTexture; //导入依赖的package包/类
/**
 * Sets the {@link TextureView} onto which video will be rendered. The player will track the
 * lifecycle of the surface automatically.
 *
 * @param textureView The texture view.
 */
public void setVideoTextureView(TextureView textureView) {
  removeSurfaceCallbacks();
  this.textureView = textureView;
  if (textureView == null) {
    setVideoSurfaceInternal(null, true);
  } else {
    if (textureView.getSurfaceTextureListener() != null) {
      Log.w(TAG, "Replacing existing SurfaceTextureListener.");
    }
    SurfaceTexture surfaceTexture = textureView.getSurfaceTexture();
    setVideoSurfaceInternal(surfaceTexture == null ? null : new Surface(surfaceTexture), true);
    textureView.setSurfaceTextureListener(componentListener);
  }
}
 
开发者ID:sanjaysingh1990,项目名称:Exoplayer2Radio,代码行数:21,代码来源:SimpleExoPlayer.java

示例12: onCameraSurfaceDestroy

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void onCameraSurfaceDestroy(SurfaceTexture surfaceTexture) {
    Log.d(TAG, "onCameraSurfaceDestroy");
    isSurfaceReady = false;
    mCamera.stopPreview();
    mCamera.release();
    if (mVideoRecorder.isRecording()) {
        mVideoRecorder.stop();
    }
}
 
开发者ID:LeonHover,项目名称:MediaCodecRecorder,代码行数:11,代码来源:RecordingActivity.java

示例13: releaseSurfaceTexture

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void releaseSurfaceTexture(SurfaceTexture surfaceTexture) {
    if (surfaceTexture == null) {
        Log.d(TAG, "releaseSurfaceTexture: null");
    } else if (mDidDetachFromWindow) {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): release detached SurfaceTexture");
            surfaceTexture.release();
        } else {
            Log.d(TAG, "releaseSurfaceTexture: didDetachFromWindow(): already released by TextureView");
        }
    } else if (mWillDetachFromWindow) {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        } else {
            Log.d(TAG, "releaseSurfaceTexture: willDetachFromWindow(): will released by TextureView");
        }
    } else {
        if (surfaceTexture != mSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: alive: release different SurfaceTexture");
            surfaceTexture.release();
        } else if (!mOwnSurfaceTexture) {
            Log.d(TAG, "releaseSurfaceTexture: alive: re-attach SurfaceTexture to TextureView");
            setOwnSurfaceTexture(true);
        } else {
            Log.d(TAG, "releaseSurfaceTexture: alive: will released by TextureView");
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:TextureRenderView.java

示例14: startPreview

import android.graphics.SurfaceTexture; //导入依赖的package包/类
public static void startPreview(SurfaceTexture surfaceTexture){
	try {
		mCamera.setPreviewTexture(surfaceTexture);
		mCamera.startPreview();
	} catch (IOException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}	
}
 
开发者ID:smartbeng,项目名称:PaoMovie,代码行数:10,代码来源:CameraEngine.java

示例15: onSurfaceCreated

import android.graphics.SurfaceTexture; //导入依赖的package包/类
@Override
public void onSurfaceCreated(GL10 gl, EGLConfig config) {
    GLES20.glClearColor(0.0f, 1.0f, 0.0f, 0.0f);
    GLES20.glDisable(GLES20.GL_DEPTH_TEST);
    mTexture = OpenGLUtils.genOesTexture();
    mGLImageView.setImageTexture(mTexture);

    mSurfaceTexture = new SurfaceTexture(mTexture);
    mSurfaceTexture.setOnFrameAvailableListener(this);
    mVideoPlayer.setOutSurface(new Surface(mSurfaceTexture));
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:12,代码来源:VideoPlayFragment.java


注:本文中的android.graphics.SurfaceTexture类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。