/* 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.
 *
 *****************************************************************************/

/*-----------------------------------------------------------------------------
 * $RCSfile: x_wgl_cc.h,v $
 * $Revision: #1 $
 * $Date: 2015/05/29 $
 * $Author: brianpc.huang $
 * $CCRevision: /main/DTV_X_HQ_int/DTV_X_ATSC/1 $
 * $SWAuthor: TC Yin $
 * $MD5HEX: 112905fbb1168f6cafcaec33132fd0c9 $
 *
 * Description: 
 *         This header file contains public interfaces, constant and type 
 *         definitions of the Widget Library.
 *---------------------------------------------------------------------------*/
 
 

/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_WGL_CC Closed Caption Widget
  *  @ingroup groupMW_WGL
  *  @brief Provides x_api function TV Application
  *  %MW Application API would be used by TV Application, lot of these APIs would
  *   be wrapped from Exported API
  *  @see groupMW_WGL
  *  @{ 
  */
/*----------------------------------------------------------------------------*/
     

#ifndef _X_WGL_CC_H_
#define _X_WGL_CC_H_

/*-----------------------------------------------------------------------------
                    include files
 ----------------------------------------------------------------------------*/
#include "u_wgl_cc.h"

#ifdef __cplusplus
extern "C" {
#endif

/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
 ----------------------------------------------------------------------------*/
#define WGL_CC_INIT_CTRL_LOGIC          ((UINT32)0x00000001)
/**<The CC init control logic flag.*/

#define WGL_CC_INIT_DEFAULT_CNT         ((UINT32)0x00000002)
/**<The CC init default content flag.*/

/*-----------------------------------------------------------------------------
                    structures
 ----------------------------------------------------------------------------*/
#define WGL_CC_SYS_INIT_FLAG_FONT_TBL           MAKE_BIT_MASK_32(0)
/**<The CC init flag indicating that the font table is valid.*/

#define WGL_CC_SYS_INIT_FLAG_SMTH_SCRL_SPEED    MAKE_BIT_MASK_32(1)
/**<The CC init flag indicating that the smooth scroll speed is valid.*/

#define WGL_CC_SYS_INIT_FLAG_FLASH_INTERVAL     MAKE_BIT_MASK_32(2)
/**<The CC init flag indicating that the falsh interval is valid.*/

#define WGL_CC_SYS_INIT_FLAG_SYS_MAX_CC_SIZE    MAKE_BIT_MASK_32(3) 
/**<The CC init flag indicating that the system max CC size is valid.*/

#define WGL_CC_SYS_INIT_FLAG_CANVAS_CLR_MODE    MAKE_BIT_MASK_32(4) 
/**<The CC init flag indicating that canvas color mode is valid.*/

#define WGL_CC_SYS_INIT_FLAG_DIS_SMALL_BUFF     MAKE_BIT_MASK_32(5) 
/**<The CC init flag indicating that the disable small buffer flag is valid.(No used)*/

#define WGL_CC_SYS_INIT_FLAG_LAST_FLAG          MAKE_BIT_MASK_32(5)
/**<The CC init flag indicating it is last.*/



/*------------------------------------------------------------------*/
/*! @brief the structure of closed caption resclale information.
  *  @code 
  *  typedef struct _WGL_CC_SYS_INIT_T 
  *  { 
  *         UINT32                              ui4_flags;
  *         WGL_CC_FONT_REG_INFO_T              *at_font_reg_table; 
  *         UINT32                              ui4_scrl_step;
  *         UINT32                              ui4_scrl_delay;
  *         UINT32                              ui4_flash_interval;
  *         UINT32                              ui4_sys_max_cc_width; 
  *         UINT32                              ui4_sys_max_cc_height;   
  *         GL_COLORMODE_T                      e_clr_mode_canvas;
  *  } WGL_CC_SYS_INIT_T; 
  *  @endcode 
  *  @li@c  ui4_flags                    -Reference to the flag indicating which parameters are valid.
  *  @li@c  at_font_reg_table            -Reference to font register table.
  *  @li@c  ui4_scrl_step                -Reference to scroll step.
  *  @li@c  ui4_scrl_delay               -Reference to scroll delay time.
  *  @li@c  ui4_flash_interval           -Reference to flash interval time. 
  *  @li@c  ui4_sys_max_cc_width         -Reference to the system max CC width.
  *  @li@c  ui4_sys_max_cc_height        -Reference to the system max CC height.
  *  @li@c  e_clr_mode_canvas            -Reference to the colormode of CC canvas.
  */
/*------------------------------------------------------------------*/
typedef struct _WGL_CC_SYS_INIT_T
{
    UINT32                              ui4_flags;
    
    /* WGL_CC_SYS_INIT_FLAG_FONT_TBL: [mandate] */
    WGL_CC_FONT_REG_INFO_T              *at_font_reg_table; 
    
    /* WGL_CC_SYS_INIT_FLAG_SMTH_SCRL_SPEED */
    UINT32                              ui4_scrl_step;
    UINT32                              ui4_scrl_delay;
    
    /* WGL_CC_SYS_INIT_FLAG_FLASH_INTERVAL */
    UINT32                              ui4_flash_interval;
    
    /* WGL_CC_SYS_INIT_FLAG_SYS_MAX_CC_SIZE: [mandate] */
    UINT32                              ui4_sys_max_cc_width;       
    UINT32                              ui4_sys_max_cc_height;      
    
    /* WGL_CC_SYS_INIT_FLAG_CANVAS_CLR_MODE: [mandate] */
    GL_COLORMODE_T                      e_clr_mode_canvas;
   
} WGL_CC_SYS_INIT_T;    


/*-----------------------------------------------------------------------------
                    functions
 ----------------------------------------------------------------------------*/
 
/*------------------------------------------------------------------*/
/*! @brief  init the attribute of Closed Caption widget.
 *  @param  [in]    ui4_init_type   - Contains the type of initialization.
 *  @param  [in]    pt_sys_init     - Contains the init parameters.
 *  @note 
 *  @return return the error code
 *  @retval    WGLR_OK                  The routine was successful. 
 *  @retval    WGLR_INV_ARG             The argument is invalid.
 *  @retval    WGLR_OUT_OF_RESOURCE     There isn't sufficient memory.
 */
/*------------------------------------------------------------------*/
extern INT32 x_wgl_cc_init(
    UINT32                              ui4_init_type,
    WGL_CC_SYS_INIT_T                   *pt_sys_init);


#ifdef __cplusplus
}
#endif


#endif



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


