/* 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_sess_gnrc.h 
 *  $RCSfile: $
 *  $Revision$
 *  $Date$
 *  $Author$
 *  
 *  @par Description:
 *         This header file contains Stream Manager's generic session exported 
 *         definitions.
 */
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/*! @addtogroup groupMW_STRM_MNGR_SESS_GNRC_HDLR
 *  @{ 
 */
/*----------------------------------------------------------------------------*/
#ifndef _U_SM_SESS_GNRC_H_
#define _U_SM_SESS_GNRC_H_

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

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

/* set/get types *************************************************************/
#define SM_GRP_SESS_GNRC              (( SM_GRP_LAST_ENTRY + 10 ) << SM_CODE_BITS)    /**<        */
#define SM_GRP_TUNL_PCR               (( SM_GRP_LAST_ENTRY + 11 ) << SM_CODE_BITS)    /**<        */

/* get types *****************************************************************/
#define SM_SESS_GNRC_GET_TYPE_PCR              ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 0))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_PCR_ID           ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 1))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_STC              ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 2))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_MEDIA_FMT        ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 3))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_BLOCK_PSI        ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 4))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_CURR_LBA         ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 5))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_CURR_TICK_NUM    ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 6))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_POST_INFO        ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 7))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_UOP_CAP          ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 8))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_STC_SIGNED       ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 9))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_STC_ID           ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 10))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_STC_OFFSET       ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 11))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_TLVDMX_IDX       ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 12))    /**<        */
#define SM_SESS_GNRC_GET_TYPE_TTML_PTS         ((SM_GET_TYPE_T)(SM_GRP_SESS_GNRC | 13))


/* set types *****************************************************************/
#define SM_SESS_GNRC_SET_TYPE_SCART_OUT        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 0))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_AV_SYNC          ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 1))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_ADD_RANGE        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 2))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_DEL_RANGE        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 3))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_SPEED            ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 4))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_STC              ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 5))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_SEEK             ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 6))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_BLOCK_PSI        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 7))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_REC_BUF_RANGE    ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 8))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_MONITOR_LBA      ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 9))    /**<        */
/*ab_repeat_driver*/
#define SM_SESS_GNRC_SET_TYPE_AB_POSITION      ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 10))
#define SM_SESS_GNRC_SET_TYPE_AV_SYNC_EX      ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 11))
#define SM_SESS_GNRC_SET_TYPE_STC_CTRL         ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 12))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_MM_AUTOTEST     ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 13))
#define SM_SESS_GNRC_SET_TYPE_3D_PROPERTY     ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 14))
#define SM_SESS_GNRC_SET_TYPE_SEEK_WITH_PTS   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 15))
#define SM_SESS_GNRC_SET_TYPE_SPEED_WITH_PTS  ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 16))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_HDMVC_INFO      ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 17))
#define SM_SESS_GNRC_SET_TYPE_PARSE_HDR_CMD   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 18))
#define SM_SESS_GNRC_SET_TYPE_PCR_THRESHOLD   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 19)) 
#define SM_SESS_GNRC_SET_TYPE_FLUSH_FEEDER   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 20))/**<        */
#define SM_SESS_GNRC_SET_TYPE_AUDIO_CODEC_CHG_DONE        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 21))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_ALL_GNRC_STREAM_ID        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 22))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_TS_DURATION        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 23))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_PVR_PLAYBACK_INFO     ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 24))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_TS_MARLIN_DECRYPT_INFO    ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 25))
#define SM_SESS_GNRC_SET_TYPE_PUSH_CHANGE_AUDIO        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 26))
#define SM_SESS_GNRC_SET_TYPE_PLAY_ONE_FRM        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 27))    /**<        */
#define SM_SESS_GNRC_SET_TYPE_DESC_KEY_INFO   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 28))
#define SM_SESS_GNRC_SET_TYPE_FAST_SRART_THRESHOLD     ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 29))
#define SM_SESS_GNRC_SET_TYPE_AUDIO_ES_BYTE_RATE        ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 30))
#define SM_SESS_GNRC_SET_TYPE_VIDEO_CODEC_NOT_SUPPORT   ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 31))
#define SM_SESS_GNRC_SET_TYPE_TRICK_END_POS             ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 32))
#define SM_SESS_GNRC_SET_TYPE_SLOT_INFO             ((SM_SET_TYPE_T)(SM_GRP_SESS_GNRC | 33))

