+int _mmcamcorder_check_codec_fileformat_compatibility(const char *codec_type, int codec, int file_format)
+{
+ mmf_return_val_if_fail(codec_type, MM_ERROR_CAMCORDER_INVALID_ARGUMENT);
+
+ /* Check compatibility between codec and file format */
+ if (!strcmp(codec_type, MMCAM_AUDIO_ENCODER)) {
+ if (codec > MM_AUDIO_CODEC_INVALID && codec < MM_AUDIO_CODEC_NUM &&
+ file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+ if (audiocodec_fileformat_compatibility_table[codec][file_format] == 0) {
+ _mmcam_dbg_err("Audio codec[%d] and file format[%d] compatibility FAILED.", codec, file_format);
+ return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+ }
+
+ _mmcam_dbg_log("Audio codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format);
+ } else {
+ _mmcam_dbg_err("Audio codec[%d] or file format[%d] is INVALID.", codec, file_format);
+ return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+ }
+ } else if (!strcmp(codec_type, MMCAM_VIDEO_ENCODER)) {
+ if (codec > MM_VIDEO_CODEC_INVALID && codec < MM_VIDEO_CODEC_NUM &&
+ file_format > MM_FILE_FORMAT_INVALID && file_format < MM_FILE_FORMAT_NUM) {
+ if (videocodec_fileformat_compatibility_table[ codec][file_format] == 0) {
+ _mmcam_dbg_err("Video codec[%d] and file format[%d] compatibility FAILED.", codec, file_format);
+ return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+ }
+
+ _mmcam_dbg_log("Video codec[%d] and file format[%d] compatibility SUCCESS.", codec, file_format);
+ } else {
+ _mmcam_dbg_err("Video codec[%d] or file format[%d] is INVALID.", codec, file_format);
+ return MM_ERROR_CAMCORDER_ENCODER_WRONG_TYPE;
+ }
+ }
+
+ return MM_ERROR_NONE;
+}
+
+