NJ-1409: (frameworks/base) Support new audio encoding types(AMR and AAC).
diff --git a/include/media/mediarecorder.h b/include/media/mediarecorder.h
index aebe191..9b54ca9 100644
--- a/include/media/mediarecorder.h
+++ b/include/media/mediarecorder.h
@@ -30,7 +30,7 @@
 typedef void (*media_completion_f)(status_t status, void *cookie);
 
 /* Do not change these values without updating their counterparts
- * in java/android/android/media/MediaRecorder.java!
+ * in media/java/android/media/MediaRecorder.java!
  */
 enum audio_source {
     AUDIO_SOURCE_DEFAULT = 0,
@@ -38,26 +38,47 @@
     AUDIO_SOURCE_VOICE_UPLINK = 2,
     AUDIO_SOURCE_VOICE_DOWNLINK = 3,
     AUDIO_SOURCE_VOICE_CALL = 4,
-    AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL
+    AUDIO_SOURCE_MAX = AUDIO_SOURCE_VOICE_CALL,
+
+    AUDIO_SOURCE_LIST_END  // must be last - used to validate audio source type
 };
 
 enum video_source {
     VIDEO_SOURCE_DEFAULT = 0,
     VIDEO_SOURCE_CAMERA = 1,
+
+    VIDEO_SOURCE_LIST_END  // must be last - used to validate audio source type
 };
 
-//Please update java/android/android/media/MediaRecorder.java if the following is updated.
+//Please update media/java/android/media/MediaRecorder.java if the following is updated.
 enum output_format {
     OUTPUT_FORMAT_DEFAULT = 0,
-    OUTPUT_FORMAT_THREE_GPP,
-    OUTPUT_FORMAT_MPEG_4,
-    OUTPUT_FORMAT_RAW_AMR,
+    OUTPUT_FORMAT_THREE_GPP = 1,
+    OUTPUT_FORMAT_MPEG_4 = 2,
+
+
+    OUTPUT_FORMAT_AUDIO_ONLY_START = 3, // Used in validating the output format.  Should be the
+                                        //  at the start of the audio only output formats.
+
+    /* These are audio only file formats */
+    OUTPUT_FORMAT_RAW_AMR = 3, //to be backward compatible
+    OUTPUT_FORMAT_AMR_NB = 3,
+    OUTPUT_FORMAT_AMR_WB = 4,
+    OUTPUT_FORMAT_AAC_ADIF = 5,
+    OUTPUT_FORMAT_AAC_ADTS = 6,
+
     OUTPUT_FORMAT_LIST_END // must be last - used to validate format type
 };
 
 enum audio_encoder {
     AUDIO_ENCODER_DEFAULT = 0,
     AUDIO_ENCODER_AMR_NB = 1,
+    AUDIO_ENCODER_AMR_WB = 2,
+    AUDIO_ENCODER_AAC = 3,
+    AUDIO_ENCODER_AAC_PLUS = 4,
+    AUDIO_ENCODER_EAAC_PLUS = 5,
+
+    AUDIO_ENCODER_LIST_END // must be the last - used to validate the audio encoder type
 };
 
 enum video_encoder {
@@ -65,8 +86,11 @@
     VIDEO_ENCODER_H263 = 1,
     VIDEO_ENCODER_H264 = 2,
     VIDEO_ENCODER_MPEG_4_SP = 3,
+
+    VIDEO_ENCODER_LIST_END // must be the last - used to validate the video encoder type
 };
 
+
 // Maximum frames per second is 24
 #define MEDIA_RECORDER_MAX_FRAME_RATE         24
 
@@ -105,7 +129,7 @@
 // The codes are distributed as follow:
 //   0xx: Reserved
 //   8xx: General info/warning
-// 
+//
 enum media_recorder_info_type {
     MEDIA_RECORDER_INFO_UNKNOWN                   = 1,
     MEDIA_RECORDER_INFO_MAX_DURATION_REACHED      = 800,
diff --git a/media/libmedia/mediarecorder.cpp b/media/libmedia/mediarecorder.cpp
index 6b26faf..5093f0e 100644
--- a/media/libmedia/mediarecorder.cpp
+++ b/media/libmedia/mediarecorder.cpp
@@ -180,7 +180,7 @@
         LOGE("setOutputFormat called in an invalid state: %d", mCurrentState);
         return INVALID_OPERATION;
     }
-    if (mIsVideoSourceSet && of >= OUTPUT_FORMAT_RAW_AMR) {
+    if (mIsVideoSourceSet && of >= OUTPUT_FORMAT_AUDIO_ONLY_START) { //first non-video output format
         LOGE("output format (%d) is meant for audio recording only and incompatible with video recording", of);
         return INVALID_OPERATION;
     }
@@ -345,7 +345,7 @@
     }
     if (!mIsVideoSourceSet) {
         LOGE("try to set video frame rate without setting video source first");
-        return INVALID_OPERATION; 
+        return INVALID_OPERATION;
     }
 
     status_t ret = mMediaRecorder->setVideoFrameRate(frames_per_second);
@@ -475,7 +475,7 @@
         mCurrentState = MEDIA_RECORDER_ERROR;
         return ret;
     }
- 
+
     // FIXME:
     // stop and reset are semantically different.
     // We treat them the same for now, and will change this in the future.
@@ -492,7 +492,7 @@
         LOGE("media recorder is not initialized yet");
         return INVALID_OPERATION;
     }
-    
+
     doCleanUp();
     status_t ret = UNKNOWN_ERROR;
     switch(mCurrentState) {