HTEST * create_test(
    OMX_STRING component,
    OMX_STRING in_file)
{
	HTEST *hTest = NULL;

	hTest = (HTEST*)fsl_osal_malloc_new(sizeof(HTEST));
	if(hTest == NULL)
	{
		printf("Failed to allocate memory for test handle.\n");
		return 0;
	}
	fsl_osal_memset(hTest, 0, sizeof(HTEST));

	hTest->name = component;

	hTest->pMsgQ = FSL_NEW(Queue, ());
	if(hTest->pMsgQ == NULL)
	{
		printf("Create message queue failed.\n");
		return 0;
	}
	hTest->pMsgQ->Create(128, sizeof(MSG), E_FSL_OSAL_TRUE);

	MakeDumpFileName(in_file,hTest->dump_file_path0,0);
	MakeDumpFileName(in_file,hTest->dump_file_path1,1);

	hTest->pOutFile0 = fopen(hTest->dump_file_path0, "wb");
	if(hTest->pOutFile0 == NULL)
	{
		printf("Failed to open file: %s\n", hTest->dump_file_path0);
		return 0;
	}
	hTest->pOutFile1 = fopen(hTest->dump_file_path1, "wb");
	if(hTest->pOutFile1 == NULL)
	{
		printf("Failed to open file: %s\n", hTest->dump_file_path1);
		return 0;
	}

	fsl_osal_sem_init(&(hTest->sParserFormatSem), 0, 0);
	return hTest;
}
OMX_ERRORTYPE FileWrite::InstanceInit()
{
    OMX_ERRORTYPE ret = OMX_ErrorNone;

	OMX_S8 dump_file_path0[128];
	OMX_S8 dump_file_path1[128];

	printf("Output file name: %s\n", pMediaName);
	MakeDumpFileName((char *)pMediaName,(char *)dump_file_path0,AUDIO_PORT);
    MakeDumpFileName((char *)pMediaName,(char *)dump_file_path1,VIDEO_PORT);

    pOutFile0 = fopen((char *)dump_file_path0, "wb");
    if(pOutFile0 == NULL) {
        printf("Failed to open file: %s\n", dump_file_path0);
        return OMX_ErrorInsufficientResources;
    }
    pOutFile1 = fopen((char *)dump_file_path1, "wb");
    if(pOutFile1 == NULL) {
        printf("Failed to open file: %s\n", dump_file_path1);
        return OMX_ErrorInsufficientResources;
    }

	return ret;
}