blob: 60d6bef1cbb7527319d213bcca973878003a9b50 [file] [log] [blame]
James Dong1d7491b2010-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 Dong2a7e0a12011-02-28 21:07:39 -080027 CAMCORDER_QUALITY_LIST_START = 0,
James Dong0b42f252010-03-31 13:56:29 -070028 CAMCORDER_QUALITY_LOW = 0,
Nipun Kwatrac0a84782010-09-06 15:59:02 -070029 CAMCORDER_QUALITY_HIGH = 1,
30 CAMCORDER_QUALITY_QCIF = 2,
Nipun Kwatra9783ed82010-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,
Ankit Premrajka140a9ac2011-11-21 19:25:02 -080035 CAMCORDER_QUALITY_QVGA = 11,
36 CAMCORDER_QUALITY_FWVGA = 7,
37 CAMCORDER_QUALITY_WVGA = 8,
38 CAMCORDER_QUALITY_VGA = 9,
39 CAMCORDER_QUALITY_WQVGA = 10,
40
41 CAMCORDER_QUALITY_LIST_END = 11,
Nipun Kwatrac0a84782010-09-06 15:59:02 -070042
James Dong2a7e0a12011-02-28 21:07:39 -080043 CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000,
Nipun Kwatrac0a84782010-09-06 15:59:02 -070044 CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000,
45 CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001,
46 CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002,
Nipun Kwatra9783ed82010-09-10 15:45:57 -070047 CAMCORDER_QUALITY_TIME_LAPSE_CIF = 1003,
48 CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004,
49 CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005,
James Dong2a7e0a12011-02-28 21:07:39 -080050 CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006,
James Dong669012d2011-09-19 16:27:31 -070051 CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007,
52 CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1007,
James Dong1d7491b2010-01-19 17:45:38 -080053};
54
Hong Tengcabd5f82011-07-06 18:33:09 -070055/**
Hong Teng3a9cefe2011-11-10 14:54:26 -080056 * Set CIF as default maximum import and export resolution of video editor.
57 * The maximum import and export resolutions are platform specific,
58 * which should be defined in media_profiles.xml.
59 * Set default maximum prefetch YUV frames to 6, which means video editor can
60 * queue up to 6 YUV frames in the video encoder source.
61 * This value is used to limit the amount of memory used by video editor
62 * engine when the encoder consumes YUV frames at a lower speed
63 * than video editor engine produces.
Hong Tengcabd5f82011-07-06 18:33:09 -070064 */
65enum videoeditor_capability {
66 VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352,
67 VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288,
68 VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352,
69 VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288,
Hong Teng3a9cefe2011-11-10 14:54:26 -080070 VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6
Hong Tengcabd5f82011-07-06 18:33:09 -070071};
72
James Dong1d7491b2010-01-19 17:45:38 -080073enum video_decoder {
74 VIDEO_DECODER_WMV,
75};
76
77enum audio_decoder {
78 AUDIO_DECODER_WMA,
79};
80
81
82class MediaProfiles
83{
84public:
85
86 /**
87 * Returns the singleton instance for subsequence queries.
88 * or NULL if error.
89 */
90 static MediaProfiles* getInstance();
91
92 /**
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +080093 * Returns the value for the given param name for the given camera at
94 * the given quality level, or -1 if error.
James Dong1d7491b2010-01-19 17:45:38 -080095 *
96 * Supported param name are:
James Dongf5a83852010-02-23 17:21:44 -080097 * duration - the recording duration.
James Dong1d7491b2010-01-19 17:45:38 -080098 * file.format - output file format. see mediarecorder.h for details
James Dong13896b92010-02-03 16:50:18 -080099 * vid.codec - video encoder. see mediarecorder.h for details.
100 * aud.codec - audio encoder. see mediarecorder.h for details.
James Dong1d7491b2010-01-19 17:45:38 -0800101 * vid.width - video frame width
102 * vid.height - video frame height
103 * vid.fps - video frame rate
104 * vid.bps - video bit rate
105 * aud.bps - audio bit rate
106 * aud.hz - audio sample rate
107 * aud.ch - number of audio channels
108 */
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800109 int getCamcorderProfileParamByName(const char *name, int cameraId,
110 camcorder_quality quality) const;
James Dong1d7491b2010-01-19 17:45:38 -0800111
112 /**
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700113 * Returns true if a profile for the given camera at the given quality exists,
114 * or false if not.
115 */
116 bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
117
118 /**
James Dong1d7491b2010-01-19 17:45:38 -0800119 * Returns the output file formats supported.
120 */
121 Vector<output_format> getOutputFileFormats() const;
122
123 /**
124 * Returns the video encoders supported.
125 */
126 Vector<video_encoder> getVideoEncoders() const;
127
128 /**
129 * Returns the value for the given param name for the given video encoder
130 * returned from getVideoEncoderByIndex or -1 if error.
131 *
132 * Supported param name are:
133 * enc.vid.width.min - min video frame width
134 * enc.vid.width.max - max video frame width
135 * enc.vid.height.min - min video frame height
136 * enc.vid.height.max - max video frame height
137 * enc.vid.bps.min - min bit rate in bits per second
138 * enc.vid.bps.max - max bit rate in bits per second
139 * enc.vid.fps.min - min frame rate in frames per second
140 * enc.vid.fps.max - max frame rate in frames per second
141 */
142 int getVideoEncoderParamByName(const char *name, video_encoder codec) const;
143
144 /**
Hong Tengcabd5f82011-07-06 18:33:09 -0700145 * Returns the value for the given param name for the video editor cap
146 * param or -1 if error.
147 * Supported param name are:
148 * videoeditor.input.width.max - max input video frame width
149 * videoeditor.input.height.max - max input video frame height
150 * videoeditor.output.width.max - max output video frame width
151 * videoeditor.output.height.max - max output video frame height
Hong Teng3a9cefe2011-11-10 14:54:26 -0800152 * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used
153 * to limit the memory consumption.
Hong Tengcabd5f82011-07-06 18:33:09 -0700154 */
155 int getVideoEditorCapParamByName(const char *name) const;
156
157 /**
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700158 * Returns the value for the given param name for the video editor export codec format
159 * param or -1 if error.
160 * Supported param name are:
161 * videoeditor.export.profile - export video profile
162 * videoeditor.export.level - export video level
163 * Supported param codec are:
164 * 1 for h263
165 * 2 for h264
166 * 3 for mpeg4
167 */
168 int getVideoEditorExportParamByName(const char *name, int codec) const;
169
170 /**
James Dong1d7491b2010-01-19 17:45:38 -0800171 * Returns the audio encoders supported.
172 */
173 Vector<audio_encoder> getAudioEncoders() const;
174
175 /**
176 * Returns the value for the given param name for the given audio encoder
177 * returned from getAudioEncoderByIndex or -1 if error.
178 *
179 * Supported param name are:
180 * enc.aud.ch.min - min number of channels
181 * enc.aud.ch.max - max number of channels
182 * enc.aud.bps.min - min bit rate in bits per second
183 * enc.aud.bps.max - max bit rate in bits per second
184 * enc.aud.hz.min - min sample rate in samples per second
185 * enc.aud.hz.max - max sample rate in samples per second
186 */
187 int getAudioEncoderParamByName(const char *name, audio_encoder codec) const;
188
189 /**
190 * Returns the video decoders supported.
191 */
192 Vector<video_decoder> getVideoDecoders() const;
193
194 /**
195 * Returns the audio decoders supported.
196 */
197 Vector<audio_decoder> getAudioDecoders() const;
198
James Dongf5a83852010-02-23 17:21:44 -0800199 /**
200 * Returns the number of image encoding quality levels supported.
201 */
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800202 Vector<int> getImageEncodingQualityLevels(int cameraId) const;
James Dongf5a83852010-02-23 17:21:44 -0800203
James Dong0f056292011-05-09 18:49:31 -0700204 /**
205 * Returns the start time offset (in ms) for the given camera Id.
206 * If the given camera Id does not exist, -1 will be returned.
207 */
208 int getStartTimeOffsetMs(int cameraId) const;
209
James Dong1d7491b2010-01-19 17:45:38 -0800210private:
James Dong2a7e0a12011-02-28 21:07:39 -0800211 enum {
212 // Camcorder profiles (high/low) and timelapse profiles (high/low)
213 kNumRequiredProfiles = 4,
214 };
215
James Dong1d7491b2010-01-19 17:45:38 -0800216 MediaProfiles& operator=(const MediaProfiles&); // Don't call me
217 MediaProfiles(const MediaProfiles&); // Don't call me
Hong Tengcabd5f82011-07-06 18:33:09 -0700218 MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor
James Dong1d7491b2010-01-19 17:45:38 -0800219 ~MediaProfiles(); // Don't delete me
220
221 struct VideoCodec {
222 VideoCodec(video_encoder codec, int bitRate, int frameWidth, int frameHeight, int frameRate)
223 : mCodec(codec),
224 mBitRate(bitRate),
225 mFrameWidth(frameWidth),
226 mFrameHeight(frameHeight),
227 mFrameRate(frameRate) {}
228
James Dong2a7e0a12011-02-28 21:07:39 -0800229 VideoCodec(const VideoCodec& copy) {
230 mCodec = copy.mCodec;
231 mBitRate = copy.mBitRate;
232 mFrameWidth = copy.mFrameWidth;
233 mFrameHeight = copy.mFrameHeight;
234 mFrameRate = copy.mFrameRate;
235 }
236
James Dong1d7491b2010-01-19 17:45:38 -0800237 ~VideoCodec() {}
238
239 video_encoder mCodec;
240 int mBitRate;
241 int mFrameWidth;
242 int mFrameHeight;
243 int mFrameRate;
244 };
245
246 struct AudioCodec {
247 AudioCodec(audio_encoder codec, int bitRate, int sampleRate, int channels)
248 : mCodec(codec),
249 mBitRate(bitRate),
250 mSampleRate(sampleRate),
251 mChannels(channels) {}
252
James Dong2a7e0a12011-02-28 21:07:39 -0800253 AudioCodec(const AudioCodec& copy) {
254 mCodec = copy.mCodec;
255 mBitRate = copy.mBitRate;
256 mSampleRate = copy.mSampleRate;
257 mChannels = copy.mChannels;
258 }
259
James Dong1d7491b2010-01-19 17:45:38 -0800260 ~AudioCodec() {}
261
262 audio_encoder mCodec;
263 int mBitRate;
264 int mSampleRate;
265 int mChannels;
266 };
267
268 struct CamcorderProfile {
269 CamcorderProfile()
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800270 : mCameraId(0),
271 mFileFormat(OUTPUT_FORMAT_THREE_GPP),
James Dong1d7491b2010-01-19 17:45:38 -0800272 mQuality(CAMCORDER_QUALITY_HIGH),
273 mDuration(0),
274 mVideoCodec(0),
275 mAudioCodec(0) {}
276
James Dong2a7e0a12011-02-28 21:07:39 -0800277 CamcorderProfile(const CamcorderProfile& copy) {
278 mCameraId = copy.mCameraId;
279 mFileFormat = copy.mFileFormat;
280 mQuality = copy.mQuality;
281 mDuration = copy.mDuration;
282 mVideoCodec = new VideoCodec(*copy.mVideoCodec);
283 mAudioCodec = new AudioCodec(*copy.mAudioCodec);
284 }
285
James Dong1d7491b2010-01-19 17:45:38 -0800286 ~CamcorderProfile() {
287 delete mVideoCodec;
288 delete mAudioCodec;
289 }
290
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800291 int mCameraId;
James Dong1d7491b2010-01-19 17:45:38 -0800292 output_format mFileFormat;
293 camcorder_quality mQuality;
294 int mDuration;
295 VideoCodec *mVideoCodec;
296 AudioCodec *mAudioCodec;
297 };
298
299 struct VideoEncoderCap {
300 // Ugly constructor
301 VideoEncoderCap(video_encoder codec,
302 int minBitRate, int maxBitRate,
303 int minFrameWidth, int maxFrameWidth,
304 int minFrameHeight, int maxFrameHeight,
305 int minFrameRate, int maxFrameRate)
306 : mCodec(codec),
307 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
308 mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth),
309 mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight),
310 mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {}
311
312 ~VideoEncoderCap() {}
313
314 video_encoder mCodec;
315 int mMinBitRate, mMaxBitRate;
316 int mMinFrameWidth, mMaxFrameWidth;
317 int mMinFrameHeight, mMaxFrameHeight;
318 int mMinFrameRate, mMaxFrameRate;
319 };
320
321 struct AudioEncoderCap {
322 // Ugly constructor
323 AudioEncoderCap(audio_encoder codec,
324 int minBitRate, int maxBitRate,
325 int minSampleRate, int maxSampleRate,
326 int minChannels, int maxChannels)
327 : mCodec(codec),
328 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
329 mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate),
330 mMinChannels(minChannels), mMaxChannels(maxChannels) {}
331
332 ~AudioEncoderCap() {}
333
334 audio_encoder mCodec;
335 int mMinBitRate, mMaxBitRate;
336 int mMinSampleRate, mMaxSampleRate;
337 int mMinChannels, mMaxChannels;
338 };
339
340 struct VideoDecoderCap {
341 VideoDecoderCap(video_decoder codec): mCodec(codec) {}
342 ~VideoDecoderCap() {}
343
344 video_decoder mCodec;
345 };
346
347 struct AudioDecoderCap {
348 AudioDecoderCap(audio_decoder codec): mCodec(codec) {}
349 ~AudioDecoderCap() {}
350
351 audio_decoder mCodec;
352 };
353
354 struct NameToTagMap {
355 const char* name;
356 int tag;
357 };
358
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800359 struct ImageEncodingQualityLevels {
360 int mCameraId;
361 Vector<int> mLevels;
362 };
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700363 struct ExportVideoProfile {
364 ExportVideoProfile(int codec, int profile, int level)
365 :mCodec(codec),mProfile(profile),mLevel(level) {}
366 ~ExportVideoProfile() {}
367 int mCodec;
368 int mProfile;
369 int mLevel;
370 };
Hong Tengcabd5f82011-07-06 18:33:09 -0700371 struct VideoEditorCap {
372 VideoEditorCap(int inFrameWidth, int inFrameHeight,
Hong Teng3a9cefe2011-11-10 14:54:26 -0800373 int outFrameWidth, int outFrameHeight, int frames)
Hong Tengcabd5f82011-07-06 18:33:09 -0700374 : mMaxInputFrameWidth(inFrameWidth),
375 mMaxInputFrameHeight(inFrameHeight),
376 mMaxOutputFrameWidth(outFrameWidth),
Hong Teng3a9cefe2011-11-10 14:54:26 -0800377 mMaxOutputFrameHeight(outFrameHeight),
378 mMaxPrefetchYUVFrames(frames) {}
Hong Tengcabd5f82011-07-06 18:33:09 -0700379
380 ~VideoEditorCap() {}
381
382 int mMaxInputFrameWidth;
383 int mMaxInputFrameHeight;
384 int mMaxOutputFrameWidth;
385 int mMaxOutputFrameHeight;
Hong Teng3a9cefe2011-11-10 14:54:26 -0800386 int mMaxPrefetchYUVFrames;
Hong Tengcabd5f82011-07-06 18:33:09 -0700387 };
388
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700389 int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
James Dong2a7e0a12011-02-28 21:07:39 -0800390 void initRequiredProfileRefs(const Vector<int>& cameraIds);
391 int getRequiredProfileRefIndex(int cameraId);
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700392
James Dong1d7491b2010-01-19 17:45:38 -0800393 // Debug
394 static void logVideoCodec(const VideoCodec& codec);
395 static void logAudioCodec(const AudioCodec& codec);
396 static void logVideoEncoderCap(const VideoEncoderCap& cap);
397 static void logAudioEncoderCap(const AudioEncoderCap& cap);
398 static void logVideoDecoderCap(const VideoDecoderCap& cap);
399 static void logAudioDecoderCap(const AudioDecoderCap& cap);
Hong Tengcabd5f82011-07-06 18:33:09 -0700400 static void logVideoEditorCap(const VideoEditorCap& cap);
James Dong1d7491b2010-01-19 17:45:38 -0800401
402 // If the xml configuration file does exist, use the settings
403 // from the xml
404 static MediaProfiles* createInstanceFromXmlFile(const char *xml);
405 static output_format createEncoderOutputFileFormat(const char **atts);
406 static VideoCodec* createVideoCodec(const char **atts, MediaProfiles *profiles);
407 static AudioCodec* createAudioCodec(const char **atts, MediaProfiles *profiles);
408 static AudioDecoderCap* createAudioDecoderCap(const char **atts);
409 static VideoDecoderCap* createVideoDecoderCap(const char **atts);
410 static VideoEncoderCap* createVideoEncoderCap(const char **atts);
411 static AudioEncoderCap* createAudioEncoderCap(const char **atts);
Hong Tengcabd5f82011-07-06 18:33:09 -0700412 static VideoEditorCap* createVideoEditorCap(
413 const char **atts, MediaProfiles *profiles);
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700414 static ExportVideoProfile* createExportVideoProfile(const char **atts);
James Dong2a7e0a12011-02-28 21:07:39 -0800415
416 static CamcorderProfile* createCamcorderProfile(
417 int cameraId, const char **atts, Vector<int>& cameraIds);
418
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800419 static int getCameraId(const char **atts);
420
James Dong0f056292011-05-09 18:49:31 -0700421 void addStartTimeOffset(int cameraId, const char **atts);
422
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800423 ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const;
424 void addImageEncodingQualityLevel(int cameraId, const char** atts);
James Dong1d7491b2010-01-19 17:45:38 -0800425
426 // Customized element tag handler for parsing the xml configuration file.
427 static void startElementHandler(void *userData, const char *name, const char **atts);
428
429 // If the xml configuration file does not exist, use hard-coded values
430 static MediaProfiles* createDefaultInstance();
Nipun Kwatrad5672bc2010-09-16 22:25:23 -0700431
432 static CamcorderProfile *createDefaultCamcorderQcifProfile(camcorder_quality quality);
433 static CamcorderProfile *createDefaultCamcorderCifProfile(camcorder_quality quality);
434 static void createDefaultCamcorderLowProfiles(
435 MediaProfiles::CamcorderProfile **lowProfile,
436 MediaProfiles::CamcorderProfile **lowSpecificProfile);
437 static void createDefaultCamcorderHighProfiles(
438 MediaProfiles::CamcorderProfile **highProfile,
439 MediaProfiles::CamcorderProfile **highSpecificProfile);
440
441 static CamcorderProfile *createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality);
442 static CamcorderProfile *createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality);
443 static void createDefaultCamcorderTimeLapseLowProfiles(
444 MediaProfiles::CamcorderProfile **lowTimeLapseProfile,
445 MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile);
446 static void createDefaultCamcorderTimeLapseHighProfiles(
447 MediaProfiles::CamcorderProfile **highTimeLapseProfile,
448 MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile);
449
James Dong1d7491b2010-01-19 17:45:38 -0800450 static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
451 static void createDefaultVideoEncoders(MediaProfiles *profiles);
452 static void createDefaultAudioEncoders(MediaProfiles *profiles);
453 static void createDefaultVideoDecoders(MediaProfiles *profiles);
454 static void createDefaultAudioDecoders(MediaProfiles *profiles);
455 static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
James Dongf5a83852010-02-23 17:21:44 -0800456 static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
457 static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
Hong Tengcabd5f82011-07-06 18:33:09 -0700458 static void createDefaultVideoEditorCap(MediaProfiles *profiles);
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700459 static void createDefaultExportVideoProfiles(MediaProfiles *profiles);
460
James Dong1d7491b2010-01-19 17:45:38 -0800461 static VideoEncoderCap* createDefaultH263VideoEncoderCap();
462 static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
463 static AudioEncoderCap* createDefaultAmrNBEncoderCap();
464
465 static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name);
466
James Dong2a7e0a12011-02-28 21:07:39 -0800467 /**
468 * Check on existing profiles with the following criteria:
469 * 1. Low quality profile must have the lowest video
470 * resolution product (width x height)
471 * 2. High quality profile must have the highest video
472 * resolution product (width x height)
473 *
474 * and add required low/high quality camcorder/timelapse
475 * profiles if they are not found. This allows to remove
476 * duplicate profile definitions in the media_profiles.xml
477 * file.
478 */
479 void checkAndAddRequiredProfilesIfNecessary();
480
481
James Dong1d7491b2010-01-19 17:45:38 -0800482 // Mappings from name (for instance, codec name) to enum value
483 static const NameToTagMap sVideoEncoderNameMap[];
484 static const NameToTagMap sAudioEncoderNameMap[];
485 static const NameToTagMap sFileFormatMap[];
486 static const NameToTagMap sVideoDecoderNameMap[];
487 static const NameToTagMap sAudioDecoderNameMap[];
488 static const NameToTagMap sCamcorderQualityNameMap[];
489
490 static bool sIsInitialized;
491 static MediaProfiles *sInstance;
492 static Mutex sLock;
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800493 int mCurrentCameraId;
James Dong1d7491b2010-01-19 17:45:38 -0800494
495 Vector<CamcorderProfile*> mCamcorderProfiles;
496 Vector<AudioEncoderCap*> mAudioEncoders;
497 Vector<VideoEncoderCap*> mVideoEncoders;
498 Vector<AudioDecoderCap*> mAudioDecoders;
499 Vector<VideoDecoderCap*> mVideoDecoders;
500 Vector<output_format> mEncoderOutputFileFormats;
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800501 Vector<ImageEncodingQualityLevels *> mImageEncodingQualityLevels;
James Dong0f056292011-05-09 18:49:31 -0700502 KeyedVector<int, int> mStartTimeOffsets;
James Dong2a7e0a12011-02-28 21:07:39 -0800503
504 typedef struct {
505 bool mHasRefProfile; // Refers to an existing profile
506 int mRefProfileIndex; // Reference profile index
507 int mResolutionProduct; // width x height
508 } RequiredProfileRefInfo; // Required low and high profiles
509
510 typedef struct {
511 RequiredProfileRefInfo mRefs[kNumRequiredProfiles];
512 int mCameraId;
513 } RequiredProfiles;
514
515 RequiredProfiles *mRequiredProfileRefs;
516 Vector<int> mCameraIds;
Hong Tengcabd5f82011-07-06 18:33:09 -0700517 VideoEditorCap* mVideoEditorCap;
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700518 Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
James Dong1d7491b2010-01-19 17:45:38 -0800519};
520
521}; // namespace android
522
523#endif // ANDROID_MEDIAPROFILES_H