/* SPDX-License-Identifier: LGPL-2.1-only OR BSD-3-Clause */
/******************************************************************************
 *
 * This file is provided under a dual license.  When you use or
 * distribute this software, you may choose to be licensed under
 * version 2.1 of the GNU Lesser General Public License
 * ("LGPLv2.1 License") or BSD License.
 *
 * LGPLv2.1 License
 *
 * Copyright(C) 2019 MediaTek Inc.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of version 2.1 of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html for more
 * details.
 *
 * BSD LICENSE
 *
 * Copyright(C) 2019 MediaTek Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in
 *    the documentation and/or other materials provided with the
 *    distribution.
 *  * Neither the name of the copyright holder nor the names of its
 *    contributors may be used to endorse or promote products derived
 *    from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 *****************************************************************************/

/*----------------------------------------------------------------------------*/
/*! @file x_sm_cc_isdb_hdlr.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *         This header file contains ISDB closed caption Stream handler specific 
 *         definitions, which are exported to applications.
 */
/*----------------------------------------------------------------------------*/

#ifndef _X_SM_CC_ISDB_HDLR_H_
#define _X_SM_CC_ISDB_HDLR_H_

/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_STRM_MNGR_CCI_HDLR
*  @{  
*/
/*----------------------------------------------------------------------------*/

/*-----------------------------------------------------------------------------
                    include files
-----------------------------------------------------------------------------*/
#include "u_common.h"
#include "u_sm_cc_isdb_hdlr.h"
#include "u_handle.h"


#define CC_ISDB_INIT_OK                 ((INT32) 0)    /**< The routine was successful */
#define CC_ISDB_INIT_FAIL               ((INT32) -1)    /**< The routine was fail */

extern BOOL  fg_g_cc_isdb_raw_data_is_utf8;
extern BOOL  b_is_cc_isdb_lib_enable;
extern BOOL  b_is_isdb_cc_fixed_enable; //MW_ISDB_CC_FIXED



/*------------------------------------------------------------------*/
/*! @struct SM_CCI_CONFIG_T
 *  @brief  This structure contains the configuration data for ISDB closed caption stream handler
 *  @code
 *  typedef struct
 *  {
 *      UINT8                   ui1_wgl_order;
 *  }   SM_CCI_CONFIG_T;
 *  @endcode
 *  @li@c  ui1_wgl_order                                     - ISDB closed caption widget app order
 */
/*------------------------------------------------------------------*/
typedef struct
{
    UINT8                   ui1_wgl_order;
}   SM_CCI_CONFIG_T;

typedef struct
{
	UINT16		ui2_swf_h;
	UINT16		ui2_swf_v;

	UINT16		ui2_sdp_h;
	UINT16		ui2_sdp_v;

	UINT16		ui2_sdf_h;
	UINT16		ui2_sdf_v;

	UINT16		ui2_shs;
	UINT16		ui2_svs;

	UINT16		ui2_ssm_h;
	UINT16		ui2_ssm_v;
}	SM_CCI_FIXED_INFO_T;

/*-----------------------------------------------------------------------------
                    functions declarations
-----------------------------------------------------------------------------*/
/*------------------------------------------------------------------*/
/*! @brief Initialize the ISDB closed caption configuration
 *  @param [in]     pt_config                   - Configuration context
 *  @param [out]
 *  @note
 *  @see
 *  @return     Return the error code.
 *  @retval      CC_ISDB_INIT_OK        - The routine was successful.
 *  @retval      CC_ISDB_INIT_FAIL      - The routine was fail.
 */
/*------------------------------------------------------------------*/
extern INT32 x_sm_cc_isdb_hdlr_init( SM_CCI_CONFIG_T*   pt_config );  

extern INT32 x_sm_cc_isdb_set_fixed_info(SM_CCI_FIXED_INFO_T t_isdb_cc_fixed);

/*------------------------------------------------------------------*/
/*!@brief  This function is used to set the ISDB closed caption attributes.
 *  @param [in]    t_cci_att                    - ISDB CC attributes
 */
/*------------------------------------------------------------------*/
extern VOID x_sm_cc_isdb_hdlr_set_att( SM_CCI_ATTRIBS_T  t_cci_att );  

/*------------------------------------------------------------------*/
/*!@brief  This function is used to get the ISDB closed caption raw data is utf8?
 *  @param [in]    fg_is_utf8_data      - The utf8 flag
 */
/*------------------------------------------------------------------*/
extern VOID x_sm_cc_isdb_raw_data_is_utf8(BOOL  fg_is_utf8_data );


extern INT32 x_sm_cc_isdb_start(UINT16 ui2_pid, HANDLE_T* ph_stream, HANDLE_T h_gl_handle);

extern INT32 x_sm_cc_isdb_stop(HANDLE_T h_stream);
#endif /* _X_SM_CC_ISDB_HDLR_H_ */

/*----------------------------------------------------------------------------*/
/*! @} */                                            /* end of groupMW_STRM_MNGR_CCI_HDLR */
/*----------------------------------------------------------------------------*/



