/*static*/ MediaProfiles::CamcorderProfile* MediaProfiles::createCamcorderProfile(int cameraId, const char **atts, Vector<int>& cameraIds) { CHECK(!strcmp("quality", atts[0]) && !strcmp("fileFormat", atts[2]) && !strcmp("duration", atts[4])); const size_t nProfileMappings = sizeof(sCamcorderQualityNameMap)/ sizeof(sCamcorderQualityNameMap[0]); const int quality = findTagForName(sCamcorderQualityNameMap, nProfileMappings, atts[1]); CHECK(quality != -1); const size_t nFormatMappings = sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]); const int fileFormat = findTagForName(sFileFormatMap, nFormatMappings, atts[3]); CHECK(fileFormat != -1); MediaProfiles::CamcorderProfile *profile = new MediaProfiles::CamcorderProfile; profile->mCameraId = cameraId; if (!isCameraIdFound(cameraId, cameraIds)) { cameraIds.add(cameraId); } profile->mFileFormat = static_cast<output_format>(fileFormat); profile->mQuality = static_cast<camcorder_quality>(quality); profile->mDuration = atoi(atts[5]); return profile; }
/*static*/ MediaProfiles::VideoEncoderCap* MediaProfiles::createVideoEncoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2]) && !strcmp("minBitRate", atts[4]) && !strcmp("maxBitRate", atts[6]) && !strcmp("minFrameWidth", atts[8]) && !strcmp("maxFrameWidth", atts[10]) && !strcmp("minFrameHeight", atts[12]) && !strcmp("maxFrameHeight", atts[14]) && !strcmp("minFrameRate", atts[16]) && !strcmp("maxFrameRate", atts[18])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoEncoderCap *cap = new MediaProfiles::VideoEncoderCap(static_cast<video_encoder>(codec), atoi(atts[5]), atoi(atts[7]), atoi(atts[9]), atoi(atts[11]), atoi(atts[13]), atoi(atts[15]), atoi(atts[17]), atoi(atts[19])); logVideoEncoderCap(*cap); return cap; }
/*static*/ output_format MediaProfiles::createEncoderOutputFileFormat(const char **atts) { CHECK(!strcmp("name", atts[0])); const size_t nMappings =sizeof(sFileFormatMap)/sizeof(sFileFormatMap[0]); const int format = findTagForName(sFileFormatMap, nMappings, atts[1]); CHECK(format != -1); return static_cast<output_format>(format); }
/*static*/ MediaProfiles::VideoDecoderCap* MediaProfiles::createVideoDecoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2])); const size_t nMappings = sizeof(sVideoDecoderNameMap)/sizeof(sVideoDecoderNameMap[0]); const int codec = findTagForName(sVideoDecoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoDecoderCap *cap = new MediaProfiles::VideoDecoderCap(static_cast<video_decoder>(codec)); logVideoDecoderCap(*cap); return cap; }
/*static*/ MediaProfiles::ExportVideoProfile* MediaProfiles::createExportVideoProfile(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("profile", atts[2]) && !strcmp("level", atts[4])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::ExportVideoProfile *profile = new MediaProfiles::ExportVideoProfile( codec, atoi(atts[3]), atoi(atts[5])); return profile; }
/*static*/ MediaProfiles::AudioCodec* MediaProfiles::createAudioCodec(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("codec", atts[0]) && !strcmp("bitRate", atts[2]) && !strcmp("sampleRate", atts[4]) && !strcmp("channels", atts[6])); const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]); const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::AudioCodec *audioCodec = new MediaProfiles::AudioCodec(static_cast<audio_encoder>(codec), atoi(atts[3]), atoi(atts[5]), atoi(atts[7])); logAudioCodec(*audioCodec); size_t nCamcorderProfiles; CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1); profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mAudioCodec = audioCodec; return audioCodec; }
/*static*/ MediaProfiles::AudioEncoderCap* MediaProfiles::createAudioEncoderCap(const char **atts) { CHECK(!strcmp("name", atts[0]) && !strcmp("enabled", atts[2]) && !strcmp("minBitRate", atts[4]) && !strcmp("maxBitRate", atts[6]) && !strcmp("minSampleRate", atts[8]) && !strcmp("maxSampleRate", atts[10]) && !strcmp("minChannels", atts[12]) && !strcmp("maxChannels", atts[14])); const size_t nMappings = sizeof(sAudioEncoderNameMap)/sizeof(sAudioEncoderNameMap[0]); const int codec = findTagForName(sAudioEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::AudioEncoderCap *cap = new MediaProfiles::AudioEncoderCap(static_cast<audio_encoder>(codec), atoi(atts[5]), atoi(atts[7]), atoi(atts[9]), atoi(atts[11]), atoi(atts[13]), atoi(atts[15])); logAudioEncoderCap(*cap); return cap; }
/*static*/ MediaProfiles::VideoCodec* MediaProfiles::createVideoCodec(const char **atts, MediaProfiles *profiles) { CHECK(!strcmp("codec", atts[0]) && !strcmp("bitRate", atts[2]) && !strcmp("width", atts[4]) && !strcmp("height", atts[6]) && !strcmp("frameRate", atts[8])); const size_t nMappings = sizeof(sVideoEncoderNameMap)/sizeof(sVideoEncoderNameMap[0]); const int codec = findTagForName(sVideoEncoderNameMap, nMappings, atts[1]); CHECK(codec != -1); MediaProfiles::VideoCodec *videoCodec = new MediaProfiles::VideoCodec(static_cast<video_encoder>(codec), atoi(atts[3]), atoi(atts[5]), atoi(atts[7]), atoi(atts[9])); logVideoCodec(*videoCodec); size_t nCamcorderProfiles; CHECK((nCamcorderProfiles = profiles->mCamcorderProfiles.size()) >= 1); profiles->mCamcorderProfiles[nCamcorderProfiles - 1]->mVideoCodec = videoCodec; return videoCodec; }