int mc_configure(MMHandleType mediacodec, media_format_h format, int flags)
{
- int ret = MC_ERROR_NONE;
+ int ret = MEDIA_FORMAT_ERROR_NONE;
mc_handle_t *mc_handle = (mc_handle_t *) mediacodec;
int i;
const int codec_mask = 0xFFF0;
}
if (type == MEDIA_FORMAT_AUDIO) {
- media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &bitrate);
+ ret = media_format_get_audio_info(format, &mimetype, &channel, &samplerate, &bit, &bitrate);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("get audio info failed[0x%x]", ret);
+ return MC_INVALID_ARG;
+ }
codec_id = mimetype & codec_mask;
return MC_PARAM_ERROR;
}
} else if (type == MEDIA_FORMAT_VIDEO) {
- media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL);
- media_format_get_video_frame_rate(format, &fps);
+ ret = media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL);
+ ret |= media_format_get_video_frame_rate(format, &fps);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("get video info/frame_rate failed[0x%x]", ret);
+ return MC_INVALID_ARG;
+ }
+
codec_id = mimetype & codec_mask;
if (GET_IS_ENCODER(flags)) {
LOGD("encoder : %d, hardware : %d, codec_id : %x, video : %d",
mc_handle->is_encoder, mc_handle->is_hw, mc_handle->codec_id, mc_handle->is_video);
- return ret;
+ return MC_ERROR_NONE;
}
int mc_prepare(MMHandleType mediacodec)
gboolean _mc_update_packet_info(mc_gst_core_t *core, media_format_h format)
{
+ int ret = MEDIA_FORMAT_ERROR_NONE;
gint bitrate = 0;
gboolean is_format_change = FALSE;
gchar *sformat = NULL;
media_format_mimetype_e mimetype = 0;
- media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL);
- media_format_get_video_frame_rate(format, &framerate);
+ ret = media_format_get_video_info(format, &mimetype, &width, &height, &bitrate, NULL);
+ ret |= media_format_get_video_frame_rate(format, &framerate);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("get video info/frame_rate failed[0x%x]", ret);
+ return FALSE;
+ }
is_format_change |= input_port_def->info.video.width != width;
is_format_change |= input_port_def->info.video.height != height;
gint samplerate;
gint bit;
- media_format_get_audio_info(format, NULL, &channel, &samplerate, &bit, &bitrate);
+ ret = media_format_get_audio_info(format, NULL, &channel, &samplerate, &bit, &bitrate);
+ if (ret != MEDIA_FORMAT_ERROR_NONE) {
+ LOGE("get audio info failed[0x%x]", ret);
+ return FALSE;
+ }
is_format_change |= input_port_def->info.audio.channel != channel;
is_format_change |= input_port_def->info.audio.samplerate != samplerate;