Move getSupportedFormats from capturer interface to camera enumerator.

R=magjed@webrtc.org

Review-Url: https://codereview.webrtc.org/2308493002
Cr-Commit-Position: refs/heads/master@{#14047}
This commit is contained in:
sakal 2016-09-02 05:58:11 -07:00 committed by Commit bot
parent 5b1ba0857b
commit 504e838be2
8 changed files with 16 additions and 25 deletions

View File

@ -64,6 +64,11 @@ public class Camera1Enumerator implements CameraEnumerator {
return info != null && info.facing == android.hardware.Camera.CameraInfo.CAMERA_FACING_BACK;
}
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
return getSupportedFormats(getCameraIndex(deviceName));
}
@Override
public CameraVideoCapturer createCapturer(String deviceName,
CameraVideoCapturer.CameraEventsHandler eventsHandler) {

View File

@ -31,11 +31,6 @@ public class Camera2Capturer extends CameraCapturer {
cameraManager = (CameraManager) context.getSystemService(Context.CAMERA_SERVICE);
}
@Override
public List<CaptureFormat> getSupportedFormats() {
return Camera2Enumerator.getSupportedFormats(cameraManager, getCameraName());
}
@Override
protected void createCameraSession(
CameraSession.CreateSessionCallback createSessionCallback,

View File

@ -81,6 +81,11 @@ public class Camera2Enumerator implements CameraEnumerator {
== CameraMetadata.LENS_FACING_BACK;
}
@Override
public List<CaptureFormat> getSupportedFormats(String deviceName) {
return getSupportedFormats(context, deviceName);
}
@Override
public CameraVideoCapturer createCapturer(String deviceName,
CameraVideoCapturer.CameraEventsHandler eventsHandler) {

View File

@ -10,10 +10,15 @@
package org.webrtc;
import org.webrtc.CameraEnumerationAndroid.CaptureFormat;
import java.util.List;
public interface CameraEnumerator {
public String[] getDeviceNames();
public boolean isFrontFacing(String deviceName);
public boolean isBackFacing(String deviceName);
public List<CaptureFormat> getSupportedFormats(String deviceName);
public CameraVideoCapturer createCapturer(String deviceName,
CameraVideoCapturer.CameraEventsHandler eventsHandler);

View File

@ -99,15 +99,6 @@ public class ScreenCapturerAndroid implements
applicationContext.getSystemService(Context.MEDIA_PROJECTION_SERVICE);
}
/**
* This method is not called by native code, neither by the java app. It can be removed later
* once it is removed from the VideoCapturer interface.
*/
@Override
public List<CameraEnumerationAndroid.CaptureFormat> getSupportedFormats() {
return null;
}
@Override
public synchronized void startCapture(final int width, final int height,
final int ignoredFramerate) {

View File

@ -90,11 +90,6 @@ public interface VideoCapturer {
int width, int height, int framerate);
}
/**
* Returns a list with all the formats this VideoCapturer supports.
*/
List<CameraEnumerationAndroid.CaptureFormat> getSupportedFormats();
/**
* This function is used to initialize the camera thread, the android application context, and the
* capture observer. It will be called only once and before any startCapture() request. The

View File

@ -204,11 +204,6 @@ public class VideoCapturerAndroid implements
}
}
@Override
public List<CaptureFormat> getSupportedFormats() {
return Camera1Enumerator.getSupportedFormats(getCurrentCameraId());
}
// Returns true if this VideoCapturer is setup to capture video frames to a SurfaceTexture.
public boolean isCapturingToTexture() {
return isCapturingToTexture;

View File

@ -348,7 +348,7 @@ class CameraVideoCapturerTestFixtures {
instance.capturer.initialize(
instance.surfaceTextureHelper, testObjectFactory.getAppContext(), instance.observer);
}
instance.supportedFormats = instance.capturer.getSupportedFormats();
instance.supportedFormats = testObjectFactory.cameraEnumerator.getSupportedFormats(name);
return instance;
}