static u32 ddl_channel_set_callback(struct ddl_context *ddl_context) { struct ddl_client_context *ddl = ddl_context->current_ddl; u32 return_status = false; ddl_move_command_state(ddl_context, DDL_CMD_INVALID); VIDC_DEBUG_REGISTER_LOG; if (!ddl || !DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_WAIT_FOR_CHDONE) ) { VIDC_LOG_STRING("STATE-CRITICAL-CHSET"); DDL_IDLE(ddl_context); return return_status; } VIDC_LOG_STRING("Channel-set"); ddl_move_client_state(ddl, DDL_CLIENT_WAIT_FOR_INITCODEC); if (ddl->decoding) { if (ddl->codec_data.decoder.header_in_start) { ddl_decode_init_codec(ddl); } else { ddl_context->ddl_callback(VCD_EVT_RESP_START, VCD_S_SUCCESS, NULL, 0, (u32 *) ddl, ddl_context->client_data); DDL_IDLE(ddl_context); return_status = true; } } else { ddl_encode_init_codec(ddl); } return return_status; }
static u32 ddl_eos_done_callback(struct ddl_context *ddl_context) { struct ddl_client_context *ddl = ddl_context->current_ddl; u32 displaystatus, resl_change; if (!DDLCOMMAND_STATE_IS(ddl_context, DDL_CMD_EOS)) { VIDC_LOGERR_STRING("UNKWN_EOSDONE"); ddl_client_fatal_cb(ddl_context); return true; } if (!ddl || !ddl->decoding || !DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_WAIT_FOR_EOS_DONE) ) { VIDC_LOG_STRING("STATE-CRITICAL-EOSDONE"); ddl_client_fatal_cb(ddl_context); return true; } ddl_move_command_state(ddl_context, DDL_CMD_INVALID); vidc_720p_eos_info(&displaystatus, &resl_change); if ((enum vidc_720p_display_status)displaystatus != VIDC_720P_EMPTY_BUFFER) { VIDC_LOG_STRING("EOSDONE-EMPTYBUF-ISSUE"); } ddl_decode_dynamic_property(ddl, false); if (resl_change == 0x1) { ddl->codec_data.decoder.header_in_start = false; ddl->codec_data.decoder.decode_config.sequence_header = ddl->input_frame.vcd_frm.physical; ddl->codec_data.decoder.decode_config.sequence_header_len = ddl->input_frame.vcd_frm.data_len; ddl_decode_init_codec(ddl); return false; } ddl_move_client_state(ddl, DDL_CLIENT_WAIT_FOR_FRAME); VIDC_LOG_STRING("EOS_DONE"); ddl_context->ddl_callback(VCD_EVT_RESP_EOS_DONE, VCD_S_SUCCESS, NULL, 0, (u32 *) ddl, ddl_context->client_data); DDL_IDLE(ddl_context); return true; }
u32 ddl_decode_frame(u32 *ddl_handle, struct ddl_frame_data_tag *input_bits, void *client_data) { u32 vcd_status = VCD_S_SUCCESS; struct ddl_client_context *ddl = (struct ddl_client_context *)ddl_handle; struct ddl_context *ddl_context = ddl_get_context(); if (!DDL_IS_INITIALIZED(ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_frame:Not_inited"); return VCD_ERR_ILLEGAL_OP; } if (DDL_IS_BUSY(ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_frame:Ddl_busy"); return VCD_ERR_BUSY; } if (!ddl || !ddl->decoding) { VIDC_LOGERR_STRING("ddl_dec_frame:Bad_handle"); return VCD_ERR_BAD_HANDLE; } if (!input_bits || ((!input_bits->vcd_frm.physical || !input_bits->vcd_frm.data_len) && (!(VCD_FRAME_FLAG_EOS & input_bits->vcd_frm.flags)) ) ) { VIDC_LOGERR_STRING("ddl_dec_frame:Bad_input_param"); return VCD_ERR_ILLEGAL_PARM; } DDL_BUSY(ddl_context); ddl_context->current_ddl = ddl; ddl_context->client_data = client_data; ddl->input_frame = *input_bits; if (DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_WAIT_FOR_FRAME)) { ddl_decode_frame_run(ddl); } else { if (!ddl->codec_data.decoder.dp_buf.no_of_dec_pic_buf) { VIDC_LOGERR_STRING("ddl_dec_frame:Dpbs_requied"); vcd_status = VCD_ERR_ILLEGAL_OP; } else if (DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_WAIT_FOR_DPB)) { vcd_status = ddl_decode_set_buffers(ddl); } else if (DDLCLIENT_STATE_IS (ddl, DDL_CLIENT_WAIT_FOR_INITCODEC)) { ddl->codec_data.decoder.decode_config. sequence_header = ddl->input_frame.vcd_frm.physical; ddl->codec_data.decoder.decode_config. sequence_header_len = ddl->input_frame.vcd_frm.data_len; ddl_decode_init_codec(ddl); } else { VIDC_LOGERR_STRING("Dec_frame:Wrong_state"); vcd_status = VCD_ERR_ILLEGAL_OP; } if (vcd_status) DDL_IDLE(ddl_context); } return vcd_status; }
u32 ddl_decode_frame(u32 *ddl_handle, struct ddl_frame_data_type_tag *p_input_bits, void *p_client_data) { u32 vcd_status = VCD_S_SUCCESS; struct ddl_client_context_type *p_ddl = (struct ddl_client_context_type *)ddl_handle; struct ddl_context_type *p_ddl_context = ddl_get_context(); #ifdef CORE_TIMING_INFO ddl_get_core_start_time(0); #endif if (!DDL_IS_INITIALIZED(p_ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_frame:Not_inited"); return VCD_ERR_ILLEGAL_OP; } if (DDL_IS_BUSY(p_ddl_context)) { VIDC_LOGERR_STRING("ddl_dec_frame:Ddl_busy"); return VCD_ERR_BUSY; } if (NULL == p_ddl || FALSE == p_ddl->b_decoding) { VIDC_LOGERR_STRING("ddl_dec_frame:Bad_handle"); return VCD_ERR_BAD_HANDLE; } if (NULL == p_input_bits || ((0 == p_input_bits->vcd_frm.p_physical || 0 == p_input_bits->vcd_frm.n_data_len) && (0 == (VCD_FRAME_FLAG_EOS & p_input_bits->vcd_frm.n_flags)) ) ) { VIDC_LOGERR_STRING("ddl_dec_frame:Bad_input_param"); return VCD_ERR_ILLEGAL_PARM; } DDL_BUSY(p_ddl_context); p_ddl_context->p_current_ddl = p_ddl; p_ddl_context->p_client_data = p_client_data; p_ddl->input_frame = *p_input_bits; if (DDLCLIENT_STATE_IS(p_ddl, DDL_CLIENT_WAIT_FOR_FRAME)) { ddl_decode_frame_run(p_ddl); } else { if (0 == p_ddl->codec_data.decoder.dp_buf.n_no_of_dec_pic_buf) { VIDC_LOGERR_STRING("ddl_dec_frame:Dpbs_requied"); vcd_status = VCD_ERR_ILLEGAL_OP; } else if (DDLCLIENT_STATE_IS(p_ddl, DDL_CLIENT_WAIT_FOR_DPB)) { vcd_status = ddl_decode_set_buffers(p_ddl); } else if (DDLCLIENT_STATE_IS (p_ddl, DDL_CLIENT_WAIT_FOR_INITCODEC)) { p_ddl->codec_data.decoder.decode_config. p_sequence_header = p_ddl->input_frame.vcd_frm.p_physical; p_ddl->codec_data.decoder.decode_config. n_sequence_header_len = p_ddl->input_frame.vcd_frm.n_data_len; ddl_decode_init_codec(p_ddl); } else { VIDC_LOGERR_STRING("Dec_frame:Wrong_state"); vcd_status = VCD_ERR_ILLEGAL_OP; } if (VCD_S_SUCCESS != vcd_status) DDL_IDLE(p_ddl_context); } return vcd_status; }