CamcorderProfile.java revision 9d619542bea7d4c376a5a8b4a55c795a796adef3
1e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong/* 2e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * Copyright (C) 2010 The Android Open Source Project 3e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * 4e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * Licensed under the Apache License, Version 2.0 (the "License"); 5e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * you may not use this file except in compliance with the License. 6e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * You may obtain a copy of the License at 7e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * 8e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * http://www.apache.org/licenses/LICENSE-2.0 9e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * 10e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * Unless required by applicable law or agreed to in writing, software 11e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * distributed under the License is distributed on an "AS IS" BASIS, 12e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * See the License for the specific language governing permissions and 14e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * limitations under the License. 15e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 16e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 17e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dongpackage android.media; 18e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 19e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong/** 20e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The CamcorderProfile class is used to retrieve the 21e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * predefined camcorder profile settings for camcorder applications. 22e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * These settings are read-only. 23e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * 24e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The compressed output from a recording session with a given 25e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * CamcorderProfile contains two tracks: one for auido and one for video. 26e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * 27e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <p>Each profile specifies the following set of parameters: 28e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <ul> 29e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * <li> The file output format 30e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * <li> Video codec format 31e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Video bit rate in bits per second 32e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Video frame rate in frames per second 33e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Video frame width and height, 34e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * <li> Audio codec format 35e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Audio bit rate in bits per second, 36e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Audio sample rate 37e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * <li> Number of audio channels for recording. 38e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * </ul> 39e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 40e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dongpublic class CamcorderProfile 41e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong{ 424af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra // Do not change these values/ordinals without updating their counterpart 434af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra // in include/media/MediaProfiles.h! 444af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 45e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 464af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the lowest available resolution. 47e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 48e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public static final int QUALITY_LOW = 0; 494af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 504af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 514af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the highest available resolution. 524af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 53e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public static final int QUALITY_HIGH = 1; 54e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 55e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 564af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the qcif (176 × 144) resolution. 574af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 584af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_QCIF = 2; 594af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 604af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 614af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the 480p (720 x 480) resolution. 624af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 634af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_480P = 3; 644af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 654af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 664af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the 720p (1280 x 720) resolution. 674af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 684af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_720P = 4; 694af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 704af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 714af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality level corresponding to the 1080p (1920 x 1088) resolution. 724af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 734af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_1080P = 5; 744af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 754af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 764af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the lowest available resolution. 774af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 784af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_LOW = 1000; 794af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 804af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 814af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the highest available resolution. 824af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 834af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_HIGH = 1001; 844af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 854af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 864af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the qcif (176 × 144) resolution. 874af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 884af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_QCIF = 1002; 894af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 904af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 914af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the 480p (720 x 480) resolution. 924af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 934af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_480P = 1003; 944af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 954af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 964af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the 720p (1280 x 720) resolution. 974af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 984af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_720P = 1004; 994af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 1004af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 1014af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Time lapse quality level corresponding to the 1080p (1920 x 1088) resolution. 1024af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra */ 1034af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra private static final int QUALITY_TIME_LAPSE_1080P = 1005; 1044af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra 1054af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra /** 106e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * Default recording duration in seconds before the session is terminated. 107e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong * This is useful for applications like MMS has limited file size requirement. 1089b433f0b654d32530b0b48a7a653216ae0bb94d8James Dong */ 109e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int duration; 1109b433f0b654d32530b0b48a7a653216ae0bb94d8James Dong 1119b433f0b654d32530b0b48a7a653216ae0bb94d8James Dong /** 112e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The quality level of the camcorder profile 113e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 114e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int quality; 115e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 116e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 117e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The file output format of the camcorder profile 118e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * @see android.media.MediaRecorder.OutputFormat 119e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 120e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int fileFormat; 121e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 122e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 123e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The video encoder being used for the video track 124e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * @see android.media.MediaRecorder.VideoEncoder 125e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 126e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int videoCodec; 127e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 128e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 129e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The target video output bit rate in bits per second 130e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 131e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int videoBitRate; 132e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 133e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 134e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The target video frame rate in frames per second 135e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 136e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int videoFrameRate; 137e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 138e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 139e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The target video frame width in pixels 140e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 141e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int videoFrameWidth; 142e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 143e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 144e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The target video frame height in pixels 145e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 146e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int videoFrameHeight; 147e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 148e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 149e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The audio encoder being used for the audio track. 150e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * @see android.media.MediaRecorder.AudioEncoder 151e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 152e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int audioCodec; 153e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 154e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 155e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The target audio output bit rate in bits per second 156e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 157e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int audioBitRate; 158e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 159e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 160e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The audio sampling rate used for the audio track 161e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 162e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int audioSampleRate; 163e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 164e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 165e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * The number of audio channels used for the audio track 166e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 167e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public int audioChannels; 168e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 169e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong /** 17009b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang * Returns the camcorder profile for the default camera at the given 17109b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang * quality level. 172e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong * @param quality the target quality level for the camcorder profile 1734af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * @see #get(int, int) 174e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong */ 175e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong public static CamcorderProfile get(int quality) { 1769d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra return get(android.hardware.Camera.CAMERA_ID_DEFAULT, quality); 17709b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang } 17809b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang 17909b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang /** 18009b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang * Returns the camcorder profile for the given camera at the given 18109b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang * quality level. 1824af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * 1834af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * Quality levels QUALITY_LOW, QUALITY_HIGH are guaranteed to be supported, while 1844af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * other levels may or may not be supported. 1854af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * QUALITY_LOW refers to the lowest quality available, while QUALITY_HIGH refers to 1864af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * the highest quality available. 1874af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * QUALITY_LOW/QUALITY_HIGH have to match one of qcif, 480p, 720p, or 1080p. 1884af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * E.g. if the device supports 480p, 720p, and 1080p, then low is 480p and high is 1894af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * 1080p. 1904af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * 1914af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * A camcorder recording session with higher quality level usually has higher output 1924af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * bit rate, better video and/or audio recording quality, larger video frame 1934af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * resolution and higher audio sampling rate, etc, than those with lower quality 1944af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * level. 1954af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * 19609b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang * @param cameraId the id for the camera 1974af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra * @param quality the target quality level for the camcorder profile. 19809b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang */ 19909b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang public static CamcorderProfile get(int cameraId, int quality) { 2004af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra if (!((quality >= QUALITY_LOW && quality <= QUALITY_1080P) || 2014af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8aNipun Kwatra (quality >= QUALITY_TIME_LAPSE_LOW && quality <= QUALITY_TIME_LAPSE_1080P))) { 202e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong String errMessage = "Unsupported quality level: " + quality; 203e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong throw new IllegalArgumentException(errMessage); 204e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong } 20509b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang return native_get_camcorder_profile(cameraId, quality); 206e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong } 207e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 2089d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra /** 2099d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * Returns true if camcorder profile exists for the default camera at 2109d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * the given quality level. 2119d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * @param quality the target quality level for the camcorder profile 2129d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * @hide 2139d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra */ 2149d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra public static boolean hasProfile(int quality) { 2159d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra return hasProfile(android.hardware.Camera.CAMERA_ID_DEFAULT, quality); 2169d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra } 2179d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra 2189d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra /** 2199d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * Returns true if camcorder profile exists for the given camera at 2209d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * the given quality level. 2219d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * @param cameraId the id for the camera 2229d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * @param quality the target quality level for the camcorder profile 2239d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra * @hide 2249d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra */ 2259d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra public static boolean hasProfile(int cameraId, int quality) { 2269d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra return native_has_camcorder_profile(cameraId, quality); 2279d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra } 2289d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra 229e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong static { 230e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong System.loadLibrary("media_jni"); 231e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong native_init(); 232e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong } 233e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 234e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong // Private constructor called by JNI 2359b433f0b654d32530b0b48a7a653216ae0bb94d8James Dong private CamcorderProfile(int duration, 2369b433f0b654d32530b0b48a7a653216ae0bb94d8James Dong int quality, 237e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int fileFormat, 238e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int videoCodec, 239e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int videoBitRate, 240e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int videoFrameRate, 241e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int videoWidth, 242e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int videoHeight, 243e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int audioCodec, 244e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int audioBitRate, 245e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int audioSampleRate, 246e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong int audioChannels) { 247e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 248e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.duration = duration; 249e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.quality = quality; 250e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.fileFormat = fileFormat; 251e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.videoCodec = videoCodec; 252e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.videoBitRate = videoBitRate; 253e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.videoFrameRate = videoFrameRate; 254e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.videoFrameWidth = videoWidth; 255e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.videoFrameHeight = videoHeight; 256e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.audioCodec = audioCodec; 257e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.audioBitRate = audioBitRate; 258e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.audioSampleRate = audioSampleRate; 259e64d9a236e4704abf53d3b7eea2eb066f23cf402James Dong this.audioChannels = audioChannels; 260e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong } 261e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong 262e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong // Methods implemented by JNI 263e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong private static native final void native_init(); 26409b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang private static native final CamcorderProfile native_get_camcorder_profile( 26509b9005769f2b717f637131578ce6cfa6bd62bd9Chih-Chung Chang int cameraId, int quality); 2669d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra private static native final boolean native_has_camcorder_profile( 2679d619542bea7d4c376a5a8b4a55c795a796adef3Nipun Kwatra int cameraId, int quality); 268e7038ace44ed6e6cd27be35b003e6dd0412e936fJames Dong} 269