summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--media/java/android/media/videoeditor/MediaArtistNativeHelper.java4
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditor.java11
-rwxr-xr-xmedia/jni/mediaeditor/VideoEditorMain.cpp4
-rw-r--r--media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java38
4 files changed, 51 insertions, 6 deletions
diff --git a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
index 03ae62a..4756078 100644
--- a/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
+++ b/media/java/android/media/videoeditor/MediaArtistNativeHelper.java
@@ -1845,7 +1845,7 @@ class MediaArtistNativeHelper {
@SuppressWarnings("unused")
private void onPreviewProgressUpdate(int progress, boolean isFinished,
- boolean updateOverlay, String filename, int renderingMode) {
+ boolean updateOverlay, String filename, int renderingMode, int error) {
if (mPreviewProgressListener != null) {
if (mIsFirstProgress) {
mPreviewProgressListener.onStart(mVideoEditor);
@@ -1870,6 +1870,8 @@ class MediaArtistNativeHelper {
if (isFinished) {
mPreviewProgressListener.onStop(mVideoEditor);
+ } else if (error != 0) {
+ mPreviewProgressListener.onError(mVideoEditor, error);
} else {
mPreviewProgressListener.onProgress(mVideoEditor, progress, overlayData);
}
diff --git a/media/java/android/media/videoeditor/VideoEditor.java b/media/java/android/media/videoeditor/VideoEditor.java
index 424e436..08d27d4 100755
--- a/media/java/android/media/videoeditor/VideoEditor.java
+++ b/media/java/android/media/videoeditor/VideoEditor.java
@@ -107,6 +107,17 @@ public interface VideoEditor {
* @param videoEditor The VideoEditor instance
*/
public void onStop(VideoEditor videoEditor);
+
+ /**
+ * This method notifies the listener when error has occurred during
+ * previewing a project.
+ *
+ * @param videoEditor The VideoEditor instance
+ * @param error The error that has occurred
+ * FIXME: We should pass well-defined error code to the application;
+ * but for now, we just pass whatever error code reported by the native layer.
+ */
+ public void onError(VideoEditor videoEditor, int error);
}
/**
diff --git a/media/jni/mediaeditor/VideoEditorMain.cpp b/media/jni/mediaeditor/VideoEditorMain.cpp
index ed4e92e..3d6d857 100755
--- a/media/jni/mediaeditor/VideoEditorMain.cpp
+++ b/media/jni/mediaeditor/VideoEditorMain.cpp
@@ -477,7 +477,7 @@ static void jniPreviewProgressCallback (void* cookie, M4OSA_UInt32 msgType,
pEnv->CallVoidMethod(pContext->engine,
pContext->onPreviewProgressUpdateMethodId,
currentMs,isFinished, pContext->mIsUpdateOverlay,
- tmpFileName, pContext->mOverlayRenderingMode);
+ tmpFileName, pContext->mOverlayRenderingMode, error);
if (pContext->mIsUpdateOverlay) {
pContext->mIsUpdateOverlay = false;
@@ -1630,7 +1630,7 @@ videoEditor_populateSettings(
"not initialized");
pContext->onPreviewProgressUpdateMethodId = pEnv->GetMethodID(engineClass,
- "onPreviewProgressUpdate", "(IZZLjava/lang/String;I)V");
+ "onPreviewProgressUpdate", "(IZZLjava/lang/String;II)V");
// Check if the context is valid (required because the context is dereferenced).
if (needToBeLoaded) {
// Make sure that we are in a correct state.
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java
index e848f5f..3c08138 100644
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/videoeditor/VideoEditorPreviewTest.java
@@ -93,6 +93,7 @@ public class VideoEditorPreviewTest extends
private boolean previewStart;
private boolean previewStop;
+ private boolean previewError;
/* Minimum waiting time for Semaphore to wait for release */
private final long minWaitingTime = 3000;
@@ -141,7 +142,9 @@ public class VideoEditorPreviewTest extends
protected void setPreviewStop() {
previewStop = true;
}
-
+ protected void setPreviewError() {
+ previewError = true;
+ }
protected void validatePreviewProgress(int startMs, int endMs,
boolean loop, long duration) throws Exception {
@@ -149,6 +152,7 @@ public class VideoEditorPreviewTest extends
final Semaphore blockTillPreviewCompletes = new Semaphore(1);
previewStart = false;
previewStop = false;
+ previewError = false;
mVideoEditor.generatePreview(new MediaProcessingProgressListener() {
int i = 0;
public void onProgress(Object item, int action, int progress) {
@@ -187,6 +191,10 @@ public class VideoEditorPreviewTest extends
setPreviewStop();
blockTillPreviewCompletes.release();
}
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ blockTillPreviewCompletes.release();
+ }
});
} catch (Exception e) {
blockTillPreviewCompletes.release();
@@ -196,6 +204,7 @@ public class VideoEditorPreviewTest extends
mVideoEditor.stopPreview();
assertTrue("Preview Failed to start", previewStart);
assertTrue("Preview Failed to stop", previewStop);
+ assertFalse("Preview Error occurred", previewError);
blockTillPreviewCompletes.release();
}
@@ -399,6 +408,7 @@ public class VideoEditorPreviewTest extends
"TransitionSpiral_QVGA.jpg";
previewStart = false;
previewStop = false;
+ previewError = false;
final Semaphore blockTillPreviewCompletes = new Semaphore(1);
@@ -490,6 +500,10 @@ public class VideoEditorPreviewTest extends
setPreviewStop();
blockTillPreviewCompletes.release();
}
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ blockTillPreviewCompletes.release();
+ }
});
} catch (Exception e) {
blockTillPreviewCompletes.release();
@@ -499,6 +513,7 @@ public class VideoEditorPreviewTest extends
blockTillPreviewCompletes.release();
assertTrue("Preview Failed to start", previewStart);
assertTrue("Preview Failed to stop", previewStop);
+ assertFalse("Preview Error occurred", previewError);
assertEquals("Removing Transition " + transition1And2CrossFade.getId(),
transition1And2CrossFade,
@@ -677,6 +692,7 @@ public class VideoEditorPreviewTest extends
final Semaphore blockTillPreviewCompletes = new Semaphore(1);
previewStart = false;
previewStop = false;
+ previewError = false;
final MediaVideoItem mediaVideoItem1 =
mVideoEditorHelper.createMediaItem(mVideoEditor, "m1",
@@ -727,6 +743,10 @@ public class VideoEditorPreviewTest extends
setPreviewStop();
blockTillPreviewCompletes.release();
}
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ blockTillPreviewCompletes.release();
+ }
});
} catch (Exception e) {
@@ -736,6 +756,8 @@ public class VideoEditorPreviewTest extends
mVideoEditor.stopPreview();
assertTrue("Preview Failed to start", previewStart);
assertTrue("Preview Failed to stop", previewStop);
+ assertFalse("Preview Error occurred", previewError);
+
blockTillPreviewCompletes.release();
}
@@ -784,6 +806,10 @@ public class VideoEditorPreviewTest extends
setPreviewStop();
blockTillPreviewCompletes.release();
}
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ blockTillPreviewCompletes.release();
+ }
});
} catch (IllegalArgumentException e) {
@@ -1023,7 +1049,10 @@ public class VideoEditorPreviewTest extends
}
public void onStop(VideoEditor videoEditor) {
setPreviewStop();
- }
+ }
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ }
});
}catch (IllegalArgumentException e) {
flagForException = true;
@@ -1089,7 +1118,10 @@ public class VideoEditorPreviewTest extends
}
public void onStop(VideoEditor videoEditor) {
setPreviewStop();
- }
+ }
+ public void onError(VideoEditor videoEditor, int error) {
+ setPreviewError();
+ }
});
}catch (IllegalArgumentException e) {
flagForException = true;