/*------------------------------------------------------------------*/
/*! @enum  SM_SESS_GNRC_MM_SYNC_T
 *  @brief  Multimedia sync mode.
 *  @code
 *  typedef enum
 *  {
 *      SM_SESS_GNRC_MM_SYNC_UNKNOWN  =   0,
 *      SM_SESS_GNRC_MM_SYNC_FREE_RUN ,     
 *      SM_SESS_GNRC_MM_SYNC_AUDIO_MASTER,
 *      SM_SESS_GNRC_MM_SYNC_VIDEO_MASTER,
 *      SM_SESS_GNRC_MM_SYNC_SYSTEM_MASTER        
 *  } SM_SESS_GNRC_MM_SYNC_T;
 *  @endcode
 *  @li@c  SM_SESS_GNRC_MM_SYNC_FREE_RUN                     - Sync mode in unsure mode .
 *  @li@c  SM_SESS_GNRC_MM_SYNC_FREE_RUN                     -Free run sync mode.
 *  @li@c  SM_SESS_GNRC_MM_SYNC_AUDIO_MASTER                 -Audio master sync mode.
 *  @li@c  SM_SESS_GNRC_MM_SYNC_VIDEO_MASTER                 -Video master sync mode.
 *  @li@c  SM_SESS_GNRC_MM_SYNC_SYSTEM_MASTER                -System master sync mode.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    SM_SESS_GNRC_MM_SYNC_UNKNOWN       =   0,
    SM_SESS_GNRC_MM_SYNC_FREE_RUN,
    SM_SESS_GNRC_MM_SYNC_AUDIO_MASTER,
    SM_SESS_GNRC_MM_SYNC_VIDEO_MASTER,
    SM_SESS_GNRC_MM_SYNC_SYSTEM_MASTER        
} SM_SESS_GNRC_MM_SYNC_T;

/*------------------------------------------------------------------*/
/*! @enum  SM_SESS_GNRC_MM_SYNC_T
 *  @brief  Multimedia sync mode.
 *  @code
*typedef enum
*{
 *   SM_SESS_STC_AV_SYNC_MODE_FREE_RUN       =   0x0,
 *   SM_SESS_STC_AV_SYNC_MODE_AUDIO_MASTER,
 *   SM_SESS_STC_AV_SYNC_MODE_VIDEO_MASTER,
*    SM_SESS_STC_AV_SYNC_MODE_SYSTEM_MASTER    
*} SM_SESS_STC_AV_SYNC_MODE_T;
 *  @endcode
 *  @li@c  SM_SESS_STC_AV_SYNC_MODE_FREE_RUN                     - Free run sync mode .
 *  @li@c  SM_SESS_STC_AV_SYNC_MODE_AUDIO_MASTER                     -Audio master sync mode.
 *  @li@c  SM_SESS_STC_AV_SYNC_MODE_VIDEO_MASTER                 -Video master sync mode.
 *  @li@c  SM_SESS_STC_AV_SYNC_MODE_SYSTEM_MASTER                 -System sync mode.
  */
/*------------------------------------------------------------------*/
typedef enum
{
    SM_SESS_STC_AV_SYNC_MODE_FREE_RUN       =   0x0,
    SM_SESS_STC_AV_SYNC_MODE_AUDIO_MASTER,
    SM_SESS_STC_AV_SYNC_MODE_VIDEO_MASTER,
    SM_SESS_STC_AV_SYNC_MODE_SYSTEM_MASTER    
} SM_SESS_STC_AV_SYNC_MODE_T;

