blob: 9fc962c10dda7328fc6165264686eb6b9ba6c3cd [file] [log] [blame]
James Dongc3711942010-01-19 17:45:38 -08001/*
2 **
3 ** Copyright 2010, The Android Open Source Project.
4 **
5 ** Licensed under the Apache License, Version 2.0 (the "License");
6 ** you may not use this file except in compliance with the License.
7 ** You may obtain a copy of the License at
8 **
9 ** http://www.apache.org/licenses/LICENSE-2.0
10 **
11 ** Unless required by applicable law or agreed to in writing, software
12 ** distributed under the License is distributed on an "AS IS" BASIS,
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ** See the License for the specific language governing permissions and
15 ** limitations under the License.
16 */
17
18#ifndef ANDROID_MEDIAPROFILES_H
19#define ANDROID_MEDIAPROFILES_H
20
21#include <utils/threads.h>
22#include <media/mediarecorder.h>
23
24namespace android {
25
26enum camcorder_quality {
James Dong797e4f12011-02-28 21:07:39 -080027 CAMCORDER_QUALITY_LIST_START = 0,
James Donge64d9a22010-03-31 13:56:29 -070028 CAMCORDER_QUALITY_LOW = 0,
Nipun Kwatra4af0dfd2010-09-06 15:59:02 -070029 CAMCORDER_QUALITY_HIGH = 1,
30 CAMCORDER_QUALITY_QCIF = 2,
Nipun Kwatra522632c2010-09-10 15:45:57 -070031 CAMCORDER_QUALITY_CIF = 3,
32 CAMCORDER_QUALITY_480P = 4,
33 CAMCORDER_QUALITY_720P = 5,
34 CAMCORDER_QUALITY_1080P = 6,
James Dong07b9ae32011-09-19 16:27:31 -070035 CAMCORDER_QUALITY_QVGA = 7,
36 CAMCORDER_QUALITY_LIST_END = 7,
Nipun Kwatra4af0dfd2010-09-06 15:59:02 -070037
James Dong797e4f12011-02-28 21:07:39 -080038 CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000,
Nipun Kwatra4af0dfd2010-09-06 15:59:02 -070039 CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000,
40 CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001,
41 CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002,
Nipun Kwatra522632c2010-09-10 15:45:57 -070042 CAMCORDER_QUALITY_TIME_LAPSE_CIF = 1003,
43 CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004,
44 CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005,
James Dong797e4f12011-02-28 21:07:39 -080045 CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006,
James Dong07b9ae32011-09-19 16:27:31 -070046 CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007,
47 CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1007,
James Dongc3711942010-01-19 17:45:38 -080048};
49
Hong Teng600acf12011-07-06 18:33:09 -070050/**
Hong Teng7eb53192011-11-10 14:54:26 -080051 * Set CIF as default maximum import and export resolution of video editor.
52 * The maximum import and export resolutions are platform specific,
53 * which should be defined in media_profiles.xml.
54 * Set default maximum prefetch YUV frames to 6, which means video editor can
55 * queue up to 6 YUV frames in the video encoder source.
56 * This value is used to limit the amount of memory used by video editor
57 * engine when the encoder consumes YUV frames at a lower speed
58 * than video editor engine produces.
Hong Teng600acf12011-07-06 18:33:09 -070059 */
60enum videoeditor_capability {
61 VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352,
62 VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288,
63 VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352,
64 VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288,
Hong Teng7eb53192011-11-10 14:54:26 -080065 VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6
Hong Teng600acf12011-07-06 18:33:09 -070066};
67
James Dongc3711942010-01-19 17:45:38 -080068enum video_decoder {
69 VIDEO_DECODER_WMV,
70};
71
72enum audio_decoder {
73 AUDIO_DECODER_WMA,
74};
75
76
77class MediaProfiles
78{
79public:
80
81 /**
82 * Returns the singleton instance for subsequence queries.
83 * or NULL if error.
84 */
85 static MediaProfiles* getInstance();
86
87 /**
Chih-Chung Chang09b90052010-06-22 20:50:55 +080088 * Returns the value for the given param name for the given camera at
89 * the given quality level, or -1 if error.
James Dongc3711942010-01-19 17:45:38 -080090 *
91 * Supported param name are:
James Dong9b433f02010-02-23 17:21:44 -080092 * duration - the recording duration.
James Dongc3711942010-01-19 17:45:38 -080093 * file.format - output file format. see mediarecorder.h for details
James Donge7038ac2010-02-03 16:50:18 -080094 * vid.codec - video encoder. see mediarecorder.h for details.
95 * aud.codec - audio encoder. see mediarecorder.h for details.
James Dongc3711942010-01-19 17:45:38 -080096 * vid.width - video frame width
97 * vid.height - video frame height
98 * vid.fps - video frame rate
99 * vid.bps - video bit rate
100 * aud.bps - audio bit rate
101 * aud.hz - audio sample rate
102 * aud.ch - number of audio channels
103 */
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800104 int getCamcorderProfileParamByName(const char *name, int cameraId,
105 camcorder_quality quality) const;
James Dongc3711942010-01-19 17:45:38 -0800106
107 /**
Nipun Kwatra9d619542010-09-09 16:25:08 -0700108 * Returns true if a profile for the given camera at the given quality exists,
109 * or false if not.
110 */
111 bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
112
113 /**
James Dongc3711942010-01-19 17:45:38 -0800114 * Returns the output file formats supported.
115 */
116 Vector<output_format> getOutputFileFormats() const;
117
118 /**
119 * Returns the video encoders supported.
120 */
121 Vector<video_encoder> getVideoEncoders() const;
122
123 /**
124 * Returns the value for the given param name for the given video encoder
125 * returned from getVideoEncoderByIndex or -1 if error.
126 *
127 * Supported param name are:
128 * enc.vid.width.min - min video frame width
129 * enc.vid.width.max - max video frame width
130 * enc.vid.height.min - min video frame height
131 * enc.vid.height.max - max video frame height
132 * enc.vid.bps.min - min bit rate in bits per second
133 * enc.vid.bps.max - max bit rate in bits per second
134 * enc.vid.fps.min - min frame rate in frames per second
135 * enc.vid.fps.max - max frame rate in frames per second
136 */
137 int getVideoEncoderParamByName(const char *name, video_encoder codec) const;
138
139 /**
Hong Teng600acf12011-07-06 18:33:09 -0700140 * Returns the value for the given param name for the video editor cap
141 * param or -1 if error.
142 * Supported param name are:
143 * videoeditor.input.width.max - max input video frame width
144 * videoeditor.input.height.max - max input video frame height
145 * videoeditor.output.width.max - max output video frame width
146 * videoeditor.output.height.max - max output video frame height
Hong Teng7eb53192011-11-10 14:54:26 -0800147 * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used
148 * to limit the memory consumption.
Hong Teng600acf12011-07-06 18:33:09 -0700149 */
150 int getVideoEditorCapParamByName(const char *name) const;
151
152 /**
Rajneesh Chowdury3ced0442011-08-12 16:43:37 -0700153 * Returns the value for the given param name for the video editor export codec format
154 * param or -1 if error.
155 * Supported param name are:
156 * videoeditor.export.profile - export video profile
157 * videoeditor.export.level - export video level
158 * Supported param codec are:
159 * 1 for h263
160 * 2 for h264
161 * 3 for mpeg4
162 */
163 int getVideoEditorExportParamByName(const char *name, int codec) const;
164
165 /**
James Dongc3711942010-01-19 17:45:38 -0800166 * Returns the audio encoders supported.
167 */
168 Vector<audio_encoder> getAudioEncoders() const;
169
170 /**
171 * Returns the value for the given param name for the given audio encoder
172 * returned from getAudioEncoderByIndex or -1 if error.
173 *
174 * Supported param name are:
175 * enc.aud.ch.min - min number of channels
176 * enc.aud.ch.max - max number of channels
177 * enc.aud.bps.min - min bit rate in bits per second
178 * enc.aud.bps.max - max bit rate in bits per second
179 * enc.aud.hz.min - min sample rate in samples per second
180 * enc.aud.hz.max - max sample rate in samples per second
181 */
182 int getAudioEncoderParamByName(const char *name, audio_encoder codec) const;
183
184 /**
185 * Returns the video decoders supported.
186 */
187 Vector<video_decoder> getVideoDecoders() const;
188
189 /**
190 * Returns the audio decoders supported.
191 */
192 Vector<audio_decoder> getAudioDecoders() const;
193
James Dong9b433f02010-02-23 17:21:44 -0800194 /**
195 * Returns the number of image encoding quality levels supported.
196 */
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800197 Vector<int> getImageEncodingQualityLevels(int cameraId) const;
James Dong9b433f02010-02-23 17:21:44 -0800198
James Donga403a932011-05-09 18:49:31 -0700199 /**
200 * Returns the start time offset (in ms) for the given camera Id.
201 * If the given camera Id does not exist, -1 will be returned.
202 */
203 int getStartTimeOffsetMs(int cameraId) const;
204
James Dongc3711942010-01-19 17:45:38 -0800205private:
James Dong797e4f12011-02-28 21:07:39 -0800206 enum {
207 // Camcorder profiles (high/low) and timelapse profiles (high/low)
208 kNumRequiredProfiles = 4,
209 };
210
James Dongc3711942010-01-19 17:45:38 -0800211 MediaProfiles& operator=(const MediaProfiles&); // Don't call me
212 MediaProfiles(const MediaProfiles&); // Don't call me
Hong Teng600acf12011-07-06 18:33:09 -0700213 MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor
James Dongc3711942010-01-19 17:45:38 -0800214 ~MediaProfiles(); // Don't delete me
215
216 struct VideoCodec {
217 VideoCodec(video_encoder codec, int bitRate, int frameWidth, int frameHeight, int frameRate)
218 : mCodec(codec),
219 mBitRate(bitRate),
220 mFrameWidth(frameWidth),
221 mFrameHeight(frameHeight),
222 mFrameRate(frameRate) {}
223
James Dong797e4f12011-02-28 21:07:39 -0800224 VideoCodec(const VideoCodec& copy) {
225 mCodec = copy.mCodec;
226 mBitRate = copy.mBitRate;
227 mFrameWidth = copy.mFrameWidth;
228 mFrameHeight = copy.mFrameHeight;
229 mFrameRate = copy.mFrameRate;
230 }
231
James Dongc3711942010-01-19 17:45:38 -0800232 ~VideoCodec() {}
233
234 video_encoder mCodec;
235 int mBitRate;
236 int mFrameWidth;
237 int mFrameHeight;
238 int mFrameRate;
239 };
240
241 struct AudioCodec {
242 AudioCodec(audio_encoder codec, int bitRate, int sampleRate, int channels)
243 : mCodec(codec),
244 mBitRate(bitRate),
245 mSampleRate(sampleRate),
246 mChannels(channels) {}
247
James Dong797e4f12011-02-28 21:07:39 -0800248 AudioCodec(const AudioCodec& copy) {
249 mCodec = copy.mCodec;
250 mBitRate = copy.mBitRate;
251 mSampleRate = copy.mSampleRate;
252 mChannels = copy.mChannels;
253 }
254
James Dongc3711942010-01-19 17:45:38 -0800255 ~AudioCodec() {}
256
257 audio_encoder mCodec;
258 int mBitRate;
259 int mSampleRate;
260 int mChannels;
261 };
262
263 struct CamcorderProfile {
264 CamcorderProfile()
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800265 : mCameraId(0),
266 mFileFormat(OUTPUT_FORMAT_THREE_GPP),
James Dongc3711942010-01-19 17:45:38 -0800267 mQuality(CAMCORDER_QUALITY_HIGH),
268 mDuration(0),
269 mVideoCodec(0),
270 mAudioCodec(0) {}
271
James Dong797e4f12011-02-28 21:07:39 -0800272 CamcorderProfile(const CamcorderProfile& copy) {
273 mCameraId = copy.mCameraId;
274 mFileFormat = copy.mFileFormat;
275 mQuality = copy.mQuality;
276 mDuration = copy.mDuration;
277 mVideoCodec = new VideoCodec(*copy.mVideoCodec);
278 mAudioCodec = new AudioCodec(*copy.mAudioCodec);
279 }
280
James Dongc3711942010-01-19 17:45:38 -0800281 ~CamcorderProfile() {
282 delete mVideoCodec;
283 delete mAudioCodec;
284 }
285
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800286 int mCameraId;
James Dongc3711942010-01-19 17:45:38 -0800287 output_format mFileFormat;
288 camcorder_quality mQuality;
289 int mDuration;
290 VideoCodec *mVideoCodec;
291 AudioCodec *mAudioCodec;
292 };
293
294 struct VideoEncoderCap {
295 // Ugly constructor
296 VideoEncoderCap(video_encoder codec,
297 int minBitRate, int maxBitRate,
298 int minFrameWidth, int maxFrameWidth,
299 int minFrameHeight, int maxFrameHeight,
300 int minFrameRate, int maxFrameRate)
301 : mCodec(codec),
302 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
303 mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth),
304 mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight),
305 mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {}
306
307 ~VideoEncoderCap() {}
308
309 video_encoder mCodec;
310 int mMinBitRate, mMaxBitRate;
311 int mMinFrameWidth, mMaxFrameWidth;
312 int mMinFrameHeight, mMaxFrameHeight;
313 int mMinFrameRate, mMaxFrameRate;
314 };
315
316 struct AudioEncoderCap {
317 // Ugly constructor
318 AudioEncoderCap(audio_encoder codec,
319 int minBitRate, int maxBitRate,
320 int minSampleRate, int maxSampleRate,
321 int minChannels, int maxChannels)
322 : mCodec(codec),
323 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
324 mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate),
325 mMinChannels(minChannels), mMaxChannels(maxChannels) {}
326
327 ~AudioEncoderCap() {}
328
329 audio_encoder mCodec;
330 int mMinBitRate, mMaxBitRate;
331 int mMinSampleRate, mMaxSampleRate;
332 int mMinChannels, mMaxChannels;
333 };
334
335 struct VideoDecoderCap {
336 VideoDecoderCap(video_decoder codec): mCodec(codec) {}
337 ~VideoDecoderCap() {}
338
339 video_decoder mCodec;
340 };
341
342 struct AudioDecoderCap {
343 AudioDecoderCap(audio_decoder codec): mCodec(codec) {}
344 ~AudioDecoderCap() {}
345
346 audio_decoder mCodec;
347 };
348
349 struct NameToTagMap {
350 const char* name;
351 int tag;
352 };
353
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800354 struct ImageEncodingQualityLevels {
355 int mCameraId;
356 Vector<int> mLevels;
357 };
Rajneesh Chowdury3ced0442011-08-12 16:43:37 -0700358 struct ExportVideoProfile {
359 ExportVideoProfile(int codec, int profile, int level)
360 :mCodec(codec),mProfile(profile),mLevel(level) {}
361 ~ExportVideoProfile() {}
362 int mCodec;
363 int mProfile;
364 int mLevel;
365 };
Hong Teng600acf12011-07-06 18:33:09 -0700366 struct VideoEditorCap {
367 VideoEditorCap(int inFrameWidth, int inFrameHeight,
Hong Teng7eb53192011-11-10 14:54:26 -0800368 int outFrameWidth, int outFrameHeight, int frames)
Hong Teng600acf12011-07-06 18:33:09 -0700369 : mMaxInputFrameWidth(inFrameWidth),
370 mMaxInputFrameHeight(inFrameHeight),
371 mMaxOutputFrameWidth(outFrameWidth),
Hong Teng7eb53192011-11-10 14:54:26 -0800372 mMaxOutputFrameHeight(outFrameHeight),
373 mMaxPrefetchYUVFrames(frames) {}
Hong Teng600acf12011-07-06 18:33:09 -0700374
375 ~VideoEditorCap() {}
376
377 int mMaxInputFrameWidth;
378 int mMaxInputFrameHeight;
379 int mMaxOutputFrameWidth;
380 int mMaxOutputFrameHeight;
Hong Teng7eb53192011-11-10 14:54:26 -0800381 int mMaxPrefetchYUVFrames;
Hong Teng600acf12011-07-06 18:33:09 -0700382 };
383
Nipun Kwatra9d619542010-09-09 16:25:08 -0700384 int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
James Dong797e4f12011-02-28 21:07:39 -0800385 void initRequiredProfileRefs(const Vector<int>& cameraIds);
386 int getRequiredProfileRefIndex(int cameraId);
Nipun Kwatra9d619542010-09-09 16:25:08 -0700387
James Dongc3711942010-01-19 17:45:38 -0800388 // Debug
389 static void logVideoCodec(const VideoCodec& codec);
390 static void logAudioCodec(const AudioCodec& codec);
391 static void logVideoEncoderCap(const VideoEncoderCap& cap);
392 static void logAudioEncoderCap(const AudioEncoderCap& cap);
393 static void logVideoDecoderCap(const VideoDecoderCap& cap);
394 static void logAudioDecoderCap(const AudioDecoderCap& cap);
Hong Teng600acf12011-07-06 18:33:09 -0700395 static void logVideoEditorCap(const VideoEditorCap& cap);
James Dongc3711942010-01-19 17:45:38 -0800396
397 // If the xml configuration file does exist, use the settings
398 // from the xml
399 static MediaProfiles* createInstanceFromXmlFile(const char *xml);
400 static output_format createEncoderOutputFileFormat(const char **atts);
401 static VideoCodec* createVideoCodec(const char **atts, MediaProfiles *profiles);
402 static AudioCodec* createAudioCodec(const char **atts, MediaProfiles *profiles);
403 static AudioDecoderCap* createAudioDecoderCap(const char **atts);
404 static VideoDecoderCap* createVideoDecoderCap(const char **atts);
405 static VideoEncoderCap* createVideoEncoderCap(const char **atts);
406 static AudioEncoderCap* createAudioEncoderCap(const char **atts);
Hong Teng600acf12011-07-06 18:33:09 -0700407 static VideoEditorCap* createVideoEditorCap(
408 const char **atts, MediaProfiles *profiles);
Rajneesh Chowdury3ced0442011-08-12 16:43:37 -0700409 static ExportVideoProfile* createExportVideoProfile(const char **atts);
James Dong797e4f12011-02-28 21:07:39 -0800410
411 static CamcorderProfile* createCamcorderProfile(
412 int cameraId, const char **atts, Vector<int>& cameraIds);
413
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800414 static int getCameraId(const char **atts);
415
James Donga403a932011-05-09 18:49:31 -0700416 void addStartTimeOffset(int cameraId, const char **atts);
417
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800418 ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const;
419 void addImageEncodingQualityLevel(int cameraId, const char** atts);
James Dongc3711942010-01-19 17:45:38 -0800420
421 // Customized element tag handler for parsing the xml configuration file.
422 static void startElementHandler(void *userData, const char *name, const char **atts);
423
424 // If the xml configuration file does not exist, use hard-coded values
425 static MediaProfiles* createDefaultInstance();
Nipun Kwatrad48a15c2010-09-16 22:25:23 -0700426
427 static CamcorderProfile *createDefaultCamcorderQcifProfile(camcorder_quality quality);
428 static CamcorderProfile *createDefaultCamcorderCifProfile(camcorder_quality quality);
429 static void createDefaultCamcorderLowProfiles(
430 MediaProfiles::CamcorderProfile **lowProfile,
431 MediaProfiles::CamcorderProfile **lowSpecificProfile);
432 static void createDefaultCamcorderHighProfiles(
433 MediaProfiles::CamcorderProfile **highProfile,
434 MediaProfiles::CamcorderProfile **highSpecificProfile);
435
436 static CamcorderProfile *createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality);
437 static CamcorderProfile *createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality);
438 static void createDefaultCamcorderTimeLapseLowProfiles(
439 MediaProfiles::CamcorderProfile **lowTimeLapseProfile,
440 MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile);
441 static void createDefaultCamcorderTimeLapseHighProfiles(
442 MediaProfiles::CamcorderProfile **highTimeLapseProfile,
443 MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile);
444
James Dongc3711942010-01-19 17:45:38 -0800445 static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
446 static void createDefaultVideoEncoders(MediaProfiles *profiles);
447 static void createDefaultAudioEncoders(MediaProfiles *profiles);
448 static void createDefaultVideoDecoders(MediaProfiles *profiles);
449 static void createDefaultAudioDecoders(MediaProfiles *profiles);
450 static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
James Dong9b433f02010-02-23 17:21:44 -0800451 static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
452 static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
Hong Teng600acf12011-07-06 18:33:09 -0700453 static void createDefaultVideoEditorCap(MediaProfiles *profiles);
Rajneesh Chowdury3ced0442011-08-12 16:43:37 -0700454 static void createDefaultExportVideoProfiles(MediaProfiles *profiles);
455
James Dongc3711942010-01-19 17:45:38 -0800456 static VideoEncoderCap* createDefaultH263VideoEncoderCap();
457 static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
458 static AudioEncoderCap* createDefaultAmrNBEncoderCap();
459
460 static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name);
461
James Dong797e4f12011-02-28 21:07:39 -0800462 /**
463 * Check on existing profiles with the following criteria:
464 * 1. Low quality profile must have the lowest video
465 * resolution product (width x height)
466 * 2. High quality profile must have the highest video
467 * resolution product (width x height)
468 *
469 * and add required low/high quality camcorder/timelapse
470 * profiles if they are not found. This allows to remove
471 * duplicate profile definitions in the media_profiles.xml
472 * file.
473 */
474 void checkAndAddRequiredProfilesIfNecessary();
475
476
James Dongc3711942010-01-19 17:45:38 -0800477 // Mappings from name (for instance, codec name) to enum value
478 static const NameToTagMap sVideoEncoderNameMap[];
479 static const NameToTagMap sAudioEncoderNameMap[];
480 static const NameToTagMap sFileFormatMap[];
481 static const NameToTagMap sVideoDecoderNameMap[];
482 static const NameToTagMap sAudioDecoderNameMap[];
483 static const NameToTagMap sCamcorderQualityNameMap[];
484
485 static bool sIsInitialized;
486 static MediaProfiles *sInstance;
487 static Mutex sLock;
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800488 int mCurrentCameraId;
James Dongc3711942010-01-19 17:45:38 -0800489
490 Vector<CamcorderProfile*> mCamcorderProfiles;
491 Vector<AudioEncoderCap*> mAudioEncoders;
492 Vector<VideoEncoderCap*> mVideoEncoders;
493 Vector<AudioDecoderCap*> mAudioDecoders;
494 Vector<VideoDecoderCap*> mVideoDecoders;
495 Vector<output_format> mEncoderOutputFileFormats;
Chih-Chung Chang09b90052010-06-22 20:50:55 +0800496 Vector<ImageEncodingQualityLevels *> mImageEncodingQualityLevels;
James Donga403a932011-05-09 18:49:31 -0700497 KeyedVector<int, int> mStartTimeOffsets;
James Dong797e4f12011-02-28 21:07:39 -0800498
499 typedef struct {
500 bool mHasRefProfile; // Refers to an existing profile
501 int mRefProfileIndex; // Reference profile index
502 int mResolutionProduct; // width x height
503 } RequiredProfileRefInfo; // Required low and high profiles
504
505 typedef struct {
506 RequiredProfileRefInfo mRefs[kNumRequiredProfiles];
507 int mCameraId;
508 } RequiredProfiles;
509
510 RequiredProfiles *mRequiredProfileRefs;
511 Vector<int> mCameraIds;
Hong Teng600acf12011-07-06 18:33:09 -0700512 VideoEditorCap* mVideoEditorCap;
Rajneesh Chowdury3ced0442011-08-12 16:43:37 -0700513 Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
James Dongc3711942010-01-19 17:45:38 -0800514};
515
516}; // namespace android
517
518#endif // ANDROID_MEDIAPROFILES_H