/* 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 u_ch_hdlr.h 
 *  $File: //DTV/PROD_BR/DTV_X_IDTV1501/apollo/middleware/public/svctx/ch_hdlr/u_ch_hdlr.h $
 *  $Revision: #1 $
 *  $Date: 2015/05/29 $
 *  $Author: brianpc.huang $
 *  
 *  @par Description:
 *
 */
/*----------------------------------------------------------------------------*/
#ifndef _U_CH_HDLR_H_
#define _U_CH_HDLR_H_
/*-----------------------------------------------------------------------------
 *  include files
 *---------------------------------------------------------------------------*/
#include "u_common.h"
#include "u_tuner.h"
#include "u_sm.h"
#include "u_sm_cc_hdlr.h"
#include "u_analog_brdcst.h"

/*----------------------------------------------------------------------------*/
/*! @defgroup groupMW_SVCTX_CH_HDLR Channel Handler
 *
 *  @ingroup groupMW_SVCTX
 *  @brief For user change channel.
 *
 *  %MW Application API would be used by Application, lot of these APIs would
 *   be wrapped from Exported API. Using these APIs, application could change channel.
 *
 *  @see groupMW_SVCTX
 *  @{ 
 */
/*----------------------------------------------------------------------------*/


/*-----------------------------------------------------------------------------
 * structure, constants, macro definitions
 *---------------------------------------------------------------------------*/

#define SVCTX_GRP_CH                                      (2<<SVCTX_TYPE_CODE_BITS)    /**<  channel group mask */
/* channel handler set types *********************************************************/
#define SVCTX_CH_SET_TYPE_IGNORE                          ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 0))    /**< skip this set type */
/* will not do any connection and treat such SVL record as no signal for client */
#define SVCTX_CH_SET_INVALID_SVL_REC_NW_MASK_BIT          ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 1))    /**< use invalid svl rec type */
#define SVCTX_CH_SET_AUD_AV_SYNC_MODE                     ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 2))    /**< use av sync mode type */
#define SVCTX_CH_SET_VID_I_FRAME_MODE                     ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 3))    /**< use video I fream type */
#define SVCTX_CH_SET_FREQ_LIST_UPDATED_CHK                ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 4))    /**< request to check frequency list update for RiksTV */
#define SVCTX_CH_SET_RECOVER_FROM_ALTER_TUNE              ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 5))    /**< request to recover from alternative freq tuning for RiksTV */
#define SVCTX_CH_SET_DELIVERY_SYSTEM_CHANGE               ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 6))    /**< request to notify to AP when delivery system change */
#define SVCTX_CH_SET_IS_MHEG_ACTIVE                       ((SVCTX_SET_TYPE_T)(SVCTX_GRP_CH | 7))    /**< MHEG5 set to notify svctx if it is active */

/* channel handler get types *********************************************************/
#define SVCTX_CH_GET_TYPE_IGNORE                          ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 0))    /**< skip this get type */
#define SVCTX_CH_GET_TYPE_CH_SRC                          ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 1)) /**< type = CH_SRC_TYPE_T*   size = sizeof(CH_SRC_TYPE_T)   */
#define SVCTX_CH_GET_SILENT_STATUS                        ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 2)) /**< type = BOOL*            size = sizeof(BOOL)            */
#define SVCTX_CH_GET_SILENT_SVC_REC_ID                    ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 3)) /**< type = UINT16*          size = sizeof(UINT16)          */
#define SVCTX_CH_GET_AUX_AUDIO_STATUS                     ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 4)) /**< type = SM_COND_T*       size = sizeof(SM_COND_T)       */
#define SVCTX_CH_GET_BRDCST_TYPE                          ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 5)) /**< type = BRDCST_TYPE_T*   size = sizeof(BRDCST_TYPE_T)   */
#define SVCTX_CH_GET_SRC_SVL_INFO                         ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 6)) /**< type = SRC_SVL_INFO_T*  size = sizeof(SRC_SVL_INFO_T)  */
#define SVCTX_CH_GET_SRC_FREQ_INFO                        ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 7)) /**< type = SRC_FREQ_INFO_T* size = sizeof(SRC_FREQ_INFO_T) */
#define SVCTX_CH_GET_FIRST_CH_SURF                        ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 8)) /**< type = BOOL*   size = sizeof(BOOL) */
#define SVCTX_CH_GET_NON_BRDCSTING_SVC                    ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 9)) /**< type = BOOL*   size = sizeof(BOOL) */
/*Notes : the following just for SYS_MHP_SUPPORT */
#define SVCTX_CH_GET_CUR_STC                              ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 10)) /**< type = STC_T*   size = sizeof(STC_T) */ /* cur_STC& svl_ST_ID just SYS_MHP_SUPPORT*/
#define SVCTX_CH_GET_SILENT_SVL_LST_ID                    ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 11)) /**< type = UINT16*  size = sizeof(UINT16)  */
#define SVCTX_CH_GET_CURRENT_TS_ID                        ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 12)) /**< type = UINT16*  size = sizeof(UINT16)  */ /* just SYS_MHP_SUPPORT */
#define SVCTX_CH_GET_AUD_ORIG_SCRAMBLE_STATUS             ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 13)) /**< type = BOOL*    size = sizeof(BOOL)  */
#define SVCTX_CH_GET_VID_ORIG_SCRAMBLE_STATUS             ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 14)) /**< type = BOOL*    size = sizeof(BOOL)  */
#define SVCTX_CH_GET_TUNER_SERIAL_NO                      ((SVCTX_GET_TYPE_T)(SVCTX_GRP_CH | 15)) /**< type = UINT32*    size = sizeof(UINT32)  */

/*------------------------------------------------------------------*/
/*! @enum   SVCTX_AV_SYNC_MODE_T
 *  @brief  av sync type
 *  @code
 *  typedef enum
 *  {
 *      SVCTX_AV_SYNC_FREE_RUN = 0, 
 *      SVCTX_AV_SYNC_SLAVE,        
 *      SVCTX_AV_SYNC_MASTER        
 *  }   SVCTX_AV_SYNC_MODE_T;
 *  @endcode
 *  @li@c  SVCTX_AV_SYNC_FREE_RUN                        SVCTX_AV_SYNC_FREE_RUN- 
 *                                                                                  don't care av sync    
 *  @li@c  SVCTX_AV_SYNC_SLAVE                               SVCTX_AV_SYNC_SLAVE- 
 *                                                                                  slave sync av
 *  @li@c  SVCTX_AV_SYNC_MASTER                             SVCTX_AV_SYNC_MASTER- 
 *                                                                                   master sync av
 */
/*------------------------------------------------------------------*/
typedef enum
{
    SVCTX_AV_SYNC_FREE_RUN = 0, /* No need to sync */
    SVCTX_AV_SYNC_SLAVE,        /* Sync to STC */
    SVCTX_AV_SYNC_MASTER        /* Update A-PTS to A-STC, may use in PCR or HardDisk playback */
}   SVCTX_AV_SYNC_MODE_T;

#endif /* _U_CH_HDLR_H_ */

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