/*------------------------------------------------------------------*/
/*! @struct SM_SESS_GNRC_DATA_T
 *  @brief  Contains generic session info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_DATA_T
 *  {
 *      BOOL                    b_disable_av_sync;
 *      MEDIA_FORMAT_T          t_media_fmt;
 *      SM_SESS_GNRC_MM_SYNC_T  e_mm_sync_mode;
 *      STC_T                   t_stc_init;
 *      BOOL                    b_es_with_pts_in;
 *  } SM_SESS_GNRC_DATA_T;
 *  @endcode
 *  @li@c  b_disable_av_sync                                 - whether disable AV sync .
 *  @li@c  t_media_fmt                                       - mutimedia format.
 *  @li@c  e_mm_sync_mode                                    -mutimedia sync mode
 *  @li@c  t_stc_init                                        -stc init value.
 *  @li@c  b_es_with_pts_in                                  -whether ES with PTS.
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_DATA_T
{
    BOOL                    b_disable_av_sync;
    MEDIA_FORMAT_T          t_media_fmt;
    MM_PRIORITY_TYPE_T      e_priority;
    SM_SESS_GNRC_MM_SYNC_T  e_mm_sync_mode;
    STC_T                   t_stc_init;
    BOOL                    b_es_with_pts_in;
    BOOL                    b_sub_freerun; 
    BOOL                    b_free_ca_mode;
    BOOL                    b_in_pip_mode;
    BOOL                    b_occupy_ci_cam;
    BOOL                    b_thumbnail_playback;
    BOOL                    b_mmp_support_ci_plus;
} SM_SESS_GNRC_DATA_T;

/* SM_SESS_GNRC_SET_TYPE_SCART_OUT *******************************************/
/*------------------------------------------------------------------*/
/*! @struct SM_SESS_GNRC_SCART_OUT_T
 *  @brief  Contain generic session scart out info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_SCART_OUT_T
 *  {
 *      BOOL    b_set_by_name;
 *      union
 *      {
 *          CHAR*   s_scart_name;
 *          UINT16  ui2_comp_id;
 *      } u;
 *      BOOL    b_enable;
 *  } SM_SESS_GNRC_SCART_OUT_T;
 *  @endcode
 *  @li@c  b_set_by_name                                     -whether set by name type.
 *  @li@c  s_scart_name                                      -scart name.
 *  @li@c  ui2_comp_id                                       -component id.
 *  @li@c  b_enable                                          -whether enable.
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_SCART_OUT_T
{
    BOOL    b_set_by_name;
    union
    {
        CHAR*   s_scart_name;
        UINT16  ui2_comp_id;
    } u;
    BOOL    b_enable;
} SM_SESS_GNRC_SCART_OUT_T;

/* SM_SESS_GNRC_SET_TYPE_AV_SYNC *********************************************/
/*------------------------------------------------------------------*/
/*! @enum  SM_SESS_GNRC_AV_SYNC_TYPE_T
 *  @brief  Identify AV sync mode.
 *  @code
 *  typedef enum 
 *  {
 *      SM_SESS_GNRC_AV_SYNC_OFF = 0,
 *      SM_SESS_GNRC_AV_SYNC_AUTO,
 *      SM_SESS_GNRC_AV_SYNC_FORCE_PCR_PID
 *  } SM_SESS_GNRC_AV_SYNC_TYPE_T;
 *  @endcode
 *  @li@c  SM_SESS_GNRC_AV_SYNC_OFF                          -sync off
 *  @li@c  SM_SESS_GNRC_AV_SYNC_AUTO                         -auto mode
 *  @li@c  SM_SESS_GNRC_AV_SYNC_FORCE_PCR_PID                -sync use force PCR PID mode.
 */
