/*************************************************************************** * Copyright (c) 2002, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: bcmDccTransportMux.h $ * $brcm_Revision: \main\SanJose_MSTV_Devel\1 $ * $brcm_Date: 3/12/02 4:45p $ * * Module Description: * * Revision History: * * $brcm_Log: $ * * \main\SanJose_MSTV_Devel\1 3/12/02 4:45p erikg * Merge from SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38 * * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\3 3/12/02 3:58p erikg * removed the winner function * * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\2 3/7/02 4:21p erikg * more fleshing out * * \main\SanJose_MSTV_Devel_erikg_mpegccxport2_2002_03_06_1118_38\1 3/6/02 11:29a erikg * new include files * ***************************************************************************/ /*************************************************************************** * Theory of Operation * -------------------- * * This module is used to detect which 608 CC data formats are * present in an MPEG stream. It does this by maintaining an * accumulation count for each type. When each 608 data type * is encountered in the stream, its corresponding count is * incremented. These counts continue to accumulate up to a * maximum. The maximum can be thought of as a clip value. In * a basic sense, those types whose counts are at the maximum * are present. * * To handle the case when a type is disappears from the stream, * we periodically subtract from each count. We chose the increment * value and decrement value such that if a type is present, its * count will increment eventhough its count is also periodically * decremented. For example, the increment may be 3 while the * decrement may be 1. * * Finally, we define some threshhold, which is below the maximum, * above which we consider the type to be present in the stream. * ***************************************************************************/ #ifndef BCMDCCTRANSPORTMUX_H #define BCMDCCTRANSPORTMUX_H #ifdef __cplusplus extern "C" { #endif /********************** * * TYPES * **********************/ /******************************************** * * Enum: CCMUX_TYPES * * Description: * * CCMUX_TYPES enumerates the possible * 608 CC data types detectable by the * parser. * ********************************************/ typedef enum tagCCMUX_TYPES { cctDVS157 = 0, cctA053_608 = 1, cctA053_DTVCC = 2, cctUnknown = 3, NUM_CCTYPE = 4, NoMatch = 9 } CCMUX_TYPES ; /******************************************** * * Structure: DCC_CC608_MUX_STATE * * Description: * * The DCC_CC608_MUX_STATE structure holds the * state for multiplexing 608 CC data output. * The state consists of a 'leaky' accumulation * count for each 608 CC type. * ********************************************/ typedef struct tagDCC_CC608_MUX_STATE { /* * aCCTypeLeakyCount * * This array holds a leaky accumulation * count for each of the possible 608 * CC data types. For those types that * are detected in the stream, the corresponding * count will accumulate to a maximum value. * For those types that do not appear, their * counts will decrease (leak) over time to * zero. */ int aCCTypeLeakyCount[NUM_CCTYPE] ; } DCC_CC608_MUX_STATE ; /********************** * * FUNCTIONS * **********************/ /************************************************************************** * * Function: CC608Mux_Init * * Inputs: * pState - state to init * * Outputs: * pState - state is modified * * Returns: * * Description: * * This function initializes the count array to all zeros. * **************************************************************************/ void CC608Mux_Init(DCC_CC608_MUX_STATE * pState) ; /************************************************************************** * * Function: CC608Mux_LeakAll * * Inputs: * pState - state, previously init'ed * * Outputs: * pState - state is modified * * Returns: * * Description: * * This function subtracts CC608_LEAK_VAL from all counts, ensuring * that no count falls below zero. * **************************************************************************/ void CC608Mux_LeakAll(DCC_CC608_MUX_STATE * pState) ; /************************************************************************** * * Function: CC608Mux_Accumulate * * Inputs: * pState - state, previously init'ed * ccType - type to accumulate * * Outputs: * pState - state is modified * * Returns: void * * Description: * * This function adds CC608_ACCUMULATE_VAL to all counts, ensuring * that no count rises greater than CC608_CLIP_VAL. * **************************************************************************/ void CC608Mux_Accumulate(DCC_CC608_MUX_STATE * pState, CCMUX_TYPES ccType) ; /************************************************************************** * * Function: CC608Mux_IsDetected * * Inputs: * pState - state, previously init'ed * cct - type * * Outputs: * * * Returns: 1 iff the given type (cct) is detected. * * Description: * * This function compares the accumulated count against the threshhold * value. If greater or equal, this function returns 1, else 0. * **************************************************************************/ int CC608Mux_IsDetected(DCC_CC608_MUX_STATE * pState, CCMUX_TYPES cct) ; #ifdef __cplusplus } #endif #endif /* BCMDCCTRANSPORTMUX_H */