• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
24 #include <vector>
25 
26 namespace android {
27 
28 enum camcorder_quality {
29     CAMCORDER_QUALITY_LIST_START = 0,
30     CAMCORDER_QUALITY_LOW  = 0,
31     CAMCORDER_QUALITY_HIGH = 1,
32     CAMCORDER_QUALITY_QCIF = 2,
33     CAMCORDER_QUALITY_CIF = 3,
34     CAMCORDER_QUALITY_480P = 4,
35     CAMCORDER_QUALITY_720P = 5,
36     CAMCORDER_QUALITY_1080P = 6,
37     CAMCORDER_QUALITY_QVGA = 7,
38     CAMCORDER_QUALITY_2160P = 8,
39     CAMCORDER_QUALITY_VGA = 9,
40     CAMCORDER_QUALITY_4KDCI = 10,
41     CAMCORDER_QUALITY_QHD = 11,
42     CAMCORDER_QUALITY_2K = 12,
43     CAMCORDER_QUALITY_8KUHD = 13,
44     CAMCORDER_QUALITY_LIST_END = 13,
45 
46     CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000,
47     CAMCORDER_QUALITY_TIME_LAPSE_LOW  = 1000,
48     CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001,
49     CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002,
50     CAMCORDER_QUALITY_TIME_LAPSE_CIF = 1003,
51     CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004,
52     CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005,
53     CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006,
54     CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007,
55     CAMCORDER_QUALITY_TIME_LAPSE_2160P = 1008,
56     CAMCORDER_QUALITY_TIME_LAPSE_VGA = 1009,
57     CAMCORDER_QUALITY_TIME_LAPSE_4KDCI = 1010,
58     CAMCORDER_QUALITY_TIME_LAPSE_QHD = 1011,
59     CAMCORDER_QUALITY_TIME_LAPSE_2K = 1012,
60     CAMCORDER_QUALITY_TIME_LAPSE_8KUHD = 1013,
61     CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1013,
62 
63     CAMCORDER_QUALITY_HIGH_SPEED_LIST_START = 2000,
64     CAMCORDER_QUALITY_HIGH_SPEED_LOW  = 2000,
65     CAMCORDER_QUALITY_HIGH_SPEED_HIGH = 2001,
66     CAMCORDER_QUALITY_HIGH_SPEED_480P = 2002,
67     CAMCORDER_QUALITY_HIGH_SPEED_720P = 2003,
68     CAMCORDER_QUALITY_HIGH_SPEED_1080P = 2004,
69     CAMCORDER_QUALITY_HIGH_SPEED_2160P = 2005,
70     CAMCORDER_QUALITY_HIGH_SPEED_CIF = 2006,
71     CAMCORDER_QUALITY_HIGH_SPEED_VGA = 2007,
72     CAMCORDER_QUALITY_HIGH_SPEED_4KDCI = 2008,
73     CAMCORDER_QUALITY_HIGH_SPEED_LIST_END = 2008,
74 };
75 
76 enum video_decoder {
77     VIDEO_DECODER_WMV,
78 };
79 
80 enum audio_decoder {
81     AUDIO_DECODER_WMA,
82 };
83 
84 enum chroma_subsampling {
85     CHROMA_SUBSAMPLING_YUV_420,
86     CHROMA_SUBSAMPLING_YUV_422,
87     CHROMA_SUBSAMPLING_YUV_444,
88 };
89 
90 enum hdr_format {
91     HDR_FORMAT_NONE,
92     HDR_FORMAT_HLG,
93     HDR_FORMAT_HDR10,
94     HDR_FORMAT_HDR10PLUS,
95     HDR_FORMAT_DOLBY_VISION,
96 };
97 
98 class MediaProfiles
99 {
100 public:
101 
102     /**
103      * Returns the singleton instance for subsequence queries or NULL if error.
104      *
105      * If property media.settings.xml is set, getInstance() will attempt to read
106      * from file path in media.settings.xml. Otherwise, getInstance() will
107      * search through the list of preset XML file paths.
108      *
109      * If the search is unsuccessful, the default instance will be created
110      * instead.
111      *
112      * TODO: After validation is added, getInstance() should handle validation
113      * failure properly.
114      */
115     static MediaProfiles* getInstance();
116 
117     /**
118      * Configuration for a video encoder.
119      */
120     struct VideoCodec {
121     public:
122         /**
123          * Constructs a video encoder configuration.
124          *
125          * @param codec codec type
126          * @param bitrate bitrate in bps
127          * @param frameWidth frame width in pixels
128          * @param frameHeight frame height in pixels
129          * @param frameRate frame rate in fps
130          * @param profile codec profile (for MediaCodec) or -1 for none
131          */
132         VideoCodec(video_encoder codec, int bitrate, int frameWidth, int frameHeight, int frameRate,
133                    int profile = -1,
134                    chroma_subsampling chroma = CHROMA_SUBSAMPLING_YUV_420,
135                    int bitDepth = 8,
136                    hdr_format hdr = HDR_FORMAT_NONE)
mCodecVideoCodec137             : mCodec(codec),
138               mBitRate(bitrate),
139               mFrameWidth(frameWidth),
140               mFrameHeight(frameHeight),
141               mFrameRate(frameRate),
142               mProfile(profile),
143               mChromaSubsampling(chroma),
144               mBitDepth(bitDepth),
145               mHdrFormat(hdr) {
146         }
147 
148         VideoCodec(const VideoCodec&) = default;
149 
~VideoCodecVideoCodec150         ~VideoCodec() {}
151 
152         /** Returns the codec type. */
getCodecVideoCodec153         video_encoder getCodec() const {
154             return mCodec;
155         }
156 
157         /** Returns the bitrate in bps. */
getBitrateVideoCodec158         int getBitrate() const {
159             return mBitRate;
160         }
161 
162         /** Returns the frame width in pixels. */
getFrameWidthVideoCodec163         int getFrameWidth() const {
164             return mFrameWidth;
165         }
166 
167         /** Returns the frame height in pixels. */
getFrameHeightVideoCodec168         int getFrameHeight() const {
169             return mFrameHeight;
170         }
171 
172         /** Returns the frame rate in fps. */
getFrameRateVideoCodec173         int getFrameRate() const {
174             return mFrameRate;
175         }
176 
177         /** Returns the codec profile (or -1 for no profile). */
getProfileVideoCodec178         int getProfile() const {
179             return mProfile;
180         }
181 
182         /** Returns the chroma subsampling. */
getChromaSubsamplingVideoCodec183         chroma_subsampling getChromaSubsampling() const {
184             return mChromaSubsampling;
185         }
186 
187         /** Returns the bit depth. */
getBitDepthVideoCodec188         int getBitDepth() const {
189             return mBitDepth;
190         }
191 
192         /** Returns the chroma subsampling. */
getHdrFormatVideoCodec193         hdr_format getHdrFormat() const {
194             return mHdrFormat;
195         }
196 
197     private:
198         video_encoder mCodec;
199         int mBitRate;
200         int mFrameWidth;
201         int mFrameHeight;
202         int mFrameRate;
203         int mProfile;
204         chroma_subsampling mChromaSubsampling;
205         int mBitDepth;
206         hdr_format mHdrFormat;
207         friend class MediaProfiles;
208     };
209 
210     /**
211      * Configuration for an audio encoder.
212      */
213     struct AudioCodec {
214     public:
215         /**
216          * Constructs an audio encoder configuration.
217          *
218          * @param codec codec type
219          * @param bitrate bitrate in bps
220          * @param sampleRate sample rate in Hz
221          * @param channels number of channels
222          * @param profile codec profile (for MediaCodec) or -1 for none
223          */
224         AudioCodec(audio_encoder codec, int bitrate, int sampleRate, int channels, int profile = -1)
mCodecAudioCodec225             : mCodec(codec),
226               mBitRate(bitrate),
227               mSampleRate(sampleRate),
228               mChannels(channels),
229               mProfile(profile) {
230         }
231 
232         AudioCodec(const AudioCodec&) = default;
233 
~AudioCodecAudioCodec234         ~AudioCodec() {}
235 
236         /** Returns the codec type. */
getCodecAudioCodec237         audio_encoder getCodec() const {
238             return mCodec;
239         }
240 
241         /** Returns the bitrate in bps. */
getBitrateAudioCodec242         int getBitrate() const {
243             return mBitRate;
244         }
245 
246         /** Returns the sample rate in Hz. */
getSampleRateAudioCodec247         int getSampleRate() const {
248             return mSampleRate;
249         }
250 
251         /** Returns the number of channels. */
getChannelsAudioCodec252         int getChannels() const {
253             return mChannels;
254         }
255 
256         /** Returns the codec profile (or -1 for no profile). */
getProfileAudioCodec257         int getProfile() const {
258             return mProfile;
259         }
260 
261     private:
262         audio_encoder mCodec;
263         int mBitRate;
264         int mSampleRate;
265         int mChannels;
266         int mProfile;
267         friend class MediaProfiles;
268     };
269 
270     /**
271      * Configuration for a camcorder profile/encoder profiles object.
272      */
273     struct CamcorderProfile {
274         /**
275          *  Returns on ordered list of the video codec configurations in
276          *  decreasing preference. The returned object is only valid
277          *  during the lifetime of this object.
278          */
279         std::vector<const VideoCodec *> getVideoCodecs() const;
280 
281         /**
282          *  Returns on ordered list of the audio codec configurations in
283          *  decreasing preference. The returned object is only valid
284          *  during the lifetime of this object.
285          */
286         std::vector<const AudioCodec *> getAudioCodecs() const;
287 
288         /** Returns the default duration in seconds. */
getDurationCamcorderProfile289         int getDuration() const {
290             return mDuration;
291         }
292 
293         /** Returns the preferred file format. */
getFileFormatCamcorderProfile294         int getFileFormat() const {
295             return mFileFormat;
296         }
297 
298         CamcorderProfile(const CamcorderProfile& copy) = default;
299 
300         ~CamcorderProfile() = default;
301 
302     private:
303         /**
304          * Constructs an empty object with no audio/video profiles.
305          */
CamcorderProfileCamcorderProfile306         CamcorderProfile()
307             : mCameraId(0),
308               mFileFormat(OUTPUT_FORMAT_THREE_GPP),
309               mQuality(CAMCORDER_QUALITY_HIGH),
310               mDuration(0) {}
311 
312         int mCameraId;
313         output_format mFileFormat;
314         camcorder_quality mQuality;
315         int mDuration;
316         std::vector<VideoCodec> mVideoCodecs;
317         std::vector<AudioCodec> mAudioCodecs;
318         friend class MediaProfiles;
319     };
320 
321     /**
322      * Returns the CamcorderProfile object for the given camera at
323      * the given quality level, or null if it does not exist.
324      */
325     const CamcorderProfile *getCamcorderProfile(
326             int cameraId, camcorder_quality quality) const;
327 
328     /**
329      * Returns the value for the given param name for the given camera at
330      * the given quality level, or -1 if error.
331      *
332      * Supported param name are:
333      * duration - the recording duration.
334      * file.format - output file format. see mediarecorder.h for details
335      * vid.codec - video encoder. see mediarecorder.h for details.
336      * aud.codec - audio encoder. see mediarecorder.h for details.
337      * vid.width - video frame width
338      * vid.height - video frame height
339      * vid.fps - video frame rate
340      * vid.bps - video bit rate
341      * aud.bps - audio bit rate
342      * aud.hz - audio sample rate
343      * aud.ch - number of audio channels
344      */
345     int getCamcorderProfileParamByName(const char *name, int cameraId,
346                                        camcorder_quality quality) const;
347 
348     /**
349      * Returns true if a profile for the given camera at the given quality exists,
350      * or false if not.
351      */
352     bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
353 
354     /**
355      * Returns the output file formats supported.
356      */
357     Vector<output_format> getOutputFileFormats() const;
358 
359     /**
360      * Returns the video encoders supported.
361      */
362     Vector<video_encoder> getVideoEncoders() const;
363 
364     /**
365      * Returns the value for the given param name for the given video encoder
366      * returned from getVideoEncoderByIndex or -1 if error.
367      *
368      * Supported param name are:
369      * enc.vid.width.min - min video frame width
370      * enc.vid.width.max - max video frame width
371      * enc.vid.height.min - min video frame height
372      * enc.vid.height.max - max video frame height
373      * enc.vid.bps.min - min bit rate in bits per second
374      * enc.vid.bps.max - max bit rate in bits per second
375      * enc.vid.fps.min - min frame rate in frames per second
376      * enc.vid.fps.max - max frame rate in frames per second
377      */
378     int getVideoEncoderParamByName(const char *name, video_encoder codec) const;
379 
380     /**
381      * Returns the audio encoders supported.
382      */
383     Vector<audio_encoder> getAudioEncoders() const;
384 
385     /**
386      * Returns the value for the given param name for the given audio encoder
387      * returned from getAudioEncoderByIndex or -1 if error.
388      *
389      * Supported param name are:
390      * enc.aud.ch.min - min number of channels
391      * enc.aud.ch.max - max number of channels
392      * enc.aud.bps.min - min bit rate in bits per second
393      * enc.aud.bps.max - max bit rate in bits per second
394      * enc.aud.hz.min - min sample rate in samples per second
395      * enc.aud.hz.max - max sample rate in samples per second
396      */
397     int getAudioEncoderParamByName(const char *name, audio_encoder codec) const;
398 
399     /**
400       * Returns the video decoders supported.
401       */
402     Vector<video_decoder> getVideoDecoders() const;
403 
404      /**
405       * Returns the audio decoders supported.
406       */
407     Vector<audio_decoder> getAudioDecoders() const;
408 
409     /**
410      * Returns the number of image encoding quality levels supported.
411      */
412     Vector<int> getImageEncodingQualityLevels(int cameraId) const;
413 
414     /**
415      * Returns the start time offset (in ms) for the given camera Id.
416      * If the given camera Id does not exist, -1 will be returned.
417      */
418     int getStartTimeOffsetMs(int cameraId) const;
419 
420 private:
421     enum {
422         // Camcorder profiles (high/low) and timelapse profiles (high/low)
423         kNumRequiredProfiles = 4,
424     };
425 
426     MediaProfiles& operator=(const MediaProfiles&);  // Don't call me
427     MediaProfiles(const MediaProfiles&);             // Don't call me
MediaProfiles()428     MediaProfiles() {}                               // Dummy default constructor
429     ~MediaProfiles();                                // Don't delete me
430 
431     struct VideoEncoderCap {
432         // Ugly constructor
VideoEncoderCapVideoEncoderCap433         VideoEncoderCap(video_encoder codec,
434                         int minBitRate, int maxBitRate,
435                         int minFrameWidth, int maxFrameWidth,
436                         int minFrameHeight, int maxFrameHeight,
437                         int minFrameRate, int maxFrameRate)
438             : mCodec(codec),
439               mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
440               mMinFrameWidth(minFrameWidth), mMaxFrameWidth(maxFrameWidth),
441               mMinFrameHeight(minFrameHeight), mMaxFrameHeight(maxFrameHeight),
442               mMinFrameRate(minFrameRate), mMaxFrameRate(maxFrameRate) {}
443 
~VideoEncoderCapVideoEncoderCap444          ~VideoEncoderCap() {}
445 
446         video_encoder mCodec;
447         int mMinBitRate, mMaxBitRate;
448         int mMinFrameWidth, mMaxFrameWidth;
449         int mMinFrameHeight, mMaxFrameHeight;
450         int mMinFrameRate, mMaxFrameRate;
451     };
452 
453     struct AudioEncoderCap {
454         // Ugly constructor
AudioEncoderCapAudioEncoderCap455         AudioEncoderCap(audio_encoder codec,
456                         int minBitRate, int maxBitRate,
457                         int minSampleRate, int maxSampleRate,
458                         int minChannels, int maxChannels)
459             : mCodec(codec),
460               mMinBitRate(minBitRate), mMaxBitRate(maxBitRate),
461               mMinSampleRate(minSampleRate), mMaxSampleRate(maxSampleRate),
462               mMinChannels(minChannels), mMaxChannels(maxChannels) {}
463 
~AudioEncoderCapAudioEncoderCap464         ~AudioEncoderCap() {}
465 
466         audio_encoder mCodec;
467         int mMinBitRate, mMaxBitRate;
468         int mMinSampleRate, mMaxSampleRate;
469         int mMinChannels, mMaxChannels;
470     };
471 
472     struct VideoDecoderCap {
VideoDecoderCapVideoDecoderCap473         VideoDecoderCap(video_decoder codec): mCodec(codec) {}
~VideoDecoderCapVideoDecoderCap474         ~VideoDecoderCap() {}
475 
476         video_decoder mCodec;
477     };
478 
479     struct AudioDecoderCap {
AudioDecoderCapAudioDecoderCap480         AudioDecoderCap(audio_decoder codec): mCodec(codec) {}
~AudioDecoderCapAudioDecoderCap481         ~AudioDecoderCap() {}
482 
483         audio_decoder mCodec;
484     };
485 
486     struct NameToTagMap {
487         const char* name;
488         int tag;
489     };
490 
491     struct ImageEncodingQualityLevels {
492         int mCameraId;
493         Vector<int> mLevels;
494     };
495 
496     int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
497     void initRequiredProfileRefs(const Vector<int>& cameraIds);
498     int getRequiredProfileRefIndex(int cameraId);
499 
500     // Debug
501     static void logVideoCodec(const VideoCodec& codec);
502     static void logAudioCodec(const AudioCodec& codec);
503     static void logVideoEncoderCap(const VideoEncoderCap& cap);
504     static void logAudioEncoderCap(const AudioEncoderCap& cap);
505     static void logVideoDecoderCap(const VideoDecoderCap& cap);
506     static void logAudioDecoderCap(const AudioDecoderCap& cap);
507 
508     // Returns true if xmlFile exists.
509     // TODO: Add runtime validation.
510     static bool checkXmlFile(const char* xmlFile);
511 
512     // If the xml configuration file does exist, use the settings
513     // from the xml
514     static MediaProfiles* createInstanceFromXmlFile(const char *xml);
515     static output_format createEncoderOutputFileFormat(const char **atts, size_t natts);
516     static void createVideoCodec(const char **atts, size_t natts, MediaProfiles *profiles);
517     static void createAudioCodec(const char **atts, size_t natts, MediaProfiles *profiles);
518     static AudioDecoderCap* createAudioDecoderCap(const char **atts, size_t natts);
519     static VideoDecoderCap* createVideoDecoderCap(const char **atts, size_t natts);
520     static VideoEncoderCap* createVideoEncoderCap(const char **atts, size_t natts);
521     static AudioEncoderCap* createAudioEncoderCap(const char **atts, size_t natts);
522 
523     static CamcorderProfile* createCamcorderProfile(
524                 int cameraId, const char **atts, size_t natts, Vector<int>& cameraIds);
525 
526     static int getCameraId(const char **atts, size_t natts);
527 
528     void addStartTimeOffset(int cameraId, const char **atts, size_t natts);
529 
530     ImageEncodingQualityLevels* findImageEncodingQualityLevels(int cameraId) const;
531     void addImageEncodingQualityLevel(int cameraId, const char** atts, size_t natts);
532 
533     // Customized element tag handler for parsing the xml configuration file.
534     static void startElementHandler(void *userData, const char *name, const char **atts);
535 
536     // If the xml configuration file does not exist, use hard-coded values
537     static MediaProfiles* createDefaultInstance();
538 
539     static CamcorderProfile *createDefaultCamcorderQcifProfile(camcorder_quality quality);
540     static CamcorderProfile *createDefaultCamcorderCifProfile(camcorder_quality quality);
541     static void createDefaultCamcorderLowProfiles(
542             MediaProfiles::CamcorderProfile **lowProfile,
543             MediaProfiles::CamcorderProfile **lowSpecificProfile);
544     static void createDefaultCamcorderHighProfiles(
545             MediaProfiles::CamcorderProfile **highProfile,
546             MediaProfiles::CamcorderProfile **highSpecificProfile);
547 
548     static CamcorderProfile *createDefaultCamcorderTimeLapseQcifProfile(camcorder_quality quality);
549     static CamcorderProfile *createDefaultCamcorderTimeLapse480pProfile(camcorder_quality quality);
550     static void createDefaultCamcorderTimeLapseLowProfiles(
551             MediaProfiles::CamcorderProfile **lowTimeLapseProfile,
552             MediaProfiles::CamcorderProfile **lowSpecificTimeLapseProfile);
553     static void createDefaultCamcorderTimeLapseHighProfiles(
554             MediaProfiles::CamcorderProfile **highTimeLapseProfile,
555             MediaProfiles::CamcorderProfile **highSpecificTimeLapseProfile);
556 
557     static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
558     static void createDefaultVideoEncoders(MediaProfiles *profiles);
559     static void createDefaultAudioEncoders(MediaProfiles *profiles);
560     static void createDefaultVideoDecoders(MediaProfiles *profiles);
561     static void createDefaultAudioDecoders(MediaProfiles *profiles);
562     static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles);
563     static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles);
564     static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles);
565 
566     static VideoEncoderCap* createDefaultH263VideoEncoderCap();
567     static VideoEncoderCap* createDefaultM4vVideoEncoderCap();
568     static AudioEncoderCap* createDefaultAmrNBEncoderCap();
569 
570     static int findTagForName(const NameToTagMap *map, size_t nMappings, const char *name);
571 
572     /**
573      * Finds the string representation for an integer enum tag.
574      *
575      * This is the reverse for findTagForName
576      *
577      * @param map       the name-to-tag map to search
578      * @param nMappings the number of mappings in |map|
579      * @param tag       the enum value to find
580      * @param def_      the return value if the enum is not found
581      *
582      * @return the string name corresponding to |tag| or |def_| if not found.
583      */
584     static const char *findNameForTag(
585             const NameToTagMap *map, size_t nMappings,
586             int tag, const char *def_ = "(unknown)");
587 
588     /**
589      * Updates the chroma subsampling, bit-depth and hdr-format for
590      * advanced codec profiles.
591      *
592      * @param codec    the video codec type
593      * @param profile  the MediaCodec profile
594      * @param chroma   pointer to the chroma subsampling output
595      * @param bitDepth pointer to the bit depth output
596      * @param hdr      pointer to the hdr format output
597      *
598      * @return true, if the profile fully determined chroma, bit-depth and hdr-format, false
599      *         otherwise.
600      */
601     static bool detectAdvancedVideoProfile(
602             video_encoder codec, int profile,
603             chroma_subsampling *chroma, int *bitDepth, hdr_format *hdr);
604 
605     /**
606      * Check on existing profiles with the following criteria:
607      * 1. Low quality profile must have the lowest video
608      *    resolution product (width x height)
609      * 2. High quality profile must have the highest video
610      *    resolution product (width x height)
611      *
612      * and add required low/high quality camcorder/timelapse
613      * profiles if they are not found. This allows to remove
614      * duplicate profile definitions in the media_profiles.xml
615      * file.
616      */
617     void checkAndAddRequiredProfilesIfNecessary();
618 
619 
620     // Mappings from name (for instance, codec name) to enum value
621     static const NameToTagMap sVideoEncoderNameMap[];
622     static const NameToTagMap sChromaSubsamplingNameMap[];
623     static const NameToTagMap sHdrFormatNameMap[];
624     static const NameToTagMap sAudioEncoderNameMap[];
625     static const NameToTagMap sFileFormatMap[];
626     static const NameToTagMap sVideoDecoderNameMap[];
627     static const NameToTagMap sAudioDecoderNameMap[];
628     static const NameToTagMap sCamcorderQualityNameMap[];
629 
630     static bool sIsInitialized;
631     static MediaProfiles *sInstance;
632     static Mutex sLock;
633     int mCurrentCameraId;
634 
635     Vector<CamcorderProfile*> mCamcorderProfiles;
636     Vector<AudioEncoderCap*>  mAudioEncoders;
637     Vector<VideoEncoderCap*>  mVideoEncoders;
638     Vector<AudioDecoderCap*>  mAudioDecoders;
639     Vector<VideoDecoderCap*>  mVideoDecoders;
640     Vector<output_format>     mEncoderOutputFileFormats;
641     Vector<ImageEncodingQualityLevels *>  mImageEncodingQualityLevels;
642     KeyedVector<int, int> mStartTimeOffsets;
643 
644     typedef struct {
645         bool mHasRefProfile;      // Refers to an existing profile
646         int  mRefProfileIndex;    // Reference profile index
647         int  mResolutionProduct;  // width x height
648     } RequiredProfileRefInfo;     // Required low and high profiles
649 
650     typedef struct {
651         RequiredProfileRefInfo mRefs[kNumRequiredProfiles];
652         int mCameraId;
653     } RequiredProfiles;
654 
655     RequiredProfiles *mRequiredProfileRefs;
656     Vector<int>              mCameraIds;
657 };
658 
659 }; // namespace android
660 
661 #endif // ANDROID_MEDIAPROFILES_H
662