/*------------------------------------------------------------------*/
typedef enum 
{
    SM_SESS_GNRC_AV_SYNC_OFF = 0,
    SM_SESS_GNRC_AV_SYNC_AUTO,
    SM_SESS_GNRC_AV_SYNC_FORCE_PCR_PID
} SM_SESS_GNRC_AV_SYNC_TYPE_T;

/*------------------------------------------------------------------*/
/*! @struct  SM_SESS_GNRC_AV_SYNC_INFO_T
 *  @brief  Contains generic session AV sync info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_AV_SYNC_INFO_T
 *  {
 *      SM_SESS_GNRC_AV_SYNC_TYPE_T   e_av_sync_type;
 *      union
 *      {
 *          MPEG_2_PID_T              t_force_pcr_pid;
 *      } u;
 *  } SM_SESS_GNRC_AV_SYNC_INFO_T;
 *  @endcode
 *  @li@c  e_av_sync_type                                    -av sync type.
 *  @li@c  t_force_pcr_pid                                   - force PCR PID value.
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_AV_SYNC_INFO_T
{
    SM_SESS_GNRC_AV_SYNC_TYPE_T   e_av_sync_type;
    
    union
    {
        MPEG_2_PID_T              t_force_pcr_pid;
    } u;
} SM_SESS_GNRC_AV_SYNC_INFO_T;

/*------------------------------------------------------------------*/
/*! @enum  SM_SESS_GNRC_UOP_T
 *  @brief  Specify Multimedia UOP type.
 *  @code
 *  typedef enum
 *  {
 *      _SM_SESS_GNRC_UOP_UNKNOWN = 0,
 *      _SM_SESS_GNRC_UOP_SEEK,
 *      _SM_SESS_GNRC_UOP_TRICK
 *  } SM_SESS_GNRC_UOP_T;
 *  @endcode
 *  @li@c  _SM_SESS_GNRC_UOP_UNKNOWN                         -unknown UOP type.
 *  @li@c  _SM_SESS_GNRC_UOP_SEEK                            -Use seek operation.
 *  @li@c  _SM_SESS_GNRC_UOP_TRICK                           -Use trick operation.
 */
/*------------------------------------------------------------------*/
typedef enum
{
    _SM_SESS_GNRC_UOP_UNKNOWN = 0,
    _SM_SESS_GNRC_UOP_SEEK,
    _SM_SESS_GNRC_UOP_TRICK
} SM_SESS_GNRC_UOP_T;

/*------------------------------------------------------------------*/
/*! @struct  SM_SESS_GNRC_UOP_CAP_INFO_T
 *  @brief  Contains UOP operation info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_UOP_CAP_INFO_T
 *  {
 *      SM_SESS_GNRC_UOP_T  e_uop;
 *      BOOL         b_is_allowed;
 *      union
 *      {
 *          MM_SPEED_TYPE_T t_speed;
 *      } u;
 *  } SM_SESS_GNRC_UOP_CAP_INFO_T;
 *  @endcode
 *  @li@c  e_uop                                             - UOP type.
 *  @li@c  b_is_allowed                                      - whether operation allow.
 *  @li@c  t_speed                                           -Mutimedia speed.
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_UOP_CAP_INFO_T
{
    SM_SESS_GNRC_UOP_T  e_uop;
    BOOL         b_is_allowed;
    union
    {
        MM_SPEED_TYPE_T t_speed;
        /*to be extend*/
    } u;
} SM_SESS_GNRC_UOP_CAP_INFO_T;

