/* 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_sm_event.h 
 *  $RCSfile: $
 *  $Revision: #1 $
 *  $Date: 2015/11/10 $
 *  $Author: dtvbm11 $
 *  
 *  @par Description:
 *         This header file contains Stream Manager specific event definitions,
 *         which are exported.
 */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_STRM_MNGR
 *  @{ 
 */
/*----------------------------------------------------------------------------*/

#ifndef _U_SM_EVENT_H_
#define _U_SM_EVENT_H_


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

/*-----------------------------------------------------------------------------
                    macros, defines, typedefs, enums
-----------------------------------------------------------------------------*/

/* event types ***************************************************************/
typedef UINT32 SM_EVN_TYPE_T;    /**<        */

#define SM_EVN_IGNORE             ((SM_EVN_TYPE_T) 0)    /**<        */

#define SM_EVN_GRP_BIT_MASK       ((SM_EVN_TYPE_T) 0xFFFF0000 )    /**<        */
#define SM_EVN_MAIN_GRP_BIT_MASK  ((SM_EVN_TYPE_T) 0xFF000000 )    /**<        */
#define SM_EVN_SUB_GRP_BIT_MASK   ((SM_EVN_TYPE_T) 0x00FF0000 )    /**<        */
#define SM_EVN_GRP_OPT_HDLR_BEGIN ((SM_EVN_TYPE_T) 0x80000000)    /**<        */

#define SM_MAKE_MAIN_EVN_GRP( id )     ((SM_EVN_TYPE_T) id << 24 )    /**<        */
#define SM_MAKE_MAIN_OPT_EVN_GRP( id )                                        \
    ((SM_EVN_TYPE_T) SM_EVN_GRP_OPT_HDLR_BEGIN + SM_MAKE_MAIN_EVN_GRP(id) )    /**<        */

#define SM_MAKE_EVN_GRP( main_grp, sub_grp_id )  ((SM_EVN_TYPE_T) main_grp | (sub_grp_id<<16) )    /**<        */
#define SM_MAKE_EVN( grp, evn_id )  ((SM_EVN_TYPE_T) (grp&SM_EVN_GRP_BIT_MASK) \
                                     | (evn_id&0x0000FFFF) )    /**<        */

#define SM_EVN_GET_GRP( evn )      ((SM_EVN_TYPE_T) evn & SM_EVN_GRP_BIT_MASK )    /**<        */
#define SM_EVN_GET_MAIN_GRP( evn ) ((SM_EVN_TYPE_T) evn & SM_EVN_MAIN_GRP_BIT_MASK )    /**<        */
#define SM_EVN_GET_SUB_GRP( evn )  ((SM_EVN_TYPE_T) evn & SM_EVN_SUB_GRP_BIT_MASK )    /**<        */

/* Mandatory Event Groups */
#define SM_EVN_GRP_SESS           SM_MAKE_MAIN_EVN_GRP( 1 )    /**<        */
#define SM_EVN_GRP_VS             SM_MAKE_MAIN_EVN_GRP( 2 )    /**<        */
#define SM_EVN_GRP_AS             SM_MAKE_MAIN_EVN_GRP( 3 )    /**<        */
#define SM_EVN_GRP_CA             SM_MAKE_MAIN_EVN_GRP( 4 )    /**<        */
#define SM_EVN_GRP_CCI            SM_MAKE_MAIN_EVN_GRP( 5 )    /**<        */

/* Optional Event Groups */
#define SM_EVN_GRP_CCS            SM_MAKE_MAIN_OPT_EVN_GRP( 1 )    /**<        */
#define SM_EVN_GRP_1394           SM_MAKE_MAIN_OPT_EVN_GRP( 2 )    /**<        */
#define SM_EVN_GRP_SBTL           SM_MAKE_MAIN_OPT_EVN_GRP( 3 )    /**<        */
#define SM_EVN_GRP_TTX            SM_MAKE_MAIN_OPT_EVN_GRP( 4 )    /**<        */
#define SM_EVN_GRP_BYPASS         SM_MAKE_MAIN_OPT_EVN_GRP( 5 )    /**<        */
#define SM_EVN_GRP_SESS_RCRD      SM_MAKE_MAIN_OPT_EVN_GRP( 6 )    /**<        */
#define SM_EVN_GRP_RSH            SM_MAKE_MAIN_OPT_EVN_GRP( 7 )    /**<        */

