Loading include/media/MediaProfiles.h +45 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ enum camcorder_quality { CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1006, }; /** *Set CIF as default maximum import and export resolution of video editor. *The maximum import and export resolutions are platform specific, *which should be defined in media_profiles.xml. */ enum videoeditor_capability { VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, }; enum video_decoder { VIDEO_DECODER_WMV, }; Loading Loading @@ -116,6 +128,17 @@ public: */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; /** * Returns the value for the given param name for the video editor cap * param or -1 if error. * Supported param name are: * videoeditor.input.width.max - max input video frame width * videoeditor.input.height.max - max input video frame height * videoeditor.output.width.max - max output video frame width * videoeditor.output.height.max - max output video frame height */ int getVideoEditorCapParamByName(const char *name) const; /** * Returns the audio encoders supported. */ Loading Loading @@ -164,7 +187,7 @@ private: MediaProfiles& operator=(const MediaProfiles&); // Don't call me MediaProfiles(const MediaProfiles&); // Don't call me MediaProfiles() {} // Dummy default constructor MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor ~MediaProfiles(); // Don't delete me struct VideoCodec { Loading Loading @@ -310,6 +333,22 @@ private: Vector<int> mLevels; }; struct VideoEditorCap { VideoEditorCap(int inFrameWidth, int inFrameHeight, int outFrameWidth, int outFrameHeight) : mMaxInputFrameWidth(inFrameWidth), mMaxInputFrameHeight(inFrameHeight), mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameHeight(outFrameHeight) {} ~VideoEditorCap() {} int mMaxInputFrameWidth; int mMaxInputFrameHeight; int mMaxOutputFrameWidth; int mMaxOutputFrameHeight; }; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; void initRequiredProfileRefs(const Vector<int>& cameraIds); int getRequiredProfileRefIndex(int cameraId); Loading @@ -321,6 +360,7 @@ private: static void logAudioEncoderCap(const AudioEncoderCap& cap); static void logVideoDecoderCap(const VideoDecoderCap& cap); static void logAudioDecoderCap(const AudioDecoderCap& cap); static void logVideoEditorCap(const VideoEditorCap& cap); // If the xml configuration file does exist, use the settings // from the xml Loading @@ -332,6 +372,8 @@ private: static VideoDecoderCap* createVideoDecoderCap(const char **atts); static VideoEncoderCap* createVideoEncoderCap(const char **atts); static AudioEncoderCap* createAudioEncoderCap(const char **atts); static VideoEditorCap* createVideoEditorCap( const char **atts, MediaProfiles *profiles); static CamcorderProfile* createCamcorderProfile( int cameraId, const char **atts, Vector<int>& cameraIds); Loading Loading @@ -375,6 +417,7 @@ private: static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles); static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles); static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); static void createDefaultVideoEditorCap(MediaProfiles *profiles); static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); Loading Loading @@ -431,6 +474,7 @@ private: RequiredProfiles *mRequiredProfileRefs; Vector<int> mCameraIds; VideoEditorCap* mVideoEditorCap; }; }; // namespace android Loading media/libmedia/MediaProfiles.cpp +64 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,16 @@ MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap) LOGV("codec = %d", cap.mCodec); } /*static*/ void MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap) { LOGV("videoeditor cap:"); LOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth); LOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight); LOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth); LOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight); } /*static*/ int MediaProfiles::findTagForName(const MediaProfiles::NameToTagMap *map, size_t nMappings, const char *name) { Loading Loading @@ -368,6 +378,24 @@ void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts) mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs); } /*static*/ MediaProfiles::VideoEditorCap* MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("maxInputFrameWidth", atts[0]) && !strcmp("maxInputFrameHeight", atts[2]) && !strcmp("maxOutputFrameWidth", atts[4]) && !strcmp("maxOutputFrameHeight", atts[6])); MediaProfiles::VideoEditorCap *pVideoEditorCap = new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]), atoi(atts[5]), atoi(atts[7])); logVideoEditorCap(*pVideoEditorCap); profiles->mVideoEditorCap = pVideoEditorCap; return pVideoEditorCap; } /*static*/ void MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts) { Loading Loading @@ -398,6 +426,8 @@ MediaProfiles::startElementHandler(void *userData, const char *name, const char createCamcorderProfile(profiles->mCurrentCameraId, atts, profiles->mCameraIds)); } else if (strcmp("ImageEncoding", name) == 0) { profiles->addImageEncodingQualityLevel(profiles->mCurrentCameraId, atts); } else if (strcmp("VideoEditorCap", name) == 0) { createVideoEditorCap(atts, profiles); } } Loading Loading @@ -790,6 +820,17 @@ MediaProfiles::createDefaultImageEncodingQualityLevels(MediaProfiles *profiles) profiles->mImageEncodingQualityLevels.add(levels); } /*static*/ void MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles) { profiles->mVideoEditorCap = new MediaProfiles::VideoEditorCap( VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT); } /*static*/ MediaProfiles* MediaProfiles::createDefaultInstance() { Loading @@ -801,6 +842,7 @@ MediaProfiles::createDefaultInstance() createDefaultAudioDecoders(profiles); createDefaultEncoderOutputFileFormats(profiles); createDefaultImageEncodingQualityLevels(profiles); createDefaultVideoEditorCap(profiles); return profiles; } Loading Loading @@ -899,6 +941,28 @@ int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder co return -1; } int MediaProfiles::getVideoEditorCapParamByName(const char *name) const { LOGV("getVideoEditorCapParamByName: %s", name); if (mVideoEditorCap == NULL) { LOGE("The mVideoEditorCap is not created, then create default cap."); createDefaultVideoEditorCap(sInstance); } if (!strcmp("videoeditor.input.width.max", name)) return mVideoEditorCap->mMaxInputFrameWidth; if (!strcmp("videoeditor.input.height.max", name)) return mVideoEditorCap->mMaxInputFrameHeight; if (!strcmp("videoeditor.output.width.max", name)) return mVideoEditorCap->mMaxOutputFrameWidth; if (!strcmp("videoeditor.output.height.max", name)) return mVideoEditorCap->mMaxOutputFrameHeight; LOGE("The given video editor param name %s is not found", name); return -1; } Vector<audio_encoder> MediaProfiles::getAudioEncoders() const { Vector<audio_encoder> encoders; Loading Loading
include/media/MediaProfiles.h +45 −1 Original line number Diff line number Diff line Loading @@ -45,6 +45,18 @@ enum camcorder_quality { CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1006, }; /** *Set CIF as default maximum import and export resolution of video editor. *The maximum import and export resolutions are platform specific, *which should be defined in media_profiles.xml. */ enum videoeditor_capability { VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT = 288, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH = 352, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT = 288, }; enum video_decoder { VIDEO_DECODER_WMV, }; Loading Loading @@ -116,6 +128,17 @@ public: */ int getVideoEncoderParamByName(const char *name, video_encoder codec) const; /** * Returns the value for the given param name for the video editor cap * param or -1 if error. * Supported param name are: * videoeditor.input.width.max - max input video frame width * videoeditor.input.height.max - max input video frame height * videoeditor.output.width.max - max output video frame width * videoeditor.output.height.max - max output video frame height */ int getVideoEditorCapParamByName(const char *name) const; /** * Returns the audio encoders supported. */ Loading Loading @@ -164,7 +187,7 @@ private: MediaProfiles& operator=(const MediaProfiles&); // Don't call me MediaProfiles(const MediaProfiles&); // Don't call me MediaProfiles() {} // Dummy default constructor MediaProfiles() { mVideoEditorCap = NULL; } // Dummy default constructor ~MediaProfiles(); // Don't delete me struct VideoCodec { Loading Loading @@ -310,6 +333,22 @@ private: Vector<int> mLevels; }; struct VideoEditorCap { VideoEditorCap(int inFrameWidth, int inFrameHeight, int outFrameWidth, int outFrameHeight) : mMaxInputFrameWidth(inFrameWidth), mMaxInputFrameHeight(inFrameHeight), mMaxOutputFrameWidth(outFrameWidth), mMaxOutputFrameHeight(outFrameHeight) {} ~VideoEditorCap() {} int mMaxInputFrameWidth; int mMaxInputFrameHeight; int mMaxOutputFrameWidth; int mMaxOutputFrameHeight; }; int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const; void initRequiredProfileRefs(const Vector<int>& cameraIds); int getRequiredProfileRefIndex(int cameraId); Loading @@ -321,6 +360,7 @@ private: static void logAudioEncoderCap(const AudioEncoderCap& cap); static void logVideoDecoderCap(const VideoDecoderCap& cap); static void logAudioDecoderCap(const AudioDecoderCap& cap); static void logVideoEditorCap(const VideoEditorCap& cap); // If the xml configuration file does exist, use the settings // from the xml Loading @@ -332,6 +372,8 @@ private: static VideoDecoderCap* createVideoDecoderCap(const char **atts); static VideoEncoderCap* createVideoEncoderCap(const char **atts); static AudioEncoderCap* createAudioEncoderCap(const char **atts); static VideoEditorCap* createVideoEditorCap( const char **atts, MediaProfiles *profiles); static CamcorderProfile* createCamcorderProfile( int cameraId, const char **atts, Vector<int>& cameraIds); Loading Loading @@ -375,6 +417,7 @@ private: static void createDefaultEncoderOutputFileFormats(MediaProfiles *profiles); static void createDefaultImageEncodingQualityLevels(MediaProfiles *profiles); static void createDefaultImageDecodingMaxMemory(MediaProfiles *profiles); static void createDefaultVideoEditorCap(MediaProfiles *profiles); static VideoEncoderCap* createDefaultH263VideoEncoderCap(); static VideoEncoderCap* createDefaultM4vVideoEncoderCap(); static AudioEncoderCap* createDefaultAmrNBEncoderCap(); Loading Loading @@ -431,6 +474,7 @@ private: RequiredProfiles *mRequiredProfileRefs; Vector<int> mCameraIds; VideoEditorCap* mVideoEditorCap; }; }; // namespace android Loading
media/libmedia/MediaProfiles.cpp +64 −0 Original line number Diff line number Diff line Loading @@ -132,6 +132,16 @@ MediaProfiles::logAudioDecoderCap(const MediaProfiles::AudioDecoderCap& cap) LOGV("codec = %d", cap.mCodec); } /*static*/ void MediaProfiles::logVideoEditorCap(const MediaProfiles::VideoEditorCap& cap) { LOGV("videoeditor cap:"); LOGV("mMaxInputFrameWidth = %d", cap.mMaxInputFrameWidth); LOGV("mMaxInputFrameHeight = %d", cap.mMaxInputFrameHeight); LOGV("mMaxOutputFrameWidth = %d", cap.mMaxOutputFrameWidth); LOGV("mMaxOutputFrameHeight = %d", cap.mMaxOutputFrameHeight); } /*static*/ int MediaProfiles::findTagForName(const MediaProfiles::NameToTagMap *map, size_t nMappings, const char *name) { Loading Loading @@ -368,6 +378,24 @@ void MediaProfiles::addStartTimeOffset(int cameraId, const char** atts) mStartTimeOffsets.replaceValueFor(cameraId, offsetTimeMs); } /*static*/ MediaProfiles::VideoEditorCap* MediaProfiles::createVideoEditorCap(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("maxInputFrameWidth", atts[0]) && !strcmp("maxInputFrameHeight", atts[2]) && !strcmp("maxOutputFrameWidth", atts[4]) && !strcmp("maxOutputFrameHeight", atts[6])); MediaProfiles::VideoEditorCap *pVideoEditorCap = new MediaProfiles::VideoEditorCap(atoi(atts[1]), atoi(atts[3]), atoi(atts[5]), atoi(atts[7])); logVideoEditorCap(*pVideoEditorCap); profiles->mVideoEditorCap = pVideoEditorCap; return pVideoEditorCap; } /*static*/ void MediaProfiles::startElementHandler(void *userData, const char *name, const char **atts) { Loading Loading @@ -398,6 +426,8 @@ MediaProfiles::startElementHandler(void *userData, const char *name, const char createCamcorderProfile(profiles->mCurrentCameraId, atts, profiles->mCameraIds)); } else if (strcmp("ImageEncoding", name) == 0) { profiles->addImageEncodingQualityLevel(profiles->mCurrentCameraId, atts); } else if (strcmp("VideoEditorCap", name) == 0) { createVideoEditorCap(atts, profiles); } } Loading Loading @@ -790,6 +820,17 @@ MediaProfiles::createDefaultImageEncodingQualityLevels(MediaProfiles *profiles) profiles->mImageEncodingQualityLevels.add(levels); } /*static*/ void MediaProfiles::createDefaultVideoEditorCap(MediaProfiles *profiles) { profiles->mVideoEditorCap = new MediaProfiles::VideoEditorCap( VIDEOEDITOR_DEFAULT_MAX_INPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_INPUT_FRAME_HEIGHT, VIDEOEDITOR_DEFAULT_MAX_OUTPUT_FRAME_WIDTH, VIDEOEDITOR_DEFUALT_MAX_OUTPUT_FRAME_HEIGHT); } /*static*/ MediaProfiles* MediaProfiles::createDefaultInstance() { Loading @@ -801,6 +842,7 @@ MediaProfiles::createDefaultInstance() createDefaultAudioDecoders(profiles); createDefaultEncoderOutputFileFormats(profiles); createDefaultImageEncodingQualityLevels(profiles); createDefaultVideoEditorCap(profiles); return profiles; } Loading Loading @@ -899,6 +941,28 @@ int MediaProfiles::getVideoEncoderParamByName(const char *name, video_encoder co return -1; } int MediaProfiles::getVideoEditorCapParamByName(const char *name) const { LOGV("getVideoEditorCapParamByName: %s", name); if (mVideoEditorCap == NULL) { LOGE("The mVideoEditorCap is not created, then create default cap."); createDefaultVideoEditorCap(sInstance); } if (!strcmp("videoeditor.input.width.max", name)) return mVideoEditorCap->mMaxInputFrameWidth; if (!strcmp("videoeditor.input.height.max", name)) return mVideoEditorCap->mMaxInputFrameHeight; if (!strcmp("videoeditor.output.width.max", name)) return mVideoEditorCap->mMaxOutputFrameWidth; if (!strcmp("videoeditor.output.height.max", name)) return mVideoEditorCap->mMaxOutputFrameHeight; LOGE("The given video editor param name %s is not found", name); return -1; } Vector<audio_encoder> MediaProfiles::getAudioEncoders() const { Vector<audio_encoder> encoders; Loading