/*
 *******************************************************************************
 *  Copyright (c) 2010-2022 VATICS(KNERON) Inc. All rights reserved.
 *
 *  +-----------------------------------------------------------------+
 *  | THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY ONLY BE USED |
 *  | AND COPIED IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF SUCH  |
 *  | A LICENSE AND WITH THE INCLUSION OF THE THIS COPY RIGHT NOTICE. |
 *  | THIS SOFTWARE OR ANY OTHER COPIES OF THIS SOFTWARE MAY NOT BE   |
 *  | PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER PERSON. THE   |
 *  | OWNERSHIP AND TITLE OF THIS SOFTWARE IS NOT TRANSFERRED.        |
 *  |                                                                 |
 *  | THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT   |
 *  | ANY PRIOR NOTICE AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY |
 *  | VATICS(KNERON) INC.                                             |
 *  +-----------------------------------------------------------------+
 *
 *******************************************************************************
 */
#ifndef AUDIO_TU_H
#define AUDIO_TU_H

#include <comm/video_buf.h>

#ifdef __cplusplus
extern "C" {
#endif

typedef enum 
{
	VMF_ATU_CMD_ENABLE = 0,		//!> Enable T3/T4 detection
	VMF_ATU_CMD_DISABLE,		//!> Disable T3/T4 detection
	VMF_ATU_CMD_RESET_FLAG, 	//!> Reset T3/T4 flag
	VMF_ATU_CMD_SYNC_TIME       //!> Sync audio timestamp
}VMF_ATU_COMMAND;

typedef struct
{
    VMF_ATU_COMMAND eCmdFlag;
    unsigned int adwUserData[3];
}VMF_ATU_OPTION_T;

typedef struct VMF_ATU_HANDLE_T VMF_ATU_HANDLE_T;

typedef struct
{
	unsigned int 	bT3Detected;	//! 1: T3 detected
	unsigned int 	bT4Detected;	//! 1: T4 detected
	int 			iDOAResult;		//! The corresponding angle is -90 ~ 90
} VMF_ATU_RESULT_T;

/**
 * @brief Function to initialize ATU handle.
 *
 * @return The handle of ATU handle.
 */
VMF_ATU_HANDLE_T* VMF_ATU_Init();

/**
 * @brief Function to release ATU handle
 *
 * @param[in] ptHandle The handle of ATU.
 * @return Success: 0  Fail: negative integer.
 */
int VMF_ATU_Release(VMF_ATU_HANDLE_T* ptHandle);

/**
 * @brief Get result on ATU handle.
 *
 * @param[in] ptHandle The handle of T3/T4 detection.
 * @param[in] pResult The pointer to VMF_ATU_RESULT_T structure.
 * @return Success: 0  Fail: negative integer
 */
int VMF_ATU_GetResult(VMF_ATU_HANDLE_T* ptHandle, VMF_ATU_RESULT_T* pResult);


/**
 * @brief Set option to ATU handle.
 *
 * @param[in] ptHandle The handle of ATU.
 * @param[in] ptOption Option of ATU handle.
 * @return Success: 0  Fail: negative integer
 */
int VMF_ATU_SetOption(VMF_ATU_HANDLE_T* ptHandle, VMF_ATU_OPTION_T* ptOption);

#ifdef __cplusplus
}
#endif

#endif //AUDIO_TU_H