/* events */
#define SM_EVN_SESS_APP_OPEN_REQ         ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 0)    /**<        */
#define SM_EVN_SESS_APP_PLAY_REQ         ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 1)    /**<        */
#define SM_EVN_SESS_APP_STOP_REQ         ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 2)    /**<        */
#define SM_EVN_SESS_APP_CLOSE_REQ        ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 3)    /**<        */
#define SM_EVN_SESS_DRV_OPENED           ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 4)    /**<        */
#define SM_EVN_SESS_DRV_PLAYED           ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 5)    /**<        */
#define SM_EVN_SESS_DRV_STOPPED          ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 6)    /**<        */
#define SM_EVN_SESS_DRV_CLOSED           ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 7)    /**<        */
#define SM_EVN_SESS_DRV_ERR              ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 8)    /**<        */
#define SM_EVN_SESS_SCDB_CLOSED          ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 9)    /**<        */
#define SM_EVN_SESS_SCDB_UPDATE          ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 10)    /**<        */
#define SM_EVN_SESS_INTERNAL_ERR         ((SM_EVN_TYPE_T) SM_EVN_GRP_SESS + 11)    /**<        */

#define SM_EVN_VS_APP_OPEN_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 0)    /**<        */
#define SM_EVN_VS_APP_PLAY_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 1)    /**<        */
#define SM_EVN_VS_APP_STOP_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 2)    /**<        */
#define SM_EVN_VS_APP_CLOSE_REQ          ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 3)    /**<        */
#define SM_EVN_VS_DRV_OPENED             ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 4)    /**<        */
#define SM_EVN_VS_DRV_PLAYED             ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 5)    /**<        */
#define SM_EVN_VS_DRV_STOPPED            ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 6)    /**<        */
#define SM_EVN_VS_DRV_CLOSED             ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 7)    /**<        */
#define SM_EVN_VS_DRV_ERR                ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 8)    /**<        */
#define SM_EVN_VS_SCDB_RECORD_DEL        ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 9)    /**<        */
#define SM_EVN_VS_SCDB_RECORD_MOD        ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 10)    /**<        */
#define SM_EVN_VS_INTERNAL_ERR           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 11)    /**<        */
#define SM_EVN_VS_VIDEO_RESOLUTION_CHG   ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 12)    /**<        */
#define SM_EVN_VS_AUTO_CLK_POS_PHS_DONE  ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 13)    /**<        */
#define SM_EVN_VS_AUTO_COLOR_DONE        ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 14)    /**<        */
#define SM_EVN_VS_ANA_TV_SIGNAL          ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 15)    /**<        */
#define SM_EVN_VS_ANA_COLOR_SYSTEM       ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 16)    /**<        */
#define SM_EVN_VS_ANA_CONTENT_ADV_INFO   ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 17)    /**<        */
#define SM_EVN_VS_CC_INDICATOR           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 18)    /**<        */
#define SM_EVN_VS_ANA_TV_SIGNAL_DETECTING ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 19)    /**<        */
#define SM_EVN_VS_DIG_DECODE_STATUS_CHG  ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 20)    /**<        */
#define SM_EVN_VS_SPEED_CHG              ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 21)    /**<        */
#define SM_EVN_VS_EOS                    ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 22)    /**<        */
#define SM_EVN_VS_RESTART                ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 23)    /**<        */
#define SM_EVN_VS_CODEC_NOT_SUPPORT      ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 24)    /**<        */
#define SM_EVN_VS_THUMBNAIL_DONE         ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 25)    /**<        */
#define SM_EVN_VS_HDCP_CONTENT           ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 26)    /**<        */
#define SM_EVN_VS_MACROVISION            ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 27)    /**<        */
#define SM_EVN_RANGE_AB_DONE             ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 28)    /*     */
#define SM_EVN_VS_DISP_FRAME             ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 29)    /**<        */
#define SM_EVN_VS_BIT_RATE               ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 30)    /**<        */
#define SM_EVN_VS_VIDEO_PLAY_DONE        ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 31)    /**<        */
#define SM_EVN_VS_FRAMERATE_NOT_SUPPORT  ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 32)    /**<        */
#define SM_EVN_VS_CHAP_DONE              ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 33)    /* divx chapter done */
#define SM_EVN_VS_AUD_PROTECT_INFO       ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 34)    /**<        */
#define SM_EVN_VS_REQ_RESTART            ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 35)    /**<        */
#define SM_EVN_VS_VDP_BIT_RATE_CHG       ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 36)    /**<        */
#define SM_EVN_VS_THUMBNAIL_PLAY_EOS     ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 37)    /**<        */
#define SM_EVN_VS_UHD_420_SIG_CHG        ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 38)    /**<        */
#define SM_EVN_VS_WFD_ERROR              ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 39)    /**<        */
#define SM_EVN_VS_VDP_MUTE_ALL_FINISHED	 ((SM_EVN_TYPE_T) SM_EVN_GRP_VS + 40)    /**<        */


