Merge "MediaCodec: rename usePersistentInputSurface to setInputSurface" into mnc-dev
This commit is contained in:
@@ -15340,6 +15340,7 @@ package android.media {
|
||||
method public final void reset();
|
||||
method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
|
||||
method public void setCallback(android.media.MediaCodec.Callback);
|
||||
method public void setInputSurface(android.view.Surface);
|
||||
method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
|
||||
method public final void setParameters(android.os.Bundle);
|
||||
method public void setSurface(android.view.Surface);
|
||||
@@ -15347,7 +15348,6 @@ package android.media {
|
||||
method public final void signalEndOfInputStream();
|
||||
method public final void start();
|
||||
method public final void stop();
|
||||
method public void usePersistentInputSurface(android.view.Surface);
|
||||
field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
|
||||
field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
|
||||
field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
|
||||
@@ -16196,6 +16196,7 @@ package android.media {
|
||||
method public void setAudioSource(int) throws java.lang.IllegalStateException;
|
||||
method public deprecated void setCamera(android.hardware.Camera);
|
||||
method public void setCaptureRate(double);
|
||||
method public void setInputSurface(android.view.Surface);
|
||||
method public void setLocation(float, float);
|
||||
method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
|
||||
method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
|
||||
@@ -16214,7 +16215,6 @@ package android.media {
|
||||
method public void setVideoSource(int) throws java.lang.IllegalStateException;
|
||||
method public void start() throws java.lang.IllegalStateException;
|
||||
method public void stop() throws java.lang.IllegalStateException;
|
||||
method public void usePersistentSurface(android.view.Surface);
|
||||
field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
|
||||
field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
|
||||
field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
|
||||
|
||||
@@ -16574,6 +16574,7 @@ package android.media {
|
||||
method public final void reset();
|
||||
method public void setCallback(android.media.MediaCodec.Callback, android.os.Handler);
|
||||
method public void setCallback(android.media.MediaCodec.Callback);
|
||||
method public void setInputSurface(android.view.Surface);
|
||||
method public void setOnFrameRenderedListener(android.media.MediaCodec.OnFrameRenderedListener, android.os.Handler);
|
||||
method public final void setParameters(android.os.Bundle);
|
||||
method public void setSurface(android.view.Surface);
|
||||
@@ -16581,7 +16582,6 @@ package android.media {
|
||||
method public final void signalEndOfInputStream();
|
||||
method public final void start();
|
||||
method public final void stop();
|
||||
method public void usePersistentInputSurface(android.view.Surface);
|
||||
field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
|
||||
field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
|
||||
field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
|
||||
@@ -17431,6 +17431,7 @@ package android.media {
|
||||
method public void setAudioSource(int) throws java.lang.IllegalStateException;
|
||||
method public deprecated void setCamera(android.hardware.Camera);
|
||||
method public void setCaptureRate(double);
|
||||
method public void setInputSurface(android.view.Surface);
|
||||
method public void setLocation(float, float);
|
||||
method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
|
||||
method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
|
||||
@@ -17449,7 +17450,6 @@ package android.media {
|
||||
method public void setVideoSource(int) throws java.lang.IllegalStateException;
|
||||
method public void start() throws java.lang.IllegalStateException;
|
||||
method public void stop() throws java.lang.IllegalStateException;
|
||||
method public void usePersistentSurface(android.view.Surface);
|
||||
field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
|
||||
field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
|
||||
field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
|
||||
|
||||
@@ -677,7 +677,7 @@ final public class MediaCodec {
|
||||
* <p>
|
||||
* The application is responsible for calling release() on the Surface when done.
|
||||
*
|
||||
* @return an input surface that can be used with {@link #usePersistentInputSurface}.
|
||||
* @return an input surface that can be used with {@link #setInputSurface}.
|
||||
*/
|
||||
@NonNull
|
||||
public static Surface createPersistentInputSurface() {
|
||||
@@ -707,17 +707,17 @@ final public class MediaCodec {
|
||||
* @throws IllegalArgumentException if the surface was not created by
|
||||
* {@link #createPersistentInputSurface}.
|
||||
*/
|
||||
public void usePersistentInputSurface(@NonNull Surface surface) {
|
||||
public void setInputSurface(@NonNull Surface surface) {
|
||||
if (!(surface instanceof PersistentSurface)) {
|
||||
throw new IllegalArgumentException("not a PersistentSurface");
|
||||
}
|
||||
native_usePersistentInputSurface(surface);
|
||||
native_setInputSurface(surface);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
private static native final PersistentSurface native_createPersistentInputSurface();
|
||||
private static native final void native_releasePersistentInputSurface(@NonNull Surface surface);
|
||||
private native final void native_usePersistentInputSurface(@NonNull Surface surface);
|
||||
private native final void native_setInputSurface(@NonNull Surface surface);
|
||||
|
||||
private native final void native_setCallback(@Nullable Callback cb);
|
||||
|
||||
|
||||
@@ -156,14 +156,14 @@ public class MediaRecorder
|
||||
* @see MediaCodec#createPersistentInputSurface
|
||||
* @see MediaRecorder.VideoSource
|
||||
*/
|
||||
public void usePersistentSurface(@NonNull Surface surface) {
|
||||
public void setInputSurface(@NonNull Surface surface) {
|
||||
if (!(surface instanceof MediaCodec.PersistentSurface)) {
|
||||
throw new IllegalArgumentException("not a PersistentSurface");
|
||||
}
|
||||
native_usePersistentSurface(surface);
|
||||
native_setInputSurface(surface);
|
||||
}
|
||||
|
||||
private native final void native_usePersistentSurface(@NonNull Surface surface);
|
||||
private native final void native_setInputSurface(@NonNull Surface surface);
|
||||
|
||||
/**
|
||||
* Sets a Surface to show a preview of recorded media (video). Calls this
|
||||
|
||||
@@ -272,9 +272,9 @@ status_t JMediaCodec::createInputSurface(
|
||||
return mCodec->createInputSurface(bufferProducer);
|
||||
}
|
||||
|
||||
status_t JMediaCodec::usePersistentInputSurface(
|
||||
status_t JMediaCodec::setInputSurface(
|
||||
const sp<PersistentSurface> &surface) {
|
||||
return mCodec->usePersistentInputSurface(surface);
|
||||
return mCodec->setInputSurface(surface);
|
||||
}
|
||||
|
||||
status_t JMediaCodec::start() {
|
||||
@@ -1034,9 +1034,9 @@ static void android_media_MediaCodec_releasePersistentInputSurface(
|
||||
// no need to release surface as it will be released by Surface's jni
|
||||
}
|
||||
|
||||
static void android_media_MediaCodec_usePersistentInputSurface(
|
||||
static void android_media_MediaCodec_setInputSurface(
|
||||
JNIEnv* env, jobject thiz, jobject object) {
|
||||
ALOGV("android_media_MediaCodec_usePersistentInputSurface");
|
||||
ALOGV("android_media_MediaCodec_setInputSurface");
|
||||
|
||||
sp<JMediaCodec> codec = getMediaCodec(env, thiz);
|
||||
if (codec == NULL) {
|
||||
@@ -1047,7 +1047,7 @@ static void android_media_MediaCodec_usePersistentInputSurface(
|
||||
sp<PersistentSurface> persistentSurface =
|
||||
android_media_MediaCodec_getPersistentInputSurface(env, object);
|
||||
|
||||
status_t err = codec->usePersistentInputSurface(persistentSurface);
|
||||
status_t err = codec->setInputSurface(persistentSurface);
|
||||
if (err != NO_ERROR) {
|
||||
throwExceptionAsNecessary(env, err);
|
||||
}
|
||||
@@ -1741,8 +1741,8 @@ static JNINativeMethod gMethods[] = {
|
||||
"()Landroid/media/MediaCodec$PersistentSurface;",
|
||||
(void *)android_media_MediaCodec_createPersistentInputSurface },
|
||||
|
||||
{ "native_usePersistentInputSurface", "(Landroid/view/Surface;)V",
|
||||
(void *)android_media_MediaCodec_usePersistentInputSurface },
|
||||
{ "native_setInputSurface", "(Landroid/view/Surface;)V",
|
||||
(void *)android_media_MediaCodec_setInputSurface },
|
||||
|
||||
{ "native_setCallback",
|
||||
"(Landroid/media/MediaCodec$Callback;)V",
|
||||
|
||||
@@ -58,7 +58,7 @@ struct JMediaCodec : public AHandler {
|
||||
const sp<IGraphicBufferProducer> &surface);
|
||||
|
||||
status_t createInputSurface(sp<IGraphicBufferProducer>* bufferProducer);
|
||||
status_t usePersistentInputSurface(const sp<PersistentSurface> &surface);
|
||||
status_t setInputSurface(const sp<PersistentSurface> &surface);
|
||||
|
||||
status_t start();
|
||||
status_t stop();
|
||||
|
||||
@@ -496,16 +496,16 @@ android_media_MediaRecorder_native_finalize(JNIEnv *env, jobject thiz)
|
||||
android_media_MediaRecorder_release(env, thiz);
|
||||
}
|
||||
|
||||
void android_media_MediaRecorder_usePersistentSurface(
|
||||
void android_media_MediaRecorder_setInputSurface(
|
||||
JNIEnv* env, jobject thiz, jobject object) {
|
||||
ALOGV("android_media_MediaRecorder_usePersistentSurface");
|
||||
ALOGV("android_media_MediaRecorder_setInputSurface");
|
||||
|
||||
sp<MediaRecorder> mr = getMediaRecorder(env, thiz);
|
||||
|
||||
sp<PersistentSurface> persistentSurface = get_persistentSurface(env, object);
|
||||
|
||||
process_media_recorder_call(env, mr->usePersistentSurface(persistentSurface),
|
||||
"java/lang/IllegalArgumentException", "native_usePersistentSurface failed.");
|
||||
process_media_recorder_call(env, mr->setInputSurface(persistentSurface),
|
||||
"java/lang/IllegalArgumentException", "native_setInputSurface failed.");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -534,7 +534,7 @@ static JNINativeMethod gMethods[] = {
|
||||
{"native_setup", "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/String;)V",
|
||||
(void *)android_media_MediaRecorder_native_setup},
|
||||
{"native_finalize", "()V", (void *)android_media_MediaRecorder_native_finalize},
|
||||
{"native_usePersistentSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaRecorder_usePersistentSurface },
|
||||
{"native_setInputSurface", "(Landroid/view/Surface;)V", (void *)android_media_MediaRecorder_setInputSurface },
|
||||
};
|
||||
|
||||
// This function only registers the native methods, and is called from
|
||||
|
||||
@@ -252,7 +252,7 @@ public class MediaRecorderTest extends ActivityInstrumentationTestCase2<MediaFra
|
||||
if (persistentSurface != null) {
|
||||
Log.v(TAG, "using persistent surface");
|
||||
surface = persistentSurface;
|
||||
recorder.usePersistentSurface(surface);
|
||||
recorder.setInputSurface(surface);
|
||||
}
|
||||
recorder.prepare();
|
||||
if (persistentSurface == null) {
|
||||
|
||||
Reference in New Issue
Block a user