summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-01-26 21:15:37 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2011-01-26 21:15:37 -0800
commitf1e687b6e31ba4597558de94c40a73a074ba7703 (patch)
treee6810e814786d80bcf4917d28c08b40577a7a14e /media
parent1f8e2f99585040b3904f1b6863000d9d208eda02 (diff)
parent3b1fd35c6876f7eb1d15db3095c3e57969783302 (diff)
downloadframeworks_base-f1e687b6e31ba4597558de94c40a73a074ba7703.zip
frameworks_base-f1e687b6e31ba4597558de94c40a73a074ba7703.tar.gz
frameworks_base-f1e687b6e31ba4597558de94c40a73a074ba7703.tar.bz2
am 3b1fd35c: Merge "Eliminate duplicated code in export method" into honeycomb
* commit '3b1fd35c6876f7eb1d15db3095c3e57969783302': Eliminate duplicated code in export method
Diffstat (limited to 'media')
-rwxr-xr-xmedia/java/android/media/videoeditor/VideoEditorImpl.java78
1 files changed, 9 insertions, 69 deletions
diff --git a/media/java/android/media/videoeditor/VideoEditorImpl.java b/media/java/android/media/videoeditor/VideoEditorImpl.java
index d2dfe82..a590eec 100755
--- a/media/java/android/media/videoeditor/VideoEditorImpl.java
+++ b/media/java/android/media/videoeditor/VideoEditorImpl.java
@@ -327,16 +327,6 @@ public class VideoEditorImpl implements VideoEditor {
public void export(String filename, int height, int bitrate,
int audioCodec, int videoCodec,
ExportProgressListener listener) throws IOException {
- if ( filename == null) {
- throw new IllegalArgumentException("export: filename is null");
- }
- File tempPathFile = new File(filename);
- if (tempPathFile == null) {
- throw new IOException(filename + "can not be created");
- }
- if (mMediaItems.size() == 0) {
- throw new IllegalStateException("No MediaItems added");
- }
switch (audioCodec) {
case MediaProperties.ACODEC_AAC_LC:
@@ -345,7 +335,8 @@ public class VideoEditorImpl implements VideoEditor {
break;
default :
- throw new IllegalArgumentException("Audio codec type incorrect");
+ String message = "Unsupported audio codec type " + audioCodec;
+ throw new IllegalArgumentException(message);
}
switch (videoCodec) {
@@ -357,64 +348,11 @@ public class VideoEditorImpl implements VideoEditor {
break;
default :
- throw new IllegalArgumentException("Video codec type incorrect");
+ String message = "Unsupported video codec type " + videoCodec;
+ throw new IllegalArgumentException(message);
}
- switch (height) {
- case MediaProperties.HEIGHT_144:
- break;
- case MediaProperties.HEIGHT_360:
- break;
- case MediaProperties.HEIGHT_480:
- break;
- case MediaProperties.HEIGHT_720:
- break;
-
- default:
- throw new IllegalArgumentException("Argument Height incorrect");
- }
-
- switch (bitrate) {
- case MediaProperties.BITRATE_28K:
- break;
- case MediaProperties.BITRATE_40K:
- break;
- case MediaProperties.BITRATE_64K:
- break;
- case MediaProperties.BITRATE_96K:
- break;
- case MediaProperties.BITRATE_128K:
- break;
- case MediaProperties.BITRATE_192K:
- break;
- case MediaProperties.BITRATE_256K:
- break;
- case MediaProperties.BITRATE_384K:
- break;
- case MediaProperties.BITRATE_512K:
- break;
- case MediaProperties.BITRATE_800K:
- break;
- case MediaProperties.BITRATE_2M:
- break;
- case MediaProperties.BITRATE_5M:
- break;
- case MediaProperties.BITRATE_8M:
- break;
-
- default:
- throw new IllegalArgumentException("Argument Bitrate incorrect");
- }
-
- try {
- mExportSemaphore.acquire();
- mMANativeHelper.export(filename, mProjectPath, height,bitrate,audioCodec,
- videoCodec,mMediaItems, mTransitions, mAudioTracks,listener);
- } catch (InterruptedException ex) {
- Log.e("VideoEditorImpl", "Sem acquire NOT successful in export");
- } finally {
- mExportSemaphore.release();
- }
+ export(filename, height, bitrate, listener);
}
/*
@@ -444,7 +382,8 @@ public class VideoEditorImpl implements VideoEditor {
break;
default:
- throw new IllegalArgumentException("Argument Height incorrect");
+ String message = "Unsupported height value " + height;
+ throw new IllegalArgumentException(message);
}
switch (bitrate) {
case MediaProperties.BITRATE_28K:
@@ -475,7 +414,8 @@ public class VideoEditorImpl implements VideoEditor {
break;
default:
- throw new IllegalArgumentException("Argument Bitrate incorrect");
+ final String message = "Unsupported bitrate value " + bitrate;
+ throw new IllegalArgumentException(message);
}
try {