Loading api/current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -25732,7 +25732,7 @@ package android.media { field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1 } public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting { public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection { ctor public MediaRecorder(); method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler); method protected void finalize(); Loading Loading @@ -25762,6 +25762,8 @@ package android.media { method public void setLocation(float, float); method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener); media/java/android/media/AudioRecord.java +8 −5 Original line number Diff line number Diff line Loading @@ -1791,13 +1791,14 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, // MicrophoneDirection //-------------------- /** * Specifies the logical microphone (for processing). * Specifies the logical microphone (for processing). Applications can use this to specify * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * * @param direction Direction constant. * @return true if sucessful. */ public boolean setMicrophoneDirection(int direction) { return native_set_microphone_direction(direction) == 0; public boolean setMicrophoneDirection(@DirectionMode int direction) { return native_set_microphone_direction(direction) == AudioSystem.SUCCESS; } /** Loading @@ -1809,7 +1810,9 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * @return true if sucessful. */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { return native_set_microphone_field_dimension(zoom) == 0; Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_set_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; } //--------------------------------------------------------- Loading media/java/android/media/MediaRecorder.java +34 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.media; import android.annotation.CallbackExecutor; import android.annotation.FloatRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; Loading @@ -35,6 +36,7 @@ import android.util.Pair; import android.view.Surface; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.Preconditions; import java.io.File; import java.io.FileDescriptor; Loading @@ -45,7 +47,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; /** * Used to record audio and video. The recording control is based on a * simple state machine (see below). Loading Loading @@ -90,7 +91,8 @@ import java.util.concurrent.Executor; */ public class MediaRecorder implements AudioRouting, AudioRecordingMonitor, AudioRecordingMonitorClient AudioRecordingMonitorClient, MicrophoneDirection { static { System.loadLibrary("media_jni"); Loading Loading @@ -1526,6 +1528,36 @@ public class MediaRecorder implements AudioRouting, private native final int native_getActiveMicrophones( ArrayList<MicrophoneInfo> activeMicrophones); //-------------------------------------------------------------------------- // MicrophoneDirection //-------------------- /** * Specifies the logical microphone (for processing). * * @param direction Direction constant. * @return true if sucessful. */ public boolean setMicrophoneDirection(@DirectionMode int direction) { return native_setMicrophoneDirection(direction) == 0; } /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * (for processing). The selected microphone is determined by the use-case for the stream. * * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_setMicrophoneFieldDimension(zoom) == 0; } private native int native_setMicrophoneDirection(int direction); private native int native_setMicrophoneFieldDimension(float zoom); //-------------------------------------------------------------------------- // Implementation of AudioRecordingMonitor interface //-------------------- Loading media/java/android/media/MicrophoneDirection.java +10 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Interface defining mechanism for controlling the directionality and field width of * audio capture. */ public interface MicrophoneDirection { /** * Don't do any directionality processing of the activated microphone(s). Loading @@ -41,21 +45,23 @@ public interface MicrophoneDirection { int MIC_DIRECTION_EXTERNAL = 3; /** @hide */ @IntDef({ /*public*/ @IntDef({ MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_FRONT, MIC_DIRECTION_BACK, MIC_DIRECTION_EXTERNAL }) @Retention(RetentionPolicy.SOURCE) public @interface Directionmode{}; @interface DirectionMode{}; /** * Specifies the logical microphone (for processing). * Specifies the logical microphone (for processing). Applications can use this to specify * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * * @param direction Direction constant. * @return true if sucessful. */ boolean setMicrophoneDirection(@Directionmode int direction); boolean setMicrophoneDirection(@DirectionMode int direction); /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone Loading media/jni/android_media_MediaRecorder.cpp +40 −0 Original line number Diff line number Diff line Loading @@ -760,6 +760,44 @@ android_media_MediaRecord_getActiveMicrophones(JNIEnv *env, return jStatus; } static jint android_media_MediaRecord_setMicrophoneDirection( JNIEnv *env, jobject thiz, jint direction) { ALOGV("setMicrophoneDirection(%d)", direction); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return (jint)AUDIO_JAVA_NO_INIT; } jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = mr->setMicrophoneDirection(static_cast<audio_microphone_direction_t>(direction)); if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); } return jStatus; } static jint android_media_MediaRecord_setMicrophoneFieldDimension( JNIEnv *env, jobject thiz, jfloat zoom) { ALOGV("setMicrophoneFieldDimension(%f)", zoom); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return (jint)AUDIO_JAVA_NO_INIT; } jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = mr->setMicrophoneFieldDimension(zoom); if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); } return jStatus; } static jint android_media_MediaRecord_getPortId(JNIEnv *env, jobject thiz) { sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { Loading Loading @@ -812,6 +850,8 @@ static const JNINativeMethod gMethods[] = { {"native_getActiveMicrophones", "(Ljava/util/ArrayList;)I", (void *)android_media_MediaRecord_getActiveMicrophones}, {"native_getPortId", "()I", (void *)android_media_MediaRecord_getPortId}, {"native_setMicrophoneDirection", "(I)I", (void *)android_media_MediaRecord_setMicrophoneDirection}, {"native_setMicrophoneFieldDimension", "(F)I", (void *)android_media_MediaRecord_setMicrophoneFieldDimension}, }; // This function only registers the native methods, and is called from Loading Loading
api/current.txt +3 −1 Original line number Diff line number Diff line Loading @@ -25732,7 +25732,7 @@ package android.media { field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1 } public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting { public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection { ctor public MediaRecorder(); method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler); method protected void finalize(); Loading Loading @@ -25762,6 +25762,8 @@ package android.media { method public void setLocation(float, float); method public void setMaxDuration(int) throws java.lang.IllegalArgumentException; method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException; method public boolean setMicrophoneDirection(int); method public boolean setMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float); method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException; method public void setNextOutputFile(java.io.File) throws java.io.IOException; method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener);
media/java/android/media/AudioRecord.java +8 −5 Original line number Diff line number Diff line Loading @@ -1791,13 +1791,14 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, // MicrophoneDirection //-------------------- /** * Specifies the logical microphone (for processing). * Specifies the logical microphone (for processing). Applications can use this to specify * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * * @param direction Direction constant. * @return true if sucessful. */ public boolean setMicrophoneDirection(int direction) { return native_set_microphone_direction(direction) == 0; public boolean setMicrophoneDirection(@DirectionMode int direction) { return native_set_microphone_direction(direction) == AudioSystem.SUCCESS; } /** Loading @@ -1809,7 +1810,9 @@ public class AudioRecord implements AudioRouting, MicrophoneDirection, * @return true if sucessful. */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { return native_set_microphone_field_dimension(zoom) == 0; Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_set_microphone_field_dimension(zoom) == AudioSystem.SUCCESS; } //--------------------------------------------------------- Loading
media/java/android/media/MediaRecorder.java +34 −2 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package android.media; import android.annotation.CallbackExecutor; import android.annotation.FloatRange; import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.RequiresPermission; Loading @@ -35,6 +36,7 @@ import android.util.Pair; import android.view.Surface; import com.android.internal.annotations.GuardedBy; import com.android.internal.util.Preconditions; import java.io.File; import java.io.FileDescriptor; Loading @@ -45,7 +47,6 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executor; /** * Used to record audio and video. The recording control is based on a * simple state machine (see below). Loading Loading @@ -90,7 +91,8 @@ import java.util.concurrent.Executor; */ public class MediaRecorder implements AudioRouting, AudioRecordingMonitor, AudioRecordingMonitorClient AudioRecordingMonitorClient, MicrophoneDirection { static { System.loadLibrary("media_jni"); Loading Loading @@ -1526,6 +1528,36 @@ public class MediaRecorder implements AudioRouting, private native final int native_getActiveMicrophones( ArrayList<MicrophoneInfo> activeMicrophones); //-------------------------------------------------------------------------- // MicrophoneDirection //-------------------- /** * Specifies the logical microphone (for processing). * * @param direction Direction constant. * @return true if sucessful. */ public boolean setMicrophoneDirection(@DirectionMode int direction) { return native_setMicrophoneDirection(direction) == 0; } /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone * (for processing). The selected microphone is determined by the use-case for the stream. * * @param zoom the desired field dimension of microphone capture. Range is from -1 (wide angle), * though 0 (no zoom) to 1 (maximum zoom). * @return true if sucessful. */ public boolean setMicrophoneFieldDimension(@FloatRange(from = -1.0, to = 1.0) float zoom) { Preconditions.checkArgument( zoom >= -1 && zoom <= 1, "Argument must fall between -1 & 1 (inclusive)"); return native_setMicrophoneFieldDimension(zoom) == 0; } private native int native_setMicrophoneDirection(int direction); private native int native_setMicrophoneFieldDimension(float zoom); //-------------------------------------------------------------------------- // Implementation of AudioRecordingMonitor interface //-------------------- Loading
media/java/android/media/MicrophoneDirection.java +10 −4 Original line number Diff line number Diff line Loading @@ -22,6 +22,10 @@ import android.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * Interface defining mechanism for controlling the directionality and field width of * audio capture. */ public interface MicrophoneDirection { /** * Don't do any directionality processing of the activated microphone(s). Loading @@ -41,21 +45,23 @@ public interface MicrophoneDirection { int MIC_DIRECTION_EXTERNAL = 3; /** @hide */ @IntDef({ /*public*/ @IntDef({ MIC_DIRECTION_UNSPECIFIED, MIC_DIRECTION_FRONT, MIC_DIRECTION_BACK, MIC_DIRECTION_EXTERNAL }) @Retention(RetentionPolicy.SOURCE) public @interface Directionmode{}; @interface DirectionMode{}; /** * Specifies the logical microphone (for processing). * Specifies the logical microphone (for processing). Applications can use this to specify * which side of the device to optimize capture from. Typically used in conjunction with * the camera capturing video. * * @param direction Direction constant. * @return true if sucessful. */ boolean setMicrophoneDirection(@Directionmode int direction); boolean setMicrophoneDirection(@DirectionMode int direction); /** * Specifies the zoom factor (i.e. the field dimension) for the selected microphone Loading
media/jni/android_media_MediaRecorder.cpp +40 −0 Original line number Diff line number Diff line Loading @@ -760,6 +760,44 @@ android_media_MediaRecord_getActiveMicrophones(JNIEnv *env, return jStatus; } static jint android_media_MediaRecord_setMicrophoneDirection( JNIEnv *env, jobject thiz, jint direction) { ALOGV("setMicrophoneDirection(%d)", direction); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return (jint)AUDIO_JAVA_NO_INIT; } jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = mr->setMicrophoneDirection(static_cast<audio_microphone_direction_t>(direction)); if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); } return jStatus; } static jint android_media_MediaRecord_setMicrophoneFieldDimension( JNIEnv *env, jobject thiz, jfloat zoom) { ALOGV("setMicrophoneFieldDimension(%f)", zoom); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { jniThrowException(env, "java/lang/IllegalStateException", NULL); return (jint)AUDIO_JAVA_NO_INIT; } jint jStatus = AUDIO_JAVA_SUCCESS; status_t status = mr->setMicrophoneFieldDimension(zoom); if (status != NO_ERROR) { jStatus = nativeToJavaStatus(status); } return jStatus; } static jint android_media_MediaRecord_getPortId(JNIEnv *env, jobject thiz) { sp<MediaRecorder> mr = getMediaRecorder(env, thiz); if (mr == NULL) { Loading Loading @@ -812,6 +850,8 @@ static const JNINativeMethod gMethods[] = { {"native_getActiveMicrophones", "(Ljava/util/ArrayList;)I", (void *)android_media_MediaRecord_getActiveMicrophones}, {"native_getPortId", "()I", (void *)android_media_MediaRecord_getPortId}, {"native_setMicrophoneDirection", "(I)I", (void *)android_media_MediaRecord_setMicrophoneDirection}, {"native_setMicrophoneFieldDimension", "(F)I", (void *)android_media_MediaRecord_setMicrophoneFieldDimension}, }; // This function only registers the native methods, and is called from Loading