Loading api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -13187,6 +13187,7 @@ package android.media { ctor public MediaRecorder(); method public static final int getAudioSourceMax(); method public int getMaxAmplitude() throws java.lang.IllegalStateException; method public android.view.Surface getSurface(); method public void prepare() throws java.io.IOException, java.lang.IllegalStateException; method public void release(); method public void reset(); Loading Loading @@ -13271,6 +13272,7 @@ package android.media { public final class MediaRecorder.VideoSource { field public static final int CAMERA = 1; // 0x1 field public static final int DEFAULT = 0; // 0x0 field public static final int SURFACE = 2; // 0x2 } public class MediaRouter { media/java/android/media/MediaRecorder.java +28 −3 Original line number Diff line number Diff line Loading @@ -123,6 +123,18 @@ public class MediaRecorder */ public native void setCamera(Camera c); /** * Gets the surface to record from when using SURFACE video source. * <p> * Should only be called after prepare(). Frames rendered before start() * will be discarded. * </p> * @throws IllegalStateException if it is called before prepare(), after * stop() or is called when VideoSource is not set to SURFACE. * @see android.media.MediaRecorder.VideoSource */ public native Surface getSurface(); /** * Sets a Surface to show a preview of recorded media (video). Calls this * before prepare() to make sure that the desirable preview display is Loading Loading @@ -225,10 +237,23 @@ public class MediaRecorder */ private VideoSource() {} public static final int DEFAULT = 0; /** Camera video source */ /** Camera video source * <p> * Using android.hardware.Camera as video source. * </p> */ public static final int CAMERA = 1; /** @hide */ public static final int GRALLOC_BUFFER = 2; /** Surface video source * <p> * Using a Surface as video source. * </p><p> * This flag must be used when recording from an * android.hardware.camera2.CameraDevice source. * </p><p> * When using this video source type, use {@link MediaRecorder#getSurface()} * to retrieve the surface created by MediaRecorder. */ public static final int SURFACE = 2; } /** Loading media/jni/android_media_MediaRecorder.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,26 @@ android_media_MediaRecorder_native_getMaxAmplitude(JNIEnv *env, jobject thiz) return result; } static jobject android_media_MediaRecorder_getSurface(JNIEnv *env, jobject thiz) { ALOGV("getSurface"); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); sp<IGraphicBufferProducer> bufferProducer = mr->querySurfaceMediaSourceFromMediaServer(); if (bufferProducer == NULL) { jniThrowException( env, "java/lang/IllegalStateException", "failed to get surface"); return NULL; } // Wrap the IGBP in a Java-language Surface. return android_view_Surface_createFromIGraphicBufferProducer(env, bufferProducer); } static void android_media_MediaRecorder_start(JNIEnv *env, jobject thiz) { Loading Loading @@ -470,6 +490,7 @@ static JNINativeMethod gMethods[] = { {"setMaxDuration", "(I)V", (void *)android_media_MediaRecorder_setMaxDuration}, {"setMaxFileSize", "(J)V", (void *)android_media_MediaRecorder_setMaxFileSize}, {"_prepare", "()V", (void *)android_media_MediaRecorder_prepare}, {"getSurface", "()Landroid/view/Surface;", (void *)android_media_MediaRecorder_getSurface}, {"getMaxAmplitude", "()I", (void *)android_media_MediaRecorder_native_getMaxAmplitude}, {"start", "()V", (void *)android_media_MediaRecorder_start}, {"stop", "()V", (void *)android_media_MediaRecorder_stop}, Loading Loading
api/current.txt +2 −0 Original line number Diff line number Diff line Loading @@ -13187,6 +13187,7 @@ package android.media { ctor public MediaRecorder(); method public static final int getAudioSourceMax(); method public int getMaxAmplitude() throws java.lang.IllegalStateException; method public android.view.Surface getSurface(); method public void prepare() throws java.io.IOException, java.lang.IllegalStateException; method public void release(); method public void reset(); Loading Loading @@ -13271,6 +13272,7 @@ package android.media { public final class MediaRecorder.VideoSource { field public static final int CAMERA = 1; // 0x1 field public static final int DEFAULT = 0; // 0x0 field public static final int SURFACE = 2; // 0x2 } public class MediaRouter {
media/java/android/media/MediaRecorder.java +28 −3 Original line number Diff line number Diff line Loading @@ -123,6 +123,18 @@ public class MediaRecorder */ public native void setCamera(Camera c); /** * Gets the surface to record from when using SURFACE video source. * <p> * Should only be called after prepare(). Frames rendered before start() * will be discarded. * </p> * @throws IllegalStateException if it is called before prepare(), after * stop() or is called when VideoSource is not set to SURFACE. * @see android.media.MediaRecorder.VideoSource */ public native Surface getSurface(); /** * Sets a Surface to show a preview of recorded media (video). Calls this * before prepare() to make sure that the desirable preview display is Loading Loading @@ -225,10 +237,23 @@ public class MediaRecorder */ private VideoSource() {} public static final int DEFAULT = 0; /** Camera video source */ /** Camera video source * <p> * Using android.hardware.Camera as video source. * </p> */ public static final int CAMERA = 1; /** @hide */ public static final int GRALLOC_BUFFER = 2; /** Surface video source * <p> * Using a Surface as video source. * </p><p> * This flag must be used when recording from an * android.hardware.camera2.CameraDevice source. * </p><p> * When using this video source type, use {@link MediaRecorder#getSurface()} * to retrieve the surface created by MediaRecorder. */ public static final int SURFACE = 2; } /** Loading
media/jni/android_media_MediaRecorder.cpp +21 −0 Original line number Diff line number Diff line Loading @@ -344,6 +344,26 @@ android_media_MediaRecorder_native_getMaxAmplitude(JNIEnv *env, jobject thiz) return result; } static jobject android_media_MediaRecorder_getSurface(JNIEnv *env, jobject thiz) { ALOGV("getSurface"); sp<MediaRecorder> mr = getMediaRecorder(env, thiz); sp<IGraphicBufferProducer> bufferProducer = mr->querySurfaceMediaSourceFromMediaServer(); if (bufferProducer == NULL) { jniThrowException( env, "java/lang/IllegalStateException", "failed to get surface"); return NULL; } // Wrap the IGBP in a Java-language Surface. return android_view_Surface_createFromIGraphicBufferProducer(env, bufferProducer); } static void android_media_MediaRecorder_start(JNIEnv *env, jobject thiz) { Loading Loading @@ -470,6 +490,7 @@ static JNINativeMethod gMethods[] = { {"setMaxDuration", "(I)V", (void *)android_media_MediaRecorder_setMaxDuration}, {"setMaxFileSize", "(J)V", (void *)android_media_MediaRecorder_setMaxFileSize}, {"_prepare", "()V", (void *)android_media_MediaRecorder_prepare}, {"getSurface", "()Landroid/view/Surface;", (void *)android_media_MediaRecorder_getSurface}, {"getMaxAmplitude", "()I", (void *)android_media_MediaRecorder_native_getMaxAmplitude}, {"start", "()V", (void *)android_media_MediaRecorder_start}, {"stop", "()V", (void *)android_media_MediaRecorder_stop}, Loading