diff options
author | Gil Dobjanschi <virgild@google.com> | 2010-12-02 13:50:49 -0800 |
---|---|---|
committer | Gil Dobjanschi <virgild@google.com> | 2010-12-02 13:50:49 -0800 |
commit | 731e46575aeffa26b41d7590a0a4de637d792258 (patch) | |
tree | ec212877ca1410862376e8c51b440d5c87274cc1 | |
parent | cd023f98fab0f01603f006c3029a73cd820b4678 (diff) | |
download | frameworks_base-731e46575aeffa26b41d7590a0a4de637d792258.zip frameworks_base-731e46575aeffa26b41d7590a0a4de637d792258.tar.gz frameworks_base-731e46575aeffa26b41d7590a0a4de637d792258.tar.bz2 |
Remove the VideoEditorTestImpl
Change-Id: I16302716f4aa32f69f48c9f4cc5732b421c1a675
-rwxr-xr-x | media/java/android/media/videoeditor/VideoEditorFactory.java | 51 | ||||
-rw-r--r-- | media/java/android/media/videoeditor/VideoEditorImpl.java (renamed from media/java/android/media/videoeditor/VideoEditorTestImpl.java) | 12 |
2 files changed, 15 insertions, 48 deletions
diff --git a/media/java/android/media/videoeditor/VideoEditorFactory.java b/media/java/android/media/videoeditor/VideoEditorFactory.java index 5c243ed..85b2666 100755 --- a/media/java/android/media/videoeditor/VideoEditorFactory.java +++ b/media/java/android/media/videoeditor/VideoEditorFactory.java @@ -19,8 +19,8 @@ package android.media.videoeditor; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationTargetException; + +import android.media.videoeditor.VideoEditor.MediaProcessingProgressListener; /** @@ -30,34 +30,19 @@ import java.lang.reflect.InvocationTargetException; * {@hide} */ public class VideoEditorFactory { - // VideoEditor implementation classes - public static final String TEST_CLASS_IMPLEMENTATION - = "android.media.videoeditor.VideoEditorTestImpl"; - public static final String DEFAULT_CLASS_IMPLEMENTATION - = "android.media.videoeditor.VideoEditorImpl"; - /** * This is the factory method for creating a new VideoEditor instance. * * @param projectPath The path where all VideoEditor internal * files are stored. When a project is deleted the application is * responsible for deleting the path and its contents. - * @param className The implementation class name * * @return The VideoEditor instance * * @throws IOException if path does not exist or if the path can * not be accessed in read/write mode - * @throws IllegalStateException if a previous VideoEditor instance has not - * been released - * @throws ClassNotFoundException, NoSuchMethodException, - * InvocationTargetException, IllegalAccessException, - * InstantiationException if the implementation class cannot - * be instantiated. */ - public static VideoEditor create(String projectPath, String className) throws IOException, - ClassNotFoundException, NoSuchMethodException, InvocationTargetException, - IllegalAccessException, InstantiationException { + public static VideoEditor create(String projectPath) throws IOException { // If the project path does not exist create it final File dir = new File(projectPath); if (!dir.exists()) { @@ -72,14 +57,7 @@ public class VideoEditorFactory { } } - final Class<?> cls = Class.forName(className); - final Class<?> partypes[] = new Class[1]; - partypes[0] = String.class; - final Constructor<?> ct = cls.getConstructor(partypes); - final Object arglist[] = new Object[1]; - arglist[0] = projectPath; - - return (VideoEditor)ct.newInstance(arglist); + return new VideoEditorImpl(projectPath); } /** @@ -90,30 +68,19 @@ public class VideoEditorFactory { * @param projectPath The path where all VideoEditor internal files * are stored. When a project is deleted the application is * responsible for deleting the path and its contents. - * @param className The implementation class name * @param generatePreview if set to true the - * {@link MediaEditor#generatePreview()} will be called internally to - * generate any needed transitions. + * {@link MediaEditor#generatePreview(MediaProcessingProgressListener listener)} + * will be called internally to generate any needed transitions. * * @return The VideoEditor instance * * @throws IOException if path does not exist or if the path can * not be accessed in read/write mode or if one of the resource * media files cannot be retrieved - * @throws IllegalStateException if a previous VideoEditor instance has not - * been released */ - public static VideoEditor load(String projectPath, String className, boolean generatePreview) - throws IOException, ClassNotFoundException, NoSuchMethodException, - InvocationTargetException, IllegalAccessException, InstantiationException { - final Class<?> cls = Class.forName(className); - final Class<?> partypes[] = new Class[1]; - partypes[0] = String.class; - final Constructor<?> ct = cls.getConstructor(partypes); - final Object arglist[] = new Object[1]; - arglist[0] = projectPath; - - final VideoEditor videoEditor = (VideoEditor)ct.newInstance(arglist); + public static VideoEditor load(String projectPath, boolean generatePreview) + throws IOException { + final VideoEditor videoEditor = new VideoEditorImpl(projectPath); if (generatePreview) { videoEditor.generatePreview(null); } diff --git a/media/java/android/media/videoeditor/VideoEditorTestImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java index 50e4aaf..1a145e6 100644 --- a/media/java/android/media/videoeditor/VideoEditorTestImpl.java +++ b/media/java/android/media/videoeditor/VideoEditorImpl.java @@ -39,7 +39,7 @@ import android.view.SurfaceHolder; /** * The VideoEditor implementation {@hide} */ -public class VideoEditorTestImpl implements VideoEditor { +public class VideoEditorImpl implements VideoEditor { // Logging private static final String TAG = "VideoEditorImpl"; @@ -165,7 +165,7 @@ public class VideoEditorTestImpl implements VideoEditor { if (mPositionMs >= mToMs) { if (!mLoop) { if (mListener != null) { - mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, true); + mListener.onProgress(VideoEditorImpl.this, mPositionMs, true); } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "PreviewThread.run playback complete"); @@ -174,13 +174,13 @@ public class VideoEditorTestImpl implements VideoEditor { } else { // Fire a notification for the end of the clip if (mListener != null) { - mListener.onProgress(VideoEditorTestImpl.this, mToMs, false); + mListener.onProgress(VideoEditorImpl.this, mToMs, false); } // Rewind mPositionMs = mFromMs; if (mListener != null) { - mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, false); + mListener.onProgress(VideoEditorImpl.this, mPositionMs, false); } if (Log.isLoggable(TAG, Log.DEBUG)) { Log.d(TAG, "PreviewThread.run playback complete"); @@ -190,7 +190,7 @@ public class VideoEditorTestImpl implements VideoEditor { } else { if (frameCount == mCallbackAfterFrameCount) { if (mListener != null) { - mListener.onProgress(VideoEditorTestImpl.this, mPositionMs, false); + mListener.onProgress(VideoEditorImpl.this, mPositionMs, false); } frameCount = 0; } @@ -222,7 +222,7 @@ public class VideoEditorTestImpl implements VideoEditor { * * @param projectPath */ - public VideoEditorTestImpl(String projectPath) throws IOException { + public VideoEditorImpl(String projectPath) throws IOException { mProjectPath = projectPath; final File projectXml = new File(projectPath, PROJECT_FILENAME); if (projectXml.exists()) { |