项目:ListVideoPlayer
文件:MediaManager.java
@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);
}
}
项目:TK_1701
文件:Camera2.java
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();
}
}
项目:VideoCRE
文件:Camera2Session.java
@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;
}
}
项目:AAVT
文件:Mp4Provider.java
@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;
}
项目:GestureVideoView
文件:TextureRenderView.java
@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());
}
}
项目:ShaddockVideoPlayer
文件:TextureRenderView.java
@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());
}
}
项目:EZFilter
文件:EGLEnvironment.java
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);
}
项目:NSMPlayer-Android
文件:TextureRenderView.java
@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);
}
}
项目:OkayCamera-Android
文件:Camera2RawFragment.java
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
synchronized (mCameraStateLock) {
mPreviewSize = null;
}
return true;
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
项目:BLPlayer
文件:TextureRenderView.java
public InternalSurfaceHolder(@NonNull TextureRenderView textureView,@Nullable SurfaceTexture surfaceTexture,@NonNull ISurfaceTextureHost surfaceTextureHost) {
mTextureView = textureView;
mSurfaceTexture = surfaceTexture;
mSurfaceTextureHost = surfaceTextureHost;
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
/**
* 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);
}
}
项目:MediaCodecRecorder
文件:RecordingActivity.java
@Override
public void onCameraSurfaceDestroy(SurfaceTexture surfaceTexture) {
Log.d(TAG,"onCameraSurfaceDestroy");
isSurfaceReady = false;
mCamera.stopPreview();
mCamera.release();
if (mVideoRecorder.isRecording()) {
mVideoRecorder.stop();
}
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
项目:GitHub
文件:TextureRenderView.java
@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");
}
}
}
项目:PaoMovie
文件:CameraEngine.java
public static void startPreview(SurfaceTexture surfaceTexture){
try {
mCamera.setPreviewTexture(surfaceTexture);
mCamera.startPreview();
} catch (IOException e) {
// Todo Auto-generated catch block
e.printstacktrace();
}
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
项目:mao-android
文件:VideoPlayFragment.java
@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));
}
项目:airgram
文件:VideoEditorActivity.java
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
if (videoPlayer == null) {
return true;
}
videoPlayer.setdisplay(null);
return true;
}
项目:BLPlayer
文件:TextureRenderView.java
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mSurfaceTexture = surface;
mIsFormatChanged = false;
mWidth = 0;
mHeight = 0;
ISurfaceHolder surfaceHolder = new InternalSurfaceHolder(mWeakRenderView.get(),surface,this);
for (IRenderCallback renderCallback : mRenderCallbackMap.keySet()) {
renderCallback.onSurfaceDestroyed(surfaceHolder);
}
Log.d(TAG,"onSurfaceTextureDestroyed: destroy: " + mOwnSurfaceTexture);
return mOwnSurfaceTexture;
}
项目:PlayerBase
文件:TextureRenderView.java
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) {
mSurfaceTexture = surface;
mIsFormatChanged = false;
mWidth = 0;
mHeight = 0;
ISurfaceHolder surfaceHolder = new InternalSurfaceHolder(mWeakRenderView.get(),"onSurfaceTextureDestroyed: destroy: " + mOwnSurfaceTexture);
return mOwnSurfaceTexture;
}
项目:AndroidTvDemo
文件:TextureRenderView.java
@Override
public void onSurfaceTextureSizeChanged(SurfaceTexture surface,int height)
{
mSurfaceTexture = surface;
mIsFormatChanged = true;
mWidth = width;
mHeight = height;
ISurfaceHolder surfaceHolder = new InternalSurfaceHolder(mWeakRenderView.get(),this);
for (IRenderCallback renderCallback : mRenderCallbackMap.keySet())
{
renderCallback.onSurfaceChanged(surfaceHolder,width,height);
}
}
public void onSurfaceTextureAvailable(SurfaceTexture surface,int height) {
this.mSurfaceTexture = surface;
this.mIsFormatChanged = false;
this.mWidth = 0;
this.mHeight = 0;
ISurfaceHolder surfaceHolder = new InternalSurfaceHolder((TextureRenderView) this
.mWeakRenderView.get(),this);
for (IRenderCallback renderCallback : this.mRenderCallbackMap.keySet()) {
renderCallback.onSurfaceCreated(surfaceHolder,0);
}
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
项目:trust-wallet-android
文件:CameraSource.java
/**
* Opens the camera and starts sending preview frames to the underlying detector. The preview
* frames are not displayed.
*
* @throws IOException if the camera's preview texture or display Could not be initialized
*/
@RequiresPermission(Manifest.permission.CAMERA)
public CameraSource start() throws IOException {
synchronized (mCameraLock) {
if (mCamera != null) {
return this;
}
mCamera = createCamera();
// SurfaceTexture was introduced in Honeycomb (11),so if we are running and
// old version of Android. fall back to use SurfaceView.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
mDummySurfaceTexture = new SurfaceTexture(DUMMY_TEXTURE_NAME);
mCamera.setPreviewTexture(mDummySurfaceTexture);
} else {
mDummySurfaceView = new SurfaceView(mContext);
mCamera.setPreviewdisplay(mDummySurfaceView.getHolder());
}
mCamera.startPreview();
mProcessingThread = new Thread(mFrameProcessor);
mFrameProcessor.setActive(true);
mProcessingThread.start();
}
return this;
}
public void onSurfaceTextureAvailable(SurfaceTexture surface,int height) {
Log.d(TAG,"onSurfaceTextureAvailable " + surface + " " + width + " " + height);
initHandlerThread();
Message msg = Message.obtain(mGLHandler,MSG_TYPE_SURFACE_CREATED,surface);
mGLHandler.sendMessage(msg);
msg = Message.obtain(mGLHandler,MSG_TYPE_SURFACE_CHANGED,height);
mGLHandler.sendMessage(msg);
}
项目:Hitalk
文件:TextureVideoView.java
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface,int height) {
mSurface = new Surface(surface);
if(mTargetState == STATE_PLAYING) {
if(SHOW_LOGS) Log.i(TAG,"onSurfaceTextureAvailable start");
start();
}
}
/**
* 处理显示逻辑
*/
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface,int height) {
super.onSurfaceTextureAvailable(surface,height);
resolveRotateUI();
resolveTransform();
}
private void initSurfaceTexture() {
Log.d(LOGTAG,"initSurfaceTexture");
deleteSurfaceTexture();
initTexOES(texCamera);
mSTexture = new SurfaceTexture(texCamera[0]);
mSTexture.setonFrameAvailableListener(this);
}
项目:grafika
文件:TextureViewCanvasActivity.java
@Override // will be called on UI thread
public boolean onSurfaceTextureDestroyed(SurfaceTexture st) {
Log.d(TAG,"onSurfaceTextureDestroyed");
synchronized (mlock) {
mSurfaceTexture = null;
}
return true;
}
public Size[] getCameraResolutionsFront() {
try {
Cameracharacteristics cameracharacteristics = cameraManager.getCameracharacteristics("0");
if (cameracharacteristics.get(Cameracharacteristics.LENS_FACING)
!= Cameracharacteristics.LENS_FACING_FRONT) {
cameracharacteristics = cameraManager.getCameracharacteristics("1");
}
StreamConfigurationMap streamConfigurationMap =
cameracharacteristics.get(Cameracharacteristics.SCALER_STREAM_CONfigURATION_MAP);
return streamConfigurationMap.getoutputSizes(SurfaceTexture.class);
} catch (CameraAccessException e) {
Log.e(TAG,e.getMessage());
return new Size[0];
}
}
项目:BLPlayer
文件:TextureRenderView.java
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface,this);
for (IRenderCallback renderCallback : mRenderCallbackMap.keySet()) {
renderCallback.onSurfaceCreated(surfaceHolder,0);
}
}
项目:phonk
文件:CustomVideoTextureView.java
@Override
public void onSurfaceTextureAvailable(SurfaceTexture surface,int height) {
if (mOnEvent != null) mOnEvent.surfaceTextureAvailable(surface);
mWidth = width;
mHeight = height;
}
项目:Idea-ijkplayer
文件:TextureRenderView.java
public InternalSurfaceHolder(@NonNull TextureRenderView textureView,@NonNull ISurfaceTextureHost surfaceTextureHost) {
mTextureView = textureView;
mSurfaceTexture = surfaceTexture;
mSurfaceTextureHost = surfaceTextureHost;
}
项目:airgram
文件:OutputSurface.java
@Override
public void onFrameAvailable(SurfaceTexture st) {
synchronized (mFrameSyncObject) {
if (mFrameAvailable) {
throw new RuntimeException("mFrameAvailable already set,frame Could be dropped");
}
mFrameAvailable = true;
mFrameSyncObject.notifyAll();
}
}
项目:live_master
文件:TextureMediaPlayer.java
@Override
public void setSurfaceTexture(SurfaceTexture surfaceTexture) {
if (mSurfaceTexture == surfaceTexture)
return;
releaseSurfaceTexture();
mSurfaceTexture = surfaceTexture;
if (surfaceTexture == null) {
super.setSurface(null);
} else {
super.setSurface(new Surface(surfaceTexture));
}
}
项目:PlusGram
文件:OutputSurface.java
private void setup() {
mTextureRender = new TextureRenderer(rotateRender);
mTextureRender.surfaceCreated();
mSurfaceTexture = new SurfaceTexture(mTextureRender.getTextureId());
mSurfaceTexture.setonFrameAvailableListener(this);
mSurface = new Surface(mSurfaceTexture);
}
项目:CameraKitView
文件:Camera2.java
@Override
public boolean onSurfaceTextureDestroyed(SurfaceTexture texture) {
if (mTextureView != null) {
mTextureView.setSurfaceTextureListener(null);
}
return true;
}
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。