#define SM_EVN_AS_APP_OPEN_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 0)    /**<        */
#define SM_EVN_AS_APP_PLAY_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 1)    /**<        */
#define SM_EVN_AS_APP_STOP_REQ           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 2)    /**<        */
#define SM_EVN_AS_APP_CLOSE_REQ          ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 3)    /**<        */
#define SM_EVN_AS_DRV_OPENED             ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 4)    /**<        */
#define SM_EVN_AS_DRV_PLAYED             ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 5)    /**<        */
#define SM_EVN_AS_DRV_STOPPED            ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 6)    /**<        */
#define SM_EVN_AS_DRV_CLOSED             ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 7)    /**<        */
#define SM_EVN_AS_DRV_ERR                ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 8)    /**<        */
#define SM_EVN_AS_SCDB_RECORD_DEL        ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 9)    /**<        */
#define SM_EVN_AS_SCDB_RECORD_MOD        ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 10)    /**<        */
#define SM_EVN_AS_INTERNAL_ERR           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 11)    /**<        */
#define SM_EVN_AS_AUD_INFO_CHG           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 12)    /**<        */
#define SM_EVN_AS_RESTART                ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 13)    /**<        */
#define SM_EVN_AS_DECODE_STATUS_CHG      ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 14)    /**<        */
#define SM_EVN_AS_EOS                    ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 15)    /**<        */
#define SM_EVN_AS_CODEC_NOT_SUPPORT      ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 16)    /**<        */
#define SM_EVN_AS_SIG_MONITOR_TM         ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 17)    /**<        */
#define SM_EVN_AS_SIG_MONITOR_AUTO_MUTE         ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 18)    /**<        */
#define SM_EVN_AS_TV_AUD_SYS_DETECTED         ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 19)    /**<        */
#define SM_EVN_AS_REQ_RESTART         ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 20)    /**<        */
#define SM_EVN_AS_CODEC_CHG           ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 21)    /**<        */
#define SM_EVN_AS_BIT_RATE_CHG         ((SM_EVN_TYPE_T) SM_EVN_GRP_AS + 22)    /**<        */

#define SM_EVN_CA_COND_CLOSED            ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 0)    /**<        */
#define SM_EVN_CA_COND_UNKNOWN           ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 1)    /**<        */
#define SM_EVN_CA_COND_FREE              ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 2)    /**<        */
#define SM_EVN_CA_COND_AUTHORIZED        ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 3)    /**<        */
#define SM_EVN_CA_COND_AUTHORIZED_CA_SYS_ID ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 4)    /**<        */
#define SM_EVN_CA_COND_NOT_AUTHORIZED    ((SM_EVN_TYPE_T) SM_EVN_GRP_CA + 5)    /**<        */

#define SM_EVN_CCI_INFORMATION           ((SM_EVN_TYPE_T) SM_EVN_GRP_CCI + 0)    /**<        */


#endif /* _U_SM_EVENT_H_ */
/*----------------------------------------------------------------------------*/
/*! @} */                                             /* end of groupMW_STRM_MNGR */
/*----------------------------------------------------------------------------*/

