static void ddl_encoder_frame_run_callback(struct ddl_context
					   *ddl_context)
{
	struct ddl_client_context *ddl = ddl_context->current_ddl;
	struct ddl_encoder_data *encoder = &(ddl->codec_data.encoder);
	u32 eos_present = false;

	if (!DDLCLIENT_STATE_IS(ddl, DDL_CLIENT_WAIT_FOR_FRAME_DONE)
		) {
		VIDC_LOG_STRING("STATE-CRITICAL-ENCFRMRUN");
		ddl_client_fatal_cb(ddl_context);
		return;
	}

	VIDC_LOG_STRING("ENC_FRM_RUN_DONE");

	ddl_move_command_state(ddl_context, DDL_CMD_INVALID);
	vidc_720p_enc_frame_info(&encoder->enc_frame_info);

	ddl->output_frame.vcd_frm.ip_frm_tag =
		ddl->input_frame.vcd_frm.ip_frm_tag;
	ddl->output_frame.vcd_frm.data_len =
		encoder->enc_frame_info.enc_size;
	ddl->output_frame.vcd_frm.flags |= VCD_FRAME_FLAG_ENDOFFRAME;
	ddl_get_frame
		(&(ddl->output_frame.vcd_frm),
		 encoder->enc_frame_info.frame);
	ddl_process_encoder_metadata(ddl);

	ddl_encode_dynamic_property(ddl, false);

	ddl->input_frame.frm_trans_end = false;
	ddl_context->ddl_callback(VCD_EVT_RESP_INPUT_DONE, VCD_S_SUCCESS,
		&(ddl->input_frame), sizeof(struct ddl_frame_data_tag),
		(u32 *) ddl, ddl_context->client_data);

	if (vidc_msg_timing)
		ddl_calc_core_proc_time(__func__, ENC_OP_TIME);

	/* check the presence of EOS */
   eos_present =
	((VCD_FRAME_FLAG_EOS & ddl->input_frame.vcd_frm.flags));

	ddl->output_frame.frm_trans_end = !eos_present;
	ddl_context->ddl_callback(VCD_EVT_RESP_OUTPUT_DONE, VCD_S_SUCCESS,
		&(ddl->output_frame),	sizeof(struct ddl_frame_data_tag),
		(u32 *) ddl, ddl_context->client_data);

	if (eos_present) {
		VIDC_LOG_STRING("ENC-EOS_DONE");
		ddl_context->ddl_callback(VCD_EVT_RESP_EOS_DONE,
				VCD_S_SUCCESS, NULL, 0,	(u32 *)ddl,
				ddl_context->client_data);
	}

	ddl_move_client_state(ddl, DDL_CLIENT_WAIT_FOR_FRAME);
	DDL_IDLE(ddl_context);
}
예제 #2
0
static void ddl_encoder_frame_run_callback(struct ddl_context_type
					   *p_ddl_context)
{
	struct ddl_client_context_type *p_ddl = p_ddl_context->p_current_ddl;
	struct ddl_encoder_data_type *p_encoder = &(p_ddl->codec_data.encoder);
	u32 b_eos_present = FALSE;

	if (!DDLCLIENT_STATE_IS(p_ddl, DDL_CLIENT_WAIT_FOR_FRAME_DONE)
		) {
		VIDC_LOG_STRING("STATE-CRITICAL-ENCFRMRUN");
		ddl_client_fatal_cb(p_ddl_context);
		return;
	}

	VIDC_LOG_STRING("ENC_FRM_RUN_DONE");

	ddl_move_command_state(p_ddl_context, DDL_CMD_INVALID);
	vidc_720p_enc_frame_info(&p_encoder->enc_frame_info);

	p_ddl->output_frame.vcd_frm.n_ip_frm_tag =
		p_ddl->input_frame.vcd_frm.n_ip_frm_tag;
	p_ddl->output_frame.vcd_frm.n_data_len =
		p_encoder->enc_frame_info.n_enc_size;
	p_ddl->output_frame.vcd_frm.n_flags |= VCD_FRAME_FLAG_ENDOFFRAME;
	ddl_get_frame_type
		(&(p_ddl->output_frame.vcd_frm),
		 p_encoder->enc_frame_info.n_frame_type);
	ddl_process_encoder_metadata(p_ddl);

	ddl_encode_dynamic_property(p_ddl, FALSE);

	p_ddl->input_frame.b_frm_trans_end = FALSE;
	p_ddl_context->ddl_callback(VCD_EVT_RESP_INPUT_DONE, VCD_S_SUCCESS,
		&(p_ddl->input_frame), sizeof(struct ddl_frame_data_type_tag),
		(u32 *) p_ddl, p_ddl_context->p_client_data);

#ifdef CORE_TIMING_INFO
	ddl_calc_core_time(1);
#endif
	
   b_eos_present =
	((VCD_FRAME_FLAG_EOS & p_ddl->input_frame.vcd_frm.n_flags));

	p_ddl->output_frame.b_frm_trans_end = !b_eos_present;
	p_ddl_context->ddl_callback(VCD_EVT_RESP_OUTPUT_DONE, VCD_S_SUCCESS,
		&(p_ddl->output_frame),	sizeof(struct ddl_frame_data_type_tag),
		(u32 *) p_ddl, p_ddl_context->p_client_data);

	if (b_eos_present) {
		VIDC_LOG_STRING("ENC-EOS_DONE");
		p_ddl_context->ddl_callback(VCD_EVT_RESP_EOS_DONE,
				VCD_S_SUCCESS, NULL, 0,	(u32 *)p_ddl,
				p_ddl_context->p_client_data);
	}

	ddl_move_client_state(p_ddl, DDL_CLIENT_WAIT_FOR_FRAME);
	DDL_IDLE(p_ddl_context);
}