int main(int argc, char *argv[])
{
    HTEST *hTest = NULL;
    OMX_STRING component = NULL;
    OMX_STRING in_file = NULL, out_file = NULL;
	OMX_S32 width, height, bitrate;
    FORMAT fmt;

    if(argc < 6) {
        printf("Unit test of vpu encoder component.\n");
        printf("This test read data from in_file then store the encoded data to out_file.\n");
        printf("Usage: ./bin <in_file> <width> <height> <out_file> <bitrate>\n");
        return 0;
    }

    OMX_Init();
    in_file = argv[1];
	width = atoi(argv[2]);
	height = atoi(argv[3]);
    out_file = argv[4];
	bitrate = atoi(argv[5]);
	fmt = H264;
	if (fmt == H264) {
		component = "OMX.Freescale.std.video_encoder.avc.hw-based";
	} else if (fmt == H263) {
		component = "OMX.Freescale.std.video_encoder.h263.hw-based";
	} else {
		printf("wrong format.\n");
		return 0;
	}
    hTest = create_test(component, in_file, width, height, out_file, fmt, bitrate);
    if(hTest == NULL) {
        printf("Create test failed.\n");
        return 0;
    }

    load_component(hTest);
    StateTrans(hTest, OMX_StateIdle);
    StateTrans(hTest, OMX_StateExecuting);
    wait_eos(hTest);
    StateTrans(hTest, OMX_StateIdle);
    StateTrans(hTest, OMX_StateLoaded);
    unload_component(hTest);

    delete_test(hTest);
    OMX_Deinit();

    printf("Vpu component test is done.\n");

    return 1;
}
int main(int argc, char *argv[])
{
	HTEST *hTest = NULL;
	OMX_STRING component = NULL;
	OMX_STRING in_file = NULL, out_file = NULL;
	FORMAT fmt;

	if(argc < 4)
	{
		printf("Unit test of vpu component.\n");
		printf("This test read data from in_file then store the decoded data to out_file.\n");
		printf("Usage: ./bin <in_file> <out_file> <format>\n");
		printf("format: 0 -- mpeg4\n");
		printf("        1 -- h264\n");
		return 0;
	}

	OMX_Init();
	component = "OMX.Freescale.std.video_decoder.avc.v3.hw-based";
	in_file = argv[1];
	out_file = argv[2];
	fmt = (FORMAT) atoi(argv[3]);
	hTest = create_test(component, in_file, out_file, fmt);
	if(hTest == NULL)
	{
		printf("Create test failed.\n");
		return 0;
	}

#if 1
	load_component(hTest);
	StateTrans(hTest, OMX_StateIdle);
	StateTrans(hTest, OMX_StateExecuting);
	wait_eos(hTest);
	StateTrans(hTest, OMX_StateIdle);
	StateTrans(hTest, OMX_StateLoaded);
	unload_component(hTest);
#else
	cmd_process(hTest);
#endif

	delete_test(hTest);
	OMX_Deinit();

	printf("Vpu component test is done.\n");

	return 1;
}