blob: d202fbcd31660ca0b80cb7eae909859977adc3d8 [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,
James Dong669012d2011-09-19 16:27:31 -070035 CAMCORDER_QUALITY_QVGA = 7,
Zhijun He5f6af1a2014-06-10 08:26:33 -070036 CAMCORDER_QUALITY_2160P = 8,
37 CAMCORDER_QUALITY_LIST_END = 8,
Nipun Kwatrac0a84782010-09-06 15:59:02 -070038
James Dong2a7e0a12011-02-28 21:07:39 -080039 CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000,
Nipun Kwatrac0a84782010-09-06 15:59:02 -070040 CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000,
41 CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001,
42 CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002,
Nipun Kwatra9783ed82010-09-10 15:45:57 -070043 CAMCORDER_QUALITY_TIME_LAPSE_CIF = 1003,
44 CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004,
45 CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005,
James Dong2a7e0a12011-02-28 21:07:39 -080046 CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006,
James Dong669012d2011-09-19 16:27:31 -070047 CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007,
Zhijun He5f6af1a2014-06-10 08:26:33 -070048 CAMCORDER_QUALITY_TIME_LAPSE_2160P = 1008,
49 CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1008,
James Dong1d7491b2010-01-19 17:45:38 -080050};
51
Hong Tengcabd5f82011-07-06 18:33:09 -070052/**
Hong Teng3a9cefe2011-11-10 14:54:26 -080053 * Set CIF as default maximum import and export resolution of video editor.
54 * The maximum import and export resolutions are platform specific,
55 * which should be defined in media_profiles.xml.
56 * Set default maximum prefetch YUV frames to 6, which means video editor can
57 * queue up to 6 YUV frames in the video encoder source.
58 * This value is used to limit the amount of memory used by video editor
59 * engine when the encoder consumes YUV frames at a lower speed
60 * than video editor engine produces.
Hong Tengcabd5f82011-07-06 18:33:09 -070061 */
62enum videoeditor_capability {
63 VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352,
64 VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288,
65 VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352,
66 VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288,
Hong Teng3a9cefe2011-11-10 14:54:26 -080067 VIDEOEDITOR_DEFAULT_MAX_PREFETCH_YUV_FRAMES = 6
Hong Tengcabd5f82011-07-06 18:33:09 -070068};
69
James Dong1d7491b2010-01-19 17:45:38 -080070enum video_decoder {
71 VIDEO_DECODER_WMV,
72};
73
74enum audio_decoder {
75 AUDIO_DECODER_WMA,
76};
77
78
79class MediaProfiles
80{
81public:
82
83 /**
84 * Returns the singleton instance for subsequence queries.
85 * or NULL if error.
86 */
87 static MediaProfiles* getInstance();
88
89 /**
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +080090 * Returns the value for the given param name for the given camera at
91 * the given quality level, or -1 if error.
James Dong1d7491b2010-01-19 17:45:38 -080092 *
93 * Supported param name are:
James Dongf5a83852010-02-23 17:21:44 -080094 * duration - the recording duration.
James Dong1d7491b2010-01-19 17:45:38 -080095 * file.format - output file format. see mediarecorder.h for details
James Dong13896b92010-02-03 16:50:18 -080096 * vid.codec - video encoder. see mediarecorder.h for details.
97 * aud.codec - audio encoder. see mediarecorder.h for details.
James Dong1d7491b2010-01-19 17:45:38 -080098 * vid.width - video frame width
99 * vid.height - video frame height
100 * vid.fps - video frame rate
101 * vid.bps - video bit rate
102 * aud.bps - audio bit rate
103 * aud.hz - audio sample rate
104 * aud.ch - number of audio channels
105 */
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800106 int getCamcorderProfileParamByName(const char *name, int cameraId,
107 camcorder_quality quality) const;
James Dong1d7491b2010-01-19 17:45:38 -0800108
109 /**
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700110 * Returns true if a profile for the given camera at the given quality exists,
111 * or false if not.
112 */
113 bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
114
115 /**
James Dong1d7491b2010-01-19 17:45:38 -0800116 * Returns the output file formats supported.
117 */
118 Vector<output_format> getOutputFileFormats() const;
119
120 /**
121 * Returns the video encoders supported.
122 */
123 Vector<video_encoder> getVideoEncoders() const;
124
125 /**
126 * Returns the value for the given param name for the given video encoder
127 * returned from getVideoEncoderByIndex or -1 if error.
128 *
129 * Supported param name are:
130 * enc.vid.width.min - min video frame width
131 * enc.vid.width.max - max video frame width
132 * enc.vid.height.min - min video frame height
133 * enc.vid.height.max - max video frame height
134 * enc.vid.bps.min - min bit rate in bits per second
135 * enc.vid.bps.max - max bit rate in bits per second
136 * enc.vid.fps.min - min frame rate in frames per second
137 * enc.vid.fps.max - max frame rate in frames per second
138 */
139 int getVideoEncoderParamByName(const char *name, video_encoder codec) const;
140
141 /**
Hong Tengcabd5f82011-07-06 18:33:09 -0700142 * Returns the value for the given param name for the video editor cap
143 * param or -1 if error.
144 * Supported param name are:
145 * videoeditor.input.width.max - max input video frame width
146 * videoeditor.input.height.max - max input video frame height
147 * videoeditor.output.width.max - max output video frame width
148 * videoeditor.output.height.max - max output video frame height
Hong Teng3a9cefe2011-11-10 14:54:26 -0800149 * maxPrefetchYUVFrames - max prefetch YUV frames in video editor engine. This value is used
150 * to limit the memory consumption.
Hong Tengcabd5f82011-07-06 18:33:09 -0700151 */
152 int getVideoEditorCapParamByName(const char *name) const;
153
154 /**
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700155 * Returns the value for the given param name for the video editor export codec format
156 * param or -1 if error.
157 * Supported param name are:
158 * videoeditor.export.profile - export video profile
159 * videoeditor.export.level - export video level
160 * Supported param codec are:
161 * 1 for h263
162 * 2 for h264
163 * 3 for mpeg4
164 */
165 int getVideoEditorExportParamByName(const char *name, int codec) const;
166
167 /**
James Dong1d7491b2010-01-19 17:45:38 -0800168 * Returns the audio encoders supported.
169 */
170 Vector<audio_encoder> getAudioEncoders() const;
171
172 /**
173 * Returns the value for the given param name for the given audio encoder
174 * returned from getAudioEncoderByIndex or -1 if error.
175 *
176 * Supported param name are:
177 * enc.aud.ch.min - min number of channels
178 * enc.aud.ch.max - max number of channels
179 * enc.aud.bps.min - min bit rate in bits per second
180 * enc.aud.bps.max - max bit rate in bits per second
181 * enc.aud.hz.min - min sample rate in samples per second
182 * enc.aud.hz.max - max sample rate in samples per second
183 */
184 int getAudioEncoderParamByName(const char *name, audio_encoder codec) const;
185
186 /**
187 * Returns the video decoders supported.
188 */
189 Vector<video_decoder> getVideoDecoders() const;
190
191 /**
192 * Returns the audio decoders supported.
193 */
194 Vector<audio_decoder> getAudioDecoders() const;
195
James Dongf5a83852010-02-23 17:21:44 -0800196 /**
197 * Returns the number of image encoding quality levels supported.
198 */
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800199 Vector<int> getImageEncodingQualityLevels(int cameraId) const;
James Dongf5a83852010-02-23 17:21:44 -0800200
James Dong0f056292011-05-09 18:49:31 -0700201 /**
202 * Returns the start time offset (in ms) for the given camera Id.
203 * If the given camera Id does not exist, -1 will be returned.
204 */
205 int getStartTimeOffsetMs(int cameraId) const;
206
James Dong1d7491b2010-01-19 17:45:38 -0800207private:
James Dong2a7e0a12011-02-28 21:07:39 -0800208 enum {
209 // Camcorder profiles (high/low) and timelapse profiles (high/low)
210 kNumRequiredProfiles = 4,
211 };
212
James Dong1d7491b2010-01-19 17:45:38 -0800213 MediaProfiles& operator=(const MediaProfiles&); // Don't call me
214 MediaProfiles(const MediaProfiles&); // Don't call me
Hong Tengcabd5f82011-07-06 18:33:09 -0700215 MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor
James Dong1d7491b2010-01-19 17:45:38 -0800216 ~MediaProfiles(); // Don't delete me
217
218 struct VideoCodec {
219 VideoCodec(video_encoder codec, int bitRate, int frameWidth, int frameHeight, int frameRate)
220 : mCodec(codec),
221 mBitRate(bitRate),
222 mFrameWidth(frameWidth),
223 mFrameHeight(frameHeight),
224 mFrameRate(frameRate) {}
225
James Dong2a7e0a12011-02-28 21:07:39 -0800226 VideoCodec(const VideoCodec& copy) {
227 mCodec = copy.mCodec;
228 mBitRate = copy.mBitRate;
229 mFrameWidth = copy.mFrameWidth;
230 mFrameHeight = copy.mFrameHeight;
231 mFrameRate = copy.mFrameRate;
232 }
233
James Dong1d7491b2010-01-19 17:45:38 -0800234 ~VideoCodec() {}
235
236 video_encoder mCodec;
237 int mBitRate;
238 int mFrameWidth;
239 int mFrameHeight;
240 int mFrameRate;
241 };
242
243 struct AudioCodec {
244 AudioCodec(audio_encoder codec, int bitRate, int sampleRate, int channels)
245 : mCodec(codec),
246 mBitRate(bitRate),
247 mSampleRate(sampleRate),
248 mChannels(channels) {}
249
James Dong2a7e0a12011-02-28 21:07:39 -0800250 AudioCodec(const AudioCodec& copy) {
251 mCodec = copy.mCodec;
252 mBitRate = copy.mBitRate;
253 mSampleRate = copy.mSampleRate;
254 mChannels = copy.mChannels;
255 }
256
James Dong1d7491b2010-01-19 17:45:38 -0800257 ~AudioCodec() {}
258
259 audio_encoder mCodec;
260 int mBitRate;
261 int mSampleRate;
262 int mChannels;
263 };
264
265 struct CamcorderProfile {
266 CamcorderProfile()
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800267 : mCameraId(0),
268 mFileFormat(OUTPUT_FORMAT_THREE_GPP),
James Dong1d7491b2010-01-19 17:45:38 -0800269 mQuality(CAMCORDER_QUALITY_HIGH),
270 mDuration(0),
271 mVideoCodec(0),
272 mAudioCodec(0) {}
273
James Dong2a7e0a12011-02-28 21:07:39 -0800274 CamcorderProfile(const CamcorderProfile& copy) {
275 mCameraId = copy.mCameraId;
276 mFileFormat = copy.mFileFormat;
277 mQuality = copy.mQuality;
278 mDuration = copy.mDuration;
279 mVideoCodec = new VideoCodec(*copy.mVideoCodec);
280 mAudioCodec = new AudioCodec(*copy.mAudioCodec);
281 }
282
James Dong1d7491b2010-01-19 17:45:38 -0800283 ~CamcorderProfile() {
284 delete mVideoCodec;
285 delete mAudioCodec;
286 }
287
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800288 int mCameraId;
James Dong1d7491b2010-01-19 17:45:38 -0800289 output_format mFileFormat;
290 camcorder_quality mQuality;
291 int mDuration;
292 VideoCodec *mVideoCodec;
293 AudioCodec *mAudioCodec;
294 };
295
296 struct VideoEncoderCap {
297 // Ugly constructor
298 VideoEncoderCap(video_encoder codec,
299 int minBitRate, int maxBitRate,
300 int minFrameWidth, int maxFrameWidth,
301 int minFrameHeight, int maxFrameHeight,
302 int minFrameRate, int maxFrameRate)
303 : mCodec(codec),
304 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
305 mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth),
306 mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight),
307 mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {}
308
309 ~VideoEncoderCap() {}
310
311 video_encoder mCodec;
312 int mMinBitRate, mMaxBitRate;
313 int mMinFrameWidth, mMaxFrameWidth;
314 int mMinFrameHeight, mMaxFrameHeight;
315 int mMinFrameRate, mMaxFrameRate;
316 };
317
318 struct AudioEncoderCap {
319 // Ugly constructor
320 AudioEncoderCap(audio_encoder codec,
321 int minBitRate, int maxBitRate,
322 int minSampleRate, int maxSampleRate,
323 int minChannels, int maxChannels)
324 : mCodec(codec),
325 mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
326 mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate),
327 mMinChannels(minChannels), mMaxChannels(maxChannels) {}
328
329 ~AudioEncoderCap() {}
330
331 audio_encoder mCodec;
332 int mMinBitRate, mMaxBitRate;
333 int mMinSampleRate, mMaxSampleRate;
334 int mMinChannels, mMaxChannels;
335 };
336
337 struct VideoDecoderCap {
338 VideoDecoderCap(video_decoder codec): mCodec(codec) {}
339 ~VideoDecoderCap() {}
340
341 video_decoder mCodec;
342 };
343
344 struct AudioDecoderCap {
345 AudioDecoderCap(audio_decoder codec): mCodec(codec) {}
346 ~AudioDecoderCap() {}
347
348 audio_decoder mCodec;
349 };
350
351 struct NameToTagMap {
352 const char* name;
353 int tag;
354 };
355
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800356 struct ImageEncodingQualityLevels {
357 int mCameraId;
358 Vector<int> mLevels;
359 };
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700360 struct ExportVideoProfile {
361 ExportVideoProfile(int codec, int profile, int level)
362 :mCodec(codec),mProfile(profile),mLevel(level) {}
363 ~ExportVideoProfile() {}
364 int mCodec;
365 int mProfile;
366 int mLevel;
367 };
Hong Tengcabd5f82011-07-06 18:33:09 -0700368 struct VideoEditorCap {
369 VideoEditorCap(int inFrameWidth, int inFrameHeight,
Hong Teng3a9cefe2011-11-10 14:54:26 -0800370 int outFrameWidth, int outFrameHeight, int frames)
Hong Tengcabd5f82011-07-06 18:33:09 -0700371 : mMaxInputFrameWidth(inFrameWidth),
372 mMaxInputFrameHeight(inFrameHeight),
373 mMaxOutputFrameWidth(outFrameWidth),
Hong Teng3a9cefe2011-11-10 14:54:26 -0800374 mMaxOutputFrameHeight(outFrameHeight),
375 mMaxPrefetchYUVFrames(frames) {}
Hong Tengcabd5f82011-07-06 18:33:09 -0700376
377 ~VideoEditorCap() {}
378
379 int mMaxInputFrameWidth;
380 int mMaxInputFrameHeight;
381 int mMaxOutputFrameWidth;
382 int mMaxOutputFrameHeight;
Hong Teng3a9cefe2011-11-10 14:54:26 -0800383 int mMaxPrefetchYUVFrames;
Hong Tengcabd5f82011-07-06 18:33:09 -0700384 };
385
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700386 int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
James Dong2a7e0a12011-02-28 21:07:39 -0800387 void initRequiredProfileRefs(const Vector<int>& cameraIds);
388 int getRequiredProfileRefIndex(int cameraId);
Nipun Kwatra8bb56032010-09-09 16:25:08 -0700389
James Dong1d7491b2010-01-19 17:45:38 -0800390 // Debug
391 static void logVideoCodec(const VideoCodec& codec);
392 static void logAudioCodec(const AudioCodec& codec);
393 static void logVideoEncoderCap(const VideoEncoderCap& cap);
394 static void logAudioEncoderCap(const AudioEncoderCap& cap);
395 static void logVideoDecoderCap(const VideoDecoderCap& cap);
396 static void logAudioDecoderCap(const AudioDecoderCap& cap);
Hong Tengcabd5f82011-07-06 18:33:09 -0700397 static void logVideoEditorCap(const VideoEditorCap& cap);
James Dong1d7491b2010-01-19 17:45:38 -0800398
399 // If the xml configuration file does exist, use the settings
400 // from the xml
401 static MediaProfiles* createInstanceFromXmlFile(const char *xml);
402 static output_format createEncoderOutputFileFormat(const char **atts);
403 static VideoCodec* createVideoCodec(const char **atts, MediaProfiles *profiles);
404 static AudioCodec* createAudioCodec(const char **atts, MediaProfiles *profiles);
405 static AudioDecoderCap* createAudioDecoderCap(const char **atts);
406 static VideoDecoderCap* createVideoDecoderCap(const char **atts);
407 static VideoEncoderCap* createVideoEncoderCap(const char **atts);
408 static AudioEncoderCap* createAudioEncoderCap(const char **atts);
Hong Tengcabd5f82011-07-06 18:33:09 -0700409 static VideoEditorCap* createVideoEditorCap(
410 const char **atts, MediaProfiles *profiles);
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700411 static ExportVideoProfile* createExportVideoProfile(const char **atts);
James Dong2a7e0a12011-02-28 21:07:39 -0800412
413 static CamcorderProfile* createCamcorderProfile(
414 int cameraId, const char **atts, Vector<int>& cameraIds);
415
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800416 static int getCameraId(const char **atts);
417
James Dong0f056292011-05-09 18:49:31 -0700418 void addStartTimeOffset(int cameraId, const char **atts);
419
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800420 ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const;
421 void addImageEncodingQualityLevel(int cameraId, const char** atts);
James Dong1d7491b2010-01-19 17:45:38 -0800422
423 // Customized element tag handler for parsing the xml configuration file.
424 static void startElementHandler(void *userData, const char *name, const char **atts);
425
426 // If the xml configuration file does not exist, use hard-coded values
427 static MediaProfiles* createDefaultInstance();
Nipun Kwatrad5672bc2010-09-16 22:25:23 -0700428
429 static CamcorderProfile *createDefaultCamcorderQcifProfile(camcorder_quality quality);
430 static CamcorderProfile *createDefaultCamcorderCifProfile(camcorder_quality quality);
431 static void createDefaultCamcorderLowProfiles(
432 MediaProfiles::CamcorderProfile **lowProfile,
433 MediaProfiles::CamcorderProfile **lowSpecificProfile);
434 static void createDefaultCamcorderHighProfiles(
435 MediaProfiles::CamcorderProfile **highProfile,
436 MediaProfiles::CamcorderProfile **highSpecificProfile);
437
438 static CamcorderProfile *createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality);
439 static CamcorderProfile *createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality);
440 static void createDefaultCamcorderTimeLapseLowProfiles(
441 MediaProfiles::CamcorderProfile **lowTimeLapseProfile,
442 MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile);
443 static void createDefaultCamcorderTimeLapseHighProfiles(
444 MediaProfiles::CamcorderProfile **highTimeLapseProfile,
445 MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile);
446
James Dong1d7491b2010-01-19 17:45:38 -0800447 static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
448 static void createDefaultVideoEncoders(MediaProfiles *profiles);
449 static void createDefaultAudioEncoders(MediaProfiles *profiles);
450 static void createDefaultVideoDecoders(MediaProfiles *profiles);
451 static void createDefaultAudioDecoders(MediaProfiles *profiles);
452 static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
James Dongf5a83852010-02-23 17:21:44 -0800453 static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
454 static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
Hong Tengcabd5f82011-07-06 18:33:09 -0700455 static void createDefaultVideoEditorCap(MediaProfiles *profiles);
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700456 static void createDefaultExportVideoProfiles(MediaProfiles *profiles);
457
James Dong1d7491b2010-01-19 17:45:38 -0800458 static VideoEncoderCap* createDefaultH263VideoEncoderCap();
459 static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
460 static AudioEncoderCap* createDefaultAmrNBEncoderCap();
461
462 static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name);
463
James Dong2a7e0a12011-02-28 21:07:39 -0800464 /**
465 * Check on existing profiles with the following criteria:
466 * 1. Low quality profile must have the lowest video
467 * resolution product (width x height)
468 * 2. High quality profile must have the highest video
469 * resolution product (width x height)
470 *
471 * and add required low/high quality camcorder/timelapse
472 * profiles if they are not found. This allows to remove
473 * duplicate profile definitions in the media_profiles.xml
474 * file.
475 */
476 void checkAndAddRequiredProfilesIfNecessary();
477
478
James Dong1d7491b2010-01-19 17:45:38 -0800479 // Mappings from name (for instance, codec name) to enum value
480 static const NameToTagMap sVideoEncoderNameMap[];
481 static const NameToTagMap sAudioEncoderNameMap[];
482 static const NameToTagMap sFileFormatMap[];
483 static const NameToTagMap sVideoDecoderNameMap[];
484 static const NameToTagMap sAudioDecoderNameMap[];
485 static const NameToTagMap sCamcorderQualityNameMap[];
486
487 static bool sIsInitialized;
488 static MediaProfiles *sInstance;
489 static Mutex sLock;
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800490 int mCurrentCameraId;
James Dong1d7491b2010-01-19 17:45:38 -0800491
492 Vector<CamcorderProfile*> mCamcorderProfiles;
493 Vector<AudioEncoderCap*> mAudioEncoders;
494 Vector<VideoEncoderCap*> mVideoEncoders;
495 Vector<AudioDecoderCap*> mAudioDecoders;
496 Vector<VideoDecoderCap*> mVideoDecoders;
497 Vector<output_format> mEncoderOutputFileFormats;
Chih-Chung Chang3eaa4e92010-06-22 20:50:55 +0800498 Vector<ImageEncodingQualityLevels *> mImageEncodingQualityLevels;
James Dong0f056292011-05-09 18:49:31 -0700499 KeyedVector<int, int> mStartTimeOffsets;
James Dong2a7e0a12011-02-28 21:07:39 -0800500
501 typedef struct {
502 bool mHasRefProfile; // Refers to an existing profile
503 int mRefProfileIndex; // Reference profile index
504 int mResolutionProduct; // width x height
505 } RequiredProfileRefInfo; // Required low and high profiles
506
507 typedef struct {
508 RequiredProfileRefInfo mRefs[kNumRequiredProfiles];
509 int mCameraId;
510 } RequiredProfiles;
511
512 RequiredProfiles *mRequiredProfileRefs;
513 Vector<int> mCameraIds;
Hong Tengcabd5f82011-07-06 18:33:09 -0700514 VideoEditorCap* mVideoEditorCap;
Rajneesh Chowdury8f74b712011-08-12 16:43:37 -0700515 Vector<ExportVideoProfile*> mVideoEditorExportProfiles;
James Dong1d7491b2010-01-19 17:45:38 -0800516};
517
518}; // namespace android
519
520#endif // ANDROID_MEDIAPROFILES_H