/*------------------------------------------------------------------*/
/*! @enum  SM_SESS_GNRC_POST_INFO_TYPE_T
 *  @brief  Specify post info.
 *  @code
 *  typedef enum
 *  {
 *      _SM_SESS_GNRC_POST_INFO_UNKNOWN = 0,
 *      _SM_SESS_GNRC_POST_INFO_MEDIA_BTE_OFST,
 *      _SM_SESS_GNRC_POST_INFO_MEDIA_TM_OFST,
 *      _SM_SESS_GNRC_POST_INFO_MEDIA_RENDER_OFST,
 *      _SM_SESS_GNRC_POST_INFO_RANGE_BTE_OFST,
 *      _SM_SESS_GNRC_POST_INFO_RANGE_TM_OFST
 *  } SM_SESS_GNRC_POST_INFO_TYPE_T;
 *  @endcode
 *  @li@c  _SM_SESS_GNRC_POST_INFO_UNKNOWN                   -
 *  @li@c  _SM_SESS_GNRC_POST_INFO_MEDIA_BTE_OFST            -
 *  @li@c  _SM_SESS_GNRC_POST_INFO_MEDIA_TM_OFST             -
 *  @li@c  _SM_SESS_GNRC_POST_INFO_MEDIA_RENDER_OFST         -
 *  @li@c  _SM_SESS_GNRC_POST_INFO_RANGE_BTE_OFST            -
 *  @li@c  _SM_SESS_GNRC_POST_INFO_RANGE_TM_OFST             -
 */
/*------------------------------------------------------------------*/
typedef enum
{
    _SM_SESS_GNRC_POST_INFO_UNKNOWN = 0,
    _SM_SESS_GNRC_POST_INFO_MEDIA_BTE_OFST,
    _SM_SESS_GNRC_POST_INFO_MEDIA_TM_OFST,
    _SM_SESS_GNRC_POST_INFO_MEDIA_RENDER_OFST,
    _SM_SESS_GNRC_POST_INFO_RANGE_BTE_OFST,
    _SM_SESS_GNRC_POST_INFO_RANGE_TM_OFST
} SM_SESS_GNRC_POST_INFO_TYPE_T;

/*------------------------------------------------------------------*/
/*! @struct  SM_SESS_GNRC_RENDER_INFO_T
 *  @brief  Contains render info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_RENDER_INFO_T
 *  {
 *      UINT64  ui8_pts_info;
 *      UINT64  ui8_i_frame_position;
 *      UINT64  ui8_frame_position;
 *      INT32   i4_temporal_reference;
 *      UINT16  ui2_decoding_order;
 *  }SM_SESS_GNRC_RENDER_INFO_T;
 *  @endcode
 *  @li@c  ui8_pts_info                                      -
 *  @li@c  ui8_i_frame_position                              -
 *  @li@c  ui8_frame_position                                -
 *  @li@c  i4_temporal_reference                             -
 *  @li@c  ui2_decoding_order                                -
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_RENDER_INFO_T
{
    UINT64  ui8_stc;
    UINT64  ui8_aud_pts_info;
    UINT64  ui8_aud_frame_position;
    UINT64  ui8_i_pts_info;
    UINT64  ui8_pts_info;
    UINT64  ui8_i_frame_position;
    UINT64  ui8_frame_position;
    UINT64  ui8_frame_position_disp;
    INT32   i4_temporal_reference;
    UINT16  ui2_decoding_order;
    UINT32  ui4_timestap;
}SM_SESS_GNRC_RENDER_INFO_T;

/*------------------------------------------------------------------*/
/*! @struct  SM_SESS_GNRC_POST_INFO_T
 *  @brief  Contains post info.
 *  @code
 *  typedef struct _SM_SESS_GNRC_FILE_INFO_T
 *  {
 *      SM_SESS_GNRC_POST_INFO_TYPE_T  e_type;
 *      UINT64 ui8_pos_info;
 *      union
 *      {
 *          SM_SESS_GNRC_RENDER_INFO_T render_info;              
 *      } u;
 *  } SM_SESS_GNRC_POST_INFO_T;
 *  @endcode
 *  @li@c  e_type                                            -
 *  @li@c  ui8_pos_info                                      -
 *  @li@c  render_info                                       -
 */
/*------------------------------------------------------------------*/
typedef struct _SM_SESS_GNRC_FILE_INFO_T
{
    SM_SESS_GNRC_POST_INFO_TYPE_T  e_type;
    UINT64 ui8_pos_info;
    union
    {
        SM_SESS_GNRC_RENDER_INFO_T render_info;              
    } u;
} SM_SESS_GNRC_POST_INFO_T;

/* Descrambler algorithms */
typedef enum
{
    SM_DESC_ALG_NONE = 0,          /* None scramble */
    SM_DESC_ALG_DES_ECB,           /* DES-56-ECB*/
    SM_DESC_ALG_DES_CBC,           /* DES-56-CCB*/
    SM_DESC_ALG_3DES_ECB,          /* 3DES-ECB*/
    SM_DESC_ALG_3DES_CBC,          /* 3DES-CCB*/
    SM_DESC_ALG_DVB,               /* DVB */
    SM_DESC_ALG_AES_128_ECB,       /* AES-128-ECB*/
    SM_DESC_ALG_AES_128_CBC        /* AES-128-CCB*/
}   SM_DESC_ALG_T;

typedef enum
{
    SM_DESC_KEY_TYPE_ODD = 0,      
    SM_DESC_KEY_TYPE_EVEN       
}   SM_DESC_KEY_TYPE_T;


/* DES EBC Key information */
typedef struct _SM_DES_ECB_KEY_INFO_T
{
    SIZE_T          z_key_len;    /* size of key in byte */
    const UINT8*    pui1_key;     /* pointer of key buffer */
} SM_DES_ECB_KEY_INFO_T;

/* AES CBC Key information */
typedef struct _SM_AES_128_CBC_KEY_INFO_T
{
    SIZE_T          z_key_len;    /* size of key in byte */
    const UINT8*    pui1_key;     /* pointer of key buffer */
    SIZE_T          z_iv_len;     /* size of iv in byte */
    const UINT8*    pui1_iv;      /* pointer of iv buffer */
} SM_AES_128_CBC_KEY_INFO_T;

/* DVB Key information */
typedef struct _SM_DVB_KEY_INFO_T
{
    SIZE_T          z_key_len;    /* size of key in byte */
    const UINT8*    pui1_key;     /* pointer of key buffer */
    BOOL            b_is_conf_mode;
} SM_DVB_KEY_INFO_T;

/* Definition of descrambler key information */
typedef struct _SM_DESC_KEY_INFO_T
{
    SM_DESC_ALG_T e_descrambler_alg;                   /* descrambler algorithm */
    union
    {
        SM_DES_ECB_KEY_INFO_T t_sm_des_ecb_key;          /*DES-56-ECB*/
        SM_AES_128_CBC_KEY_INFO_T t_sm_aes_128_cbc_key;  /*AES-128-CBC*/
        SM_DVB_KEY_INFO_T t_sm_dvb_key;                  /*DVB KEY*/
    }u_sm_key_info;
}   SM_DESC_KEY_INFO_T;

typedef struct _SM_DESC_KEY_TYPE_INFO_T
{
    SM_DESC_KEY_INFO_T t_sm_desc_key_info;
    SM_DESC_KEY_TYPE_T t_sm_desc_key_type;
}   SM_DESC_KEY_TYPE_INFO_T;

typedef struct _SM_SESS_GNRC_MARLIN_SLOT_INFO_T
{
    INT32           i4_slot;
    MPEG_2_PID_T    t_pid;
}SM_SESS_GNRC_MARLIN_SLOT_INFO_T;
/*-----------------------------------------------------------------------------
                    functions declarations
-----------------------------------------------------------------------------*/



#endif /* _U_SM_SESS_GNRC_H_ */
/*----------------------------------------------------------------------------*/
/*! @} */                                         /* end of groupMW_STRM_MNGR_SESS_GNRC_HDLR */
/*----------------------------------------------------------------